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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 } | 212 } |
213 | 213 |
214 DartBackend(Compiler compiler, List<String> strips) | 214 DartBackend(Compiler compiler, List<String> strips) |
215 : tasks = <CompilerTask>[], | 215 : tasks = <CompilerTask>[], |
216 forceStripTypes = strips.indexOf('types') != -1, | 216 forceStripTypes = strips.indexOf('types') != -1, |
217 stripAsserts = strips.indexOf('asserts') != -1, | 217 stripAsserts = strips.indexOf('asserts') != -1, |
218 super(compiler); | 218 super(compiler); |
219 | 219 |
220 void addBackendRtiDependencies(World world) {} | 220 void addBackendRtiDependencies(World world) {} |
221 | 221 |
222 void enqueueHelpers(ResolutionEnqueuer world) { | 222 void enqueueHelpers(ResolutionEnqueuer world, TreeElements elements) { |
223 // Right now resolver doesn't always resolve interfaces needed | 223 // Right now resolver doesn't always resolve interfaces needed |
224 // for literals, so force them. TODO(antonm): fix in the resolver. | 224 // for literals, so force them. TODO(antonm): fix in the resolver. |
225 final LITERAL_TYPE_NAMES = const [ | 225 final LITERAL_TYPE_NAMES = const [ |
226 'Map', 'List', 'num', 'int', 'double', 'bool' | 226 'Map', 'List', 'num', 'int', 'double', 'bool' |
227 ]; | 227 ]; |
228 final coreLibrary = compiler.coreLibrary; | 228 final coreLibrary = compiler.coreLibrary; |
229 for (final name in LITERAL_TYPE_NAMES) { | 229 for (final name in LITERAL_TYPE_NAMES) { |
230 ClassElement classElement = coreLibrary.findLocal(new SourceString(name)); | 230 ClassElement classElement = coreLibrary.findLocal(new SourceString(name)); |
231 classElement.ensureResolved(compiler); | 231 classElement.ensureResolved(compiler); |
232 } | 232 } |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 } | 585 } |
586 | 586 |
587 compareElements(e0, e1) { | 587 compareElements(e0, e1) { |
588 int result = compareBy((e) => e.getLibrary().canonicalUri.toString())(e0, e1); | 588 int result = compareBy((e) => e.getLibrary().canonicalUri.toString())(e0, e1); |
589 if (result != 0) return result; | 589 if (result != 0) return result; |
590 return compareBy((e) => e.position().charOffset)(e0, e1); | 590 return compareBy((e) => e.position().charOffset)(e0, e1); |
591 } | 591 } |
592 | 592 |
593 List<Element> sortElements(Iterable<Element> elements) => | 593 List<Element> sortElements(Iterable<Element> elements) => |
594 sorted(elements, compareElements); | 594 sorted(elements, compareElements); |
OLD | NEW |