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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 } | 189 } |
190 return true; | 190 return true; |
191 } | 191 } |
192 | 192 |
193 DartBackend(Compiler compiler, List<String> strips) | 193 DartBackend(Compiler compiler, List<String> strips) |
194 : tasks = <CompilerTask>[], | 194 : tasks = <CompilerTask>[], |
195 forceStripTypes = strips.indexOf('types') != -1, | 195 forceStripTypes = strips.indexOf('types') != -1, |
196 stripAsserts = strips.indexOf('asserts') != -1, | 196 stripAsserts = strips.indexOf('asserts') != -1, |
197 super(compiler); | 197 super(compiler); |
198 | 198 |
199 Element getInterceptor(Selector selector) => null; | |
200 | |
201 void enqueueHelpers(Enqueuer world) { | 199 void enqueueHelpers(Enqueuer world) { |
202 // Right now resolver doesn't always resolve interfaces needed | 200 // Right now resolver doesn't always resolve interfaces needed |
203 // for literals, so force them. TODO(antonm): fix in the resolver. | 201 // for literals, so force them. TODO(antonm): fix in the resolver. |
204 final LITERAL_TYPE_NAMES = const [ | 202 final LITERAL_TYPE_NAMES = const [ |
205 'Map', 'List', 'num', 'int', 'double', 'bool' | 203 'Map', 'List', 'num', 'int', 'double', 'bool' |
206 ]; | 204 ]; |
207 final coreLibrary = compiler.coreLibrary; | 205 final coreLibrary = compiler.coreLibrary; |
208 for (final name in LITERAL_TYPE_NAMES) { | 206 for (final name in LITERAL_TYPE_NAMES) { |
209 ClassElement classElement = coreLibrary.findLocal(new SourceString(name)); | 207 ClassElement classElement = coreLibrary.findLocal(new SourceString(name)); |
210 classElement.ensureResolved(compiler); | 208 classElement.ensureResolved(compiler); |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 } | 553 } |
556 | 554 |
557 compareElements(e0, e1) { | 555 compareElements(e0, e1) { |
558 int result = compareBy((e) => e.getLibrary().uri.toString())(e0, e1); | 556 int result = compareBy((e) => e.getLibrary().uri.toString())(e0, e1); |
559 if (result != 0) return result; | 557 if (result != 0) return result; |
560 return compareBy((e) => e.position().charOffset)(e0, e1); | 558 return compareBy((e) => e.position().charOffset)(e0, e1); |
561 } | 559 } |
562 | 560 |
563 List<Element> sortElements(Collection<Element> elements) => | 561 List<Element> sortElements(Collection<Element> elements) => |
564 sorted(elements, compareElements); | 562 sorted(elements, compareElements); |
OLD | NEW |