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 class Constant implements Hashable { | 5 class Constant implements Hashable { |
6 const Constant(); | 6 const Constant(); |
7 | 7 |
8 bool isNull() => false; | 8 bool isNull() => false; |
9 bool isBool() => false; | 9 bool isBool() => false; |
10 bool isTrue() => false; | 10 bool isTrue() => false; |
(...skipping 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1123 } | 1123 } |
1124 } | 1124 } |
1125 | 1125 |
1126 if (!foundSuperOrRedirect) { | 1126 if (!foundSuperOrRedirect) { |
1127 // No super initializer found. Try to find the default constructor if | 1127 // No super initializer found. Try to find the default constructor if |
1128 // the class is not Object. | 1128 // the class is not Object. |
1129 ClassElement enclosingClass = constructor.getEnclosingClass(); | 1129 ClassElement enclosingClass = constructor.getEnclosingClass(); |
1130 ClassElement superClass = enclosingClass.superclass; | 1130 ClassElement superClass = enclosingClass.superclass; |
1131 if (enclosingClass != compiler.objectClass) { | 1131 if (enclosingClass != compiler.objectClass) { |
1132 assert(superClass !== null); | 1132 assert(superClass !== null); |
1133 assert(superClass.isResolved); | 1133 assert(superClass.resolutionState == ClassElement.STATE_DONE); |
1134 FunctionElement targetConstructor = | 1134 FunctionElement targetConstructor = |
1135 superClass.lookupConstructor(superClass.name); | 1135 superClass.lookupConstructor(superClass.name); |
1136 if (targetConstructor === null) { | 1136 if (targetConstructor === null) { |
1137 compiler.internalError("no default constructor available", | 1137 compiler.internalError("no default constructor available", |
1138 node: functionNode); | 1138 node: functionNode); |
1139 } | 1139 } |
1140 | 1140 |
1141 evaluateSuperOrRedirectSend(Selector.INVOCATION_0, | 1141 evaluateSuperOrRedirectSend(Selector.INVOCATION_0, |
1142 const EmptyLink<Node>(), | 1142 const EmptyLink<Node>(), |
1143 targetConstructor); | 1143 targetConstructor); |
(...skipping 22 matching lines...) Expand all Loading... |
1166 Constant fieldValue = fieldValues[field]; | 1166 Constant fieldValue = fieldValues[field]; |
1167 if (fieldValue === null) { | 1167 if (fieldValue === null) { |
1168 // Use the default value. | 1168 // Use the default value. |
1169 fieldValue = compiler.compileVariable(field); | 1169 fieldValue = compiler.compileVariable(field); |
1170 } | 1170 } |
1171 jsNewArguments.add(fieldValue); | 1171 jsNewArguments.add(fieldValue); |
1172 }); | 1172 }); |
1173 return jsNewArguments; | 1173 return jsNewArguments; |
1174 } | 1174 } |
1175 } | 1175 } |
OLD | NEW |