| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of dart2js; | 5 part of dart2js; |
| 6 | 6 |
| 7 /// A [ConstantEnvironment] provides access for constants compiled for variable | 7 /// A [ConstantEnvironment] provides access for constants compiled for variable |
| 8 /// initializers. | 8 /// initializers. |
| 9 abstract class ConstantEnvironment { | 9 abstract class ConstantEnvironment { |
| 10 /// Returns the constant for the initializer of [element]. | 10 /// Returns the constant for the initializer of [element]. |
| (...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1041 ClassElement superClass = enclosingClass.superclass; | 1041 ClassElement superClass = enclosingClass.superclass; |
| 1042 if (enclosingClass != compiler.objectClass) { | 1042 if (enclosingClass != compiler.objectClass) { |
| 1043 assert(superClass != null); | 1043 assert(superClass != null); |
| 1044 assert(superClass.resolutionState == STATE_DONE); | 1044 assert(superClass.resolutionState == STATE_DONE); |
| 1045 | 1045 |
| 1046 FunctionElement targetConstructor = | 1046 FunctionElement targetConstructor = |
| 1047 superClass.lookupDefaultConstructor(); | 1047 superClass.lookupDefaultConstructor(); |
| 1048 // If we do not find a default constructor, an error was reported | 1048 // If we do not find a default constructor, an error was reported |
| 1049 // already and compilation will fail anyway. So just ignore that case. | 1049 // already and compilation will fail anyway. So just ignore that case. |
| 1050 if (targetConstructor != null) { | 1050 if (targetConstructor != null) { |
| 1051 Selector selector = | 1051 Selector selector = new Selector.callDefaultConstructor(); |
| 1052 new Selector.callDefaultConstructor(enclosingClass.library); | |
| 1053 List<AstConstant> compiledArguments = evaluateArgumentsToConstructor( | 1052 List<AstConstant> compiledArguments = evaluateArgumentsToConstructor( |
| 1054 functionNode, selector, const Link<Node>(), targetConstructor); | 1053 functionNode, selector, const Link<Node>(), targetConstructor); |
| 1055 evaluateSuperOrRedirectSend(compiledArguments, targetConstructor); | 1054 evaluateSuperOrRedirectSend(compiledArguments, targetConstructor); |
| 1056 } | 1055 } |
| 1057 } | 1056 } |
| 1058 } | 1057 } |
| 1059 } | 1058 } |
| 1060 | 1059 |
| 1061 /** | 1060 /** |
| 1062 * Simulates the execution of the [constructor] with the given | 1061 * Simulates the execution of the [constructor] with the given |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1118 ConstantValue get value => expression.value; | 1117 ConstantValue get value => expression.value; |
| 1119 | 1118 |
| 1120 String toString() => expression.toString(); | 1119 String toString() => expression.toString(); |
| 1121 } | 1120 } |
| 1122 | 1121 |
| 1123 /// A synthetic constant used to recover from errors. | 1122 /// A synthetic constant used to recover from errors. |
| 1124 class ErroneousAstConstant extends AstConstant { | 1123 class ErroneousAstConstant extends AstConstant { |
| 1125 ErroneousAstConstant(Element element, Node node) | 1124 ErroneousAstConstant(Element element, Node node) |
| 1126 : super(element, node, new ErroneousConstantExpression()); | 1125 : super(element, node, new ErroneousConstantExpression()); |
| 1127 } | 1126 } |
| OLD | NEW |