| 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 import '../compile_time_constants.dart'; | 5 import '../compile_time_constants.dart'; |
| 6 import '../compiler.dart' show Compiler; | 6 import '../compiler.dart' show Compiler; |
| 7 import '../constants/constant_system.dart'; | 7 import '../constants/constant_system.dart'; |
| 8 import '../constants/expressions.dart'; | 8 import '../constants/expressions.dart'; |
| 9 import '../constants/values.dart'; | 9 import '../constants/values.dart'; |
| 10 import '../elements/elements.dart'; | 10 import '../elements/elements.dart'; |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 } | 227 } |
| 228 | 228 |
| 229 @override | 229 @override |
| 230 ConstantExpression compileMetadata( | 230 ConstantExpression compileMetadata( |
| 231 MetadataAnnotation metadata, Node node, TreeElements elements) { | 231 MetadataAnnotation metadata, Node node, TreeElements elements) { |
| 232 ConstantExpression constant = | 232 ConstantExpression constant = |
| 233 super.compileMetadata(metadata, node, elements); | 233 super.compileMetadata(metadata, node, elements); |
| 234 metadataConstantMap[metadata] = constant; | 234 metadataConstantMap[metadata] = constant; |
| 235 return constant; | 235 return constant; |
| 236 } | 236 } |
| 237 | |
| 238 void forgetElement(Element element) { | |
| 239 super.forgetElement(element); | |
| 240 const ForgetConstantElementVisitor().visit(element, this); | |
| 241 if (element is AstElement && element.hasNode) { | |
| 242 element.node.accept(new ForgetConstantNodeVisitor(this)); | |
| 243 } | |
| 244 } | |
| 245 } | 237 } |
| 246 | 238 |
| 247 class ForgetConstantElementVisitor | 239 class ForgetConstantElementVisitor |
| 248 extends BaseElementVisitor<dynamic, JavaScriptConstantCompiler> { | 240 extends BaseElementVisitor<dynamic, JavaScriptConstantCompiler> { |
| 249 const ForgetConstantElementVisitor(); | 241 const ForgetConstantElementVisitor(); |
| 250 | 242 |
| 251 void visitElement(Element e, JavaScriptConstantCompiler constants) { | 243 void visitElement(Element e, JavaScriptConstantCompiler constants) { |
| 252 for (MetadataAnnotation data in e.implementation.metadata) { | 244 for (MetadataAnnotation data in e.implementation.metadata) { |
| 253 constants.metadataConstantMap.remove(data); | 245 constants.metadataConstantMap.remove(data); |
| 254 if (data.hasNode) { | 246 if (data.hasNode) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 269 class ForgetConstantNodeVisitor extends Visitor { | 261 class ForgetConstantNodeVisitor extends Visitor { |
| 270 final JavaScriptConstantCompiler constants; | 262 final JavaScriptConstantCompiler constants; |
| 271 | 263 |
| 272 ForgetConstantNodeVisitor(this.constants); | 264 ForgetConstantNodeVisitor(this.constants); |
| 273 | 265 |
| 274 void visitNode(Node node) { | 266 void visitNode(Node node) { |
| 275 node.visitChildren(this); | 267 node.visitChildren(this); |
| 276 constants.nodeConstantMap.remove(node); | 268 constants.nodeConstantMap.remove(node); |
| 277 } | 269 } |
| 278 } | 270 } |
| OLD | NEW |