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