| 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 dart_backend; | 5 part of dart_backend; |
| 6 | 6 |
| 7 // TODO(ahe): This class is simply wrong. This backend should use | 7 // TODO(ahe): This class is simply wrong. This backend should use |
| 8 // elements when it can, not AST nodes. Perhaps a [Map<Element, | 8 // elements when it can, not AST nodes. Perhaps a [Map<Element, |
| 9 // TreeElements>] is what is needed. | 9 // TreeElements>] is what is needed. |
| 10 class ElementAst { | 10 class ElementAst { |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 */ | 143 */ |
| 144 @override | 144 @override |
| 145 bool shouldOutput(Element element) { | 145 bool shouldOutput(Element element) { |
| 146 return (!element.library.isPlatformLibrary && | 146 return (!element.library.isPlatformLibrary && |
| 147 !element.isSynthesized && | 147 !element.isSynthesized && |
| 148 element is! AbstractFieldElement) | 148 element is! AbstractFieldElement) |
| 149 || mirrorRenamer.isMirrorHelperLibrary(element.library); | 149 || mirrorRenamer.isMirrorHelperLibrary(element.library); |
| 150 } | 150 } |
| 151 | 151 |
| 152 int assembleProgram() { | 152 int assembleProgram() { |
| 153 ElementAstCreationContext context = | |
| 154 new _ElementAstCreationContext(compiler, constantSystem); | |
| 155 | |
| 156 ElementAst computeElementAst(AstElement element) { | 153 ElementAst computeElementAst(AstElement element) { |
| 157 return new ElementAst(element.resolvedAst.node, | 154 return new ElementAst(element.resolvedAst.node, |
| 158 element.resolvedAst.elements); | 155 element.resolvedAst.elements); |
| 159 } | 156 } |
| 160 | 157 |
| 161 // TODO(johnniwinther): Remove the need for this method. | 158 // TODO(johnniwinther): Remove the need for this method. |
| 162 void postProcessElementAst( | 159 void postProcessElementAst( |
| 163 AstElement element, ElementAst elementAst, | 160 AstElement element, ElementAst elementAst, |
| 164 newTypedefElementCallback, | 161 newTypedefElementCallback, |
| 165 newClassElementCallback) { | 162 newClassElementCallback) { |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 } | 503 } |
| 507 | 504 |
| 508 // TODO(johnniwinther): Remove this when values are computed from the | 505 // TODO(johnniwinther): Remove this when values are computed from the |
| 509 // expressions. | 506 // expressions. |
| 510 @override | 507 @override |
| 511 void copyConstantValues(DartConstantTask task) { | 508 void copyConstantValues(DartConstantTask task) { |
| 512 constantCompiler.constantValueMap.addAll( | 509 constantCompiler.constantValueMap.addAll( |
| 513 task.constantCompiler.constantValueMap); | 510 task.constantCompiler.constantValueMap); |
| 514 } | 511 } |
| 515 } | 512 } |
| 516 | |
| 517 abstract class ElementAstCreationContext { | |
| 518 DartTypes get dartTypes; | |
| 519 ConstantSystem get constantSystem; | |
| 520 InternalErrorFunction get internalError; | |
| 521 } | |
| 522 | |
| 523 class _ElementAstCreationContext implements ElementAstCreationContext { | |
| 524 final Compiler compiler; | |
| 525 final ConstantSystem constantSystem; | |
| 526 | |
| 527 _ElementAstCreationContext(this.compiler, this.constantSystem); | |
| 528 | |
| 529 DartTypes get dartTypes => compiler.types; | |
| 530 | |
| 531 InternalErrorFunction get internalError => compiler.internalError; | |
| 532 } | |
| OLD | NEW |