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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 classElement.ensureResolved(compiler); | 122 classElement.ensureResolved(compiler); |
123 } | 123 } |
124 // Enqueue the methods that the VM might invoke on user objects because | 124 // Enqueue the methods that the VM might invoke on user objects because |
125 // we don't trust the resolution to always get these included. | 125 // we don't trust the resolution to always get these included. |
126 world.registerInvocation(new Selector.call("toString", null, 0)); | 126 world.registerInvocation(new Selector.call("toString", null, 0)); |
127 world.registerInvokedGetter(new Selector.getter("hashCode", null)); | 127 world.registerInvokedGetter(new Selector.getter("hashCode", null)); |
128 world.registerInvocation(new Selector.binaryOperator("==")); | 128 world.registerInvocation(new Selector.binaryOperator("==")); |
129 world.registerInvocation(new Selector.call("compareTo", null, 1)); | 129 world.registerInvocation(new Selector.call("compareTo", null, 1)); |
130 } | 130 } |
131 | 131 |
132 void codegen(CodegenWorkItem work) { } | 132 WorldImpact codegen(CodegenWorkItem work) => const WorldImpact(); |
| 133 |
133 /** | 134 /** |
134 * Tells whether we should output given element. Corelib classes like | 135 * Tells whether we should output given element. Corelib classes like |
135 * Object should not be in the resulting code. | 136 * Object should not be in the resulting code. |
136 */ | 137 */ |
137 @override | 138 @override |
138 bool shouldOutput(Element element) { | 139 bool shouldOutput(Element element) { |
139 return (!element.library.isPlatformLibrary && | 140 return (!element.library.isPlatformLibrary && |
140 !element.isSynthesized && | 141 !element.isSynthesized && |
141 element is! AbstractFieldElement) | 142 element is! AbstractFieldElement) |
142 || mirrorRenamer.isMirrorHelperLibrary(element.library); | 143 || mirrorRenamer.isMirrorHelperLibrary(element.library); |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 class _ElementAstCreationContext implements ElementAstCreationContext { | 474 class _ElementAstCreationContext implements ElementAstCreationContext { |
474 final Compiler compiler; | 475 final Compiler compiler; |
475 final ConstantSystem constantSystem; | 476 final ConstantSystem constantSystem; |
476 | 477 |
477 _ElementAstCreationContext(this.compiler, this.constantSystem); | 478 _ElementAstCreationContext(this.compiler, this.constantSystem); |
478 | 479 |
479 DartTypes get dartTypes => compiler.types; | 480 DartTypes get dartTypes => compiler.types; |
480 | 481 |
481 InternalErrorFunction get internalError => compiler.internalError; | 482 InternalErrorFunction get internalError => compiler.internalError; |
482 } | 483 } |
OLD | NEW |