| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 /// [ConstantCompilerTask] for compilation of constants for the JavaScript | 7 /// [ConstantCompilerTask] for compilation of constants for the JavaScript |
| 8 /// backend. | 8 /// backend. |
| 9 /// | 9 /// |
| 10 /// Since this task needs to distinguish between frontend and backend constants | 10 /// Since this task needs to distinguish between frontend and backend constants |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 const ForgetConstantElementVisitor().visit(element, this); | 242 const ForgetConstantElementVisitor().visit(element, this); |
| 243 if (element is AstElement && element.hasNode) { | 243 if (element is AstElement && element.hasNode) { |
| 244 element.node.accept(new ForgetConstantNodeVisitor(this)); | 244 element.node.accept(new ForgetConstantNodeVisitor(this)); |
| 245 } | 245 } |
| 246 } | 246 } |
| 247 | 247 |
| 248 @override | 248 @override |
| 249 ConstantValue getConstantValue(ConstantExpression expression) { | 249 ConstantValue getConstantValue(ConstantExpression expression) { |
| 250 assert(invariant(CURRENT_ELEMENT_SPANNABLE, expression != null, | 250 assert(invariant(CURRENT_ELEMENT_SPANNABLE, expression != null, |
| 251 message: "ConstantExpression is null in getConstantValue.")); | 251 message: "ConstantExpression is null in getConstantValue.")); |
| 252 evaluate(expression); | 252 // TODO(johhniwinther): ensure expressions have been evaluated at this |
| 253 // point. This can't be enabled today due to dartbug.com/26406. |
| 254 |
| 253 ConstantValue value = super.getConstantValue(expression); | 255 ConstantValue value = super.getConstantValue(expression); |
| 254 if (value == null && | 256 if (value == null && |
| 255 expression != null && | 257 expression != null && |
| 256 expression.kind == ConstantExpressionKind.ERRONEOUS) { | 258 expression.kind == ConstantExpressionKind.ERRONEOUS) { |
| 257 // TODO(johnniwinther): When the Dart constant system sees a constant | 259 // TODO(johnniwinther): When the Dart constant system sees a constant |
| 258 // expression as erroneous but the JavaScript constant system finds it ok | 260 // expression as erroneous but the JavaScript constant system finds it ok |
| 259 // we have store a constant value for the erroneous constant expression. | 261 // we have store a constant value for the erroneous constant expression. |
| 260 // Ensure the computed constant expressions are always the same; that only | 262 // Ensure the computed constant expressions are always the same; that only |
| 261 // the constant values may be different. | 263 // the constant values may be different. |
| 262 value = new NullConstantValue(); | 264 value = new NullConstantValue(); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 // TODO(ahe): This doesn't belong here. Rename this class and generalize. | 301 // TODO(ahe): This doesn't belong here. Rename this class and generalize. |
| 300 var closureClassMap = constants | 302 var closureClassMap = constants |
| 301 .compiler.closureToClassMapper.closureMappingCache | 303 .compiler.closureToClassMapper.closureMappingCache |
| 302 .remove(node); | 304 .remove(node); |
| 303 if (closureClassMap != null) { | 305 if (closureClassMap != null) { |
| 304 closureClassMap | 306 closureClassMap |
| 305 .removeMyselfFrom(constants.compiler.enqueuer.codegen.universe); | 307 .removeMyselfFrom(constants.compiler.enqueuer.codegen.universe); |
| 306 } | 308 } |
| 307 } | 309 } |
| 308 } | 310 } |
| OLD | NEW |