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(new UniverseSelector( | 134 world.registerInvocation(new UniverseSelector(Selectors.toString_, null)); |
135 new Selector.call(const PublicName("toString"), 0), null)); | 135 world.registerInvokedGetter( |
136 world.registerInvokedGetter(new UniverseSelector( | 136 new UniverseSelector(Selectors.hashCode_, null)); |
137 new Selector.getter(const PublicName("hashCode")), null)); | |
138 world.registerInvocation( | 137 world.registerInvocation( |
139 new UniverseSelector(new Selector.binaryOperator("=="), null)); | 138 new UniverseSelector(new Selector.binaryOperator('=='), null)); |
140 world.registerInvocation(new UniverseSelector( | 139 world.registerInvocation( |
141 new Selector.call(const PublicName("compareTo"), 1), null)); | 140 new UniverseSelector(Selectors.compareTo, null)); |
142 } | 141 } |
143 | 142 |
144 WorldImpact codegen(CodegenWorkItem work) => const WorldImpact(); | 143 WorldImpact codegen(CodegenWorkItem work) => const WorldImpact(); |
145 | 144 |
146 /** | 145 /** |
147 * Tells whether we should output given element. Corelib classes like | 146 * Tells whether we should output given element. Corelib classes like |
148 * Object should not be in the resulting code. | 147 * Object should not be in the resulting code. |
149 */ | 148 */ |
150 @override | 149 @override |
151 bool shouldOutput(Element element) { | 150 bool shouldOutput(Element element) { |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 } | 516 } |
518 | 517 |
519 // TODO(johnniwinther): Remove this when values are computed from the | 518 // TODO(johnniwinther): Remove this when values are computed from the |
520 // expressions. | 519 // expressions. |
521 @override | 520 @override |
522 void copyConstantValues(DartConstantTask task) { | 521 void copyConstantValues(DartConstantTask task) { |
523 constantCompiler.constantValueMap.addAll( | 522 constantCompiler.constantValueMap.addAll( |
524 task.constantCompiler.constantValueMap); | 523 task.constantCompiler.constantValueMap); |
525 } | 524 } |
526 } | 525 } |
OLD | NEW |