| 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 js_backend; | 5 part of js_backend; |
| 6 | 6 |
| 7 const VERBOSE_OPTIMIZER_HINTS = false; | 7 const VERBOSE_OPTIMIZER_HINTS = false; |
| 8 | 8 |
| 9 const bool USE_CPS_IR = const bool.fromEnvironment("USE_CPS_IR"); | 9 const bool USE_CPS_IR = const bool.fromEnvironment("USE_CPS_IR"); |
| 10 | 10 |
| (...skipping 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1193 registerBackendUse(cls); | 1193 registerBackendUse(cls); |
| 1194 helpersUsed.add(cls.declaration); | 1194 helpersUsed.add(cls.declaration); |
| 1195 if (cls.declaration != cls.implementation) { | 1195 if (cls.declaration != cls.implementation) { |
| 1196 helpersUsed.add(cls.implementation); | 1196 helpersUsed.add(cls.implementation); |
| 1197 } | 1197 } |
| 1198 enqueuer.registerInstantiatedClass(cls, registry); | 1198 enqueuer.registerInstantiatedClass(cls, registry); |
| 1199 } | 1199 } |
| 1200 | 1200 |
| 1201 void codegen(CodegenWorkItem work) { | 1201 void codegen(CodegenWorkItem work) { |
| 1202 Element element = work.element; | 1202 Element element = work.element; |
| 1203 if (compiler.elementHasCompileTimeError(element)) { |
| 1204 generatedCode[element] = jsAst.js( |
| 1205 "function () { throw new Error('Compile time error in $element') }"); |
| 1206 return; |
| 1207 } |
| 1203 var kind = element.kind; | 1208 var kind = element.kind; |
| 1204 if (kind == ElementKind.TYPEDEF) return; | 1209 if (kind == ElementKind.TYPEDEF) return; |
| 1205 if (element.isConstructor && element.enclosingClass == jsNullClass) { | 1210 if (element.isConstructor && element.enclosingClass == jsNullClass) { |
| 1206 // Work around a problem compiling JSNull's constructor. | 1211 // Work around a problem compiling JSNull's constructor. |
| 1207 return; | 1212 return; |
| 1208 } | 1213 } |
| 1209 if (kind.category == ElementCategory.VARIABLE) { | 1214 if (kind.category == ElementCategory.VARIABLE) { |
| 1210 ConstantExpression initialValue = | 1215 ConstantExpression initialValue = |
| 1211 constants.getConstantForVariable(element); | 1216 constants.getConstantForVariable(element); |
| 1212 if (initialValue != null) { | 1217 if (initialValue != null) { |
| (...skipping 1297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2510 } | 2515 } |
| 2511 } | 2516 } |
| 2512 | 2517 |
| 2513 /// Records that [constant] is used by the element behind [registry]. | 2518 /// Records that [constant] is used by the element behind [registry]. |
| 2514 class Dependency { | 2519 class Dependency { |
| 2515 final ConstantValue constant; | 2520 final ConstantValue constant; |
| 2516 final Element annotatedElement; | 2521 final Element annotatedElement; |
| 2517 | 2522 |
| 2518 const Dependency(this.constant, this.annotatedElement); | 2523 const Dependency(this.constant, this.annotatedElement); |
| 2519 } | 2524 } |
| OLD | NEW |