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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 | 193 |
194 ConstantExpression compileNode(Node node, TreeElements elements, | 194 ConstantExpression compileNode(Node node, TreeElements elements, |
195 {bool enforceConst: true}) { | 195 {bool enforceConst: true}) { |
196 return compileNodeWithDefinitions(node, elements, isConst: enforceConst); | 196 return compileNodeWithDefinitions(node, elements, isConst: enforceConst); |
197 } | 197 } |
198 | 198 |
199 ConstantExpression compileNodeWithDefinitions(Node node, | 199 ConstantExpression compileNodeWithDefinitions(Node node, |
200 TreeElements definitions, | 200 TreeElements definitions, |
201 {bool isConst: true}) { | 201 {bool isConst: true}) { |
202 ConstantExpression constant = nodeConstantMap[node]; | 202 ConstantExpression constant = nodeConstantMap[node]; |
203 if (constant != null) { | 203 if (constant != null && getConstantValue(constant) != null) { |
204 return constant; | 204 return constant; |
205 } | 205 } |
206 constant = | 206 constant = |
207 super.compileNodeWithDefinitions(node, definitions, isConst: isConst); | 207 super.compileNodeWithDefinitions(node, definitions, isConst: isConst); |
208 if (constant != null) { | 208 if (constant != null) { |
209 nodeConstantMap[node] = constant; | 209 nodeConstantMap[node] = constant; |
210 } | 210 } |
211 return constant; | 211 return constant; |
212 } | 212 } |
213 | 213 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 // TODO(ahe): This doesn't belong here. Rename this class and generalize. | 280 // TODO(ahe): This doesn't belong here. Rename this class and generalize. |
281 var closureClassMap = | 281 var closureClassMap = |
282 constants.compiler.closureToClassMapper.closureMappingCache | 282 constants.compiler.closureToClassMapper.closureMappingCache |
283 .remove(node); | 283 .remove(node); |
284 if (closureClassMap != null) { | 284 if (closureClassMap != null) { |
285 closureClassMap.removeMyselfFrom( | 285 closureClassMap.removeMyselfFrom( |
286 constants.compiler.enqueuer.codegen.universe); | 286 constants.compiler.enqueuer.codegen.universe); |
287 } | 287 } |
288 } | 288 } |
289 } | 289 } |
OLD | NEW |