| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 final LITERAL_TYPE_NAMES = const [ | 118 final LITERAL_TYPE_NAMES = const [ |
| 119 'Map', 'List', 'num', 'int', 'double', 'bool' | 119 'Map', 'List', 'num', 'int', 'double', 'bool' |
| 120 ]; | 120 ]; |
| 121 final coreLibrary = compiler.coreLibrary; | 121 final coreLibrary = compiler.coreLibrary; |
| 122 for (final name in LITERAL_TYPE_NAMES) { | 122 for (final name in LITERAL_TYPE_NAMES) { |
| 123 ClassElement classElement = coreLibrary.findLocal(name); | 123 ClassElement classElement = coreLibrary.findLocal(name); |
| 124 classElement.ensureResolved(compiler); | 124 classElement.ensureResolved(compiler); |
| 125 } | 125 } |
| 126 // Enqueue the methods that the VM might invoke on user objects because | 126 // Enqueue the methods that the VM might invoke on user objects because |
| 127 // we don't trust the resolution to always get these included. | 127 // we don't trust the resolution to always get these included. |
| 128 world.registerInvocation( | 128 world.registerInvocation(null, |
| 129 new Selector.call("toString", null, 0)); | 129 new Selector.call("toString", null, 0)); |
| 130 world.registerInvokedGetter( | 130 world.registerInvokedGetter(null, |
| 131 new Selector.getter("hashCode", null)); | 131 new Selector.getter("hashCode", null)); |
| 132 world.registerInvocation( | 132 world.registerInvocation(null, |
| 133 new Selector.binaryOperator("==")); | 133 new Selector.binaryOperator("==")); |
| 134 world.registerInvocation( | 134 world.registerInvocation(null, |
| 135 new Selector.call("compareTo", null, 1)); | 135 new Selector.call("compareTo", null, 1)); |
| 136 } | 136 } |
| 137 | 137 |
| 138 void codegen(CodegenWorkItem work) { } | 138 void codegen(CodegenWorkItem work) { } |
| 139 | 139 |
| 140 bool isUserLibrary(LibraryElement lib) { | 140 bool isUserLibrary(LibraryElement lib) { |
| 141 final INTERNAL_HELPERS = [ | 141 final INTERNAL_HELPERS = [ |
| 142 compiler.jsHelperLibrary, | 142 compiler.jsHelperLibrary, |
| 143 compiler.interceptorsLibrary, | 143 compiler.interceptorsLibrary, |
| 144 ]; | 144 ]; |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 } | 634 } |
| 635 | 635 |
| 636 Constant compileMetadata(MetadataAnnotation metadata, | 636 Constant compileMetadata(MetadataAnnotation metadata, |
| 637 Node node, | 637 Node node, |
| 638 TreeElements elements) { | 638 TreeElements elements) { |
| 639 return measure(() { | 639 return measure(() { |
| 640 return constantCompiler.compileMetadata(metadata, node, elements); | 640 return constantCompiler.compileMetadata(metadata, node, elements); |
| 641 }); | 641 }); |
| 642 } | 642 } |
| 643 } | 643 } |
| OLD | NEW |