| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 final LITERAL_TYPE_NAMES = const [ | 124 final LITERAL_TYPE_NAMES = const [ |
| 125 'Map', 'List', 'num', 'int', 'double', 'bool' | 125 'Map', 'List', 'num', 'int', 'double', 'bool' |
| 126 ]; | 126 ]; |
| 127 final coreLibrary = compiler.coreLibrary; | 127 final coreLibrary = compiler.coreLibrary; |
| 128 for (final name in LITERAL_TYPE_NAMES) { | 128 for (final name in LITERAL_TYPE_NAMES) { |
| 129 ClassElement classElement = coreLibrary.findLocal(name); | 129 ClassElement classElement = coreLibrary.findLocal(name); |
| 130 classElement.ensureResolved(compiler); | 130 classElement.ensureResolved(compiler); |
| 131 } | 131 } |
| 132 // Enqueue the methods that the VM might invoke on user objects because | 132 // Enqueue the methods that the VM might invoke on user objects because |
| 133 // we don't trust the resolution to always get these included. | 133 // we don't trust the resolution to always get these included. |
| 134 world.registerInvocation( | 134 world.registerInvocation(new UniverseSelector( |
| 135 new UniverseSelector(new Selector.call("toString", null, 0), null)); | 135 new Selector.call(const PublicName("toString"), 0), null)); |
| 136 world.registerInvokedGetter( | 136 world.registerInvokedGetter(new UniverseSelector( |
| 137 new UniverseSelector(new Selector.getter("hashCode", null), null)); | 137 new Selector.getter(const PublicName("hashCode")), null)); |
| 138 world.registerInvocation( | 138 world.registerInvocation( |
| 139 new UniverseSelector(new Selector.binaryOperator("=="), null)); | 139 new UniverseSelector(new Selector.binaryOperator("=="), null)); |
| 140 world.registerInvocation( | 140 world.registerInvocation(new UniverseSelector( |
| 141 new UniverseSelector(new Selector.call("compareTo", null, 1), null)); | 141 new Selector.call(const PublicName("compareTo"), 1), null)); |
| 142 } | 142 } |
| 143 | 143 |
| 144 WorldImpact codegen(CodegenWorkItem work) => const WorldImpact(); | 144 WorldImpact codegen(CodegenWorkItem work) => const WorldImpact(); |
| 145 | 145 |
| 146 /** | 146 /** |
| 147 * Tells whether we should output given element. Corelib classes like | 147 * Tells whether we should output given element. Corelib classes like |
| 148 * Object should not be in the resulting code. | 148 * Object should not be in the resulting code. |
| 149 */ | 149 */ |
| 150 @override | 150 @override |
| 151 bool shouldOutput(Element element) { | 151 bool shouldOutput(Element element) { |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 } | 517 } |
| 518 | 518 |
| 519 // TODO(johnniwinther): Remove this when values are computed from the | 519 // TODO(johnniwinther): Remove this when values are computed from the |
| 520 // expressions. | 520 // expressions. |
| 521 @override | 521 @override |
| 522 void copyConstantValues(DartConstantTask task) { | 522 void copyConstantValues(DartConstantTask task) { |
| 523 constantCompiler.constantValueMap.addAll( | 523 constantCompiler.constantValueMap.addAll( |
| 524 task.constantCompiler.constantValueMap); | 524 task.constantCompiler.constantValueMap); |
| 525 } | 525 } |
| 526 } | 526 } |
| OLD | NEW |