| 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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 } | 214 } |
| 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 classNeedsRti(ClassElement cls) => false; |
| 225 bool methodNeedsRti(FunctionElement function) => 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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 } | 591 } |
| 591 | 592 |
| 592 compareElements(e0, e1) { | 593 compareElements(e0, e1) { |
| 593 int result = compareBy((e) => e.getLibrary().canonicalUri.toString())(e0, e1); | 594 int result = compareBy((e) => e.getLibrary().canonicalUri.toString())(e0, e1); |
| 594 if (result != 0) return result; | 595 if (result != 0) return result; |
| 595 return compareBy((e) => e.position().charOffset)(e0, e1); | 596 return compareBy((e) => e.position().charOffset)(e0, e1); |
| 596 } | 597 } |
| 597 | 598 |
| 598 List<Element> sortElements(Iterable<Element> elements) => | 599 List<Element> sortElements(Iterable<Element> elements) => |
| 599 sorted(elements, compareElements); | 600 sorted(elements, compareElements); |
| OLD | NEW |