| 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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 'Map', 'List', 'num', 'int', 'double', 'bool' | 203 'Map', 'List', 'num', 'int', 'double', 'bool' |
| 204 ]; | 204 ]; |
| 205 final coreLibrary = compiler.coreLibrary; | 205 final coreLibrary = compiler.coreLibrary; |
| 206 for (final name in LITERAL_TYPE_NAMES) { | 206 for (final name in LITERAL_TYPE_NAMES) { |
| 207 ClassElement classElement = coreLibrary.findLocal(new SourceString(name)); | 207 ClassElement classElement = coreLibrary.findLocal(new SourceString(name)); |
| 208 classElement.ensureResolved(compiler); | 208 classElement.ensureResolved(compiler); |
| 209 } | 209 } |
| 210 } | 210 } |
| 211 void codegen(WorkItem work) { } | 211 void codegen(WorkItem work) { } |
| 212 void processNativeClasses(Enqueuer world, | 212 void processNativeClasses(Enqueuer world, |
| 213 Collection<LibraryElement> libraries) { } | 213 Iterable<LibraryElement> libraries) { } |
| 214 | 214 |
| 215 bool isUserLibrary(LibraryElement lib) { | 215 bool isUserLibrary(LibraryElement lib) { |
| 216 final INTERNAL_HELPERS = [ | 216 final INTERNAL_HELPERS = [ |
| 217 compiler.jsHelperLibrary, | 217 compiler.jsHelperLibrary, |
| 218 compiler.interceptorsLibrary, | 218 compiler.interceptorsLibrary, |
| 219 ]; | 219 ]; |
| 220 return INTERNAL_HELPERS.indexOf(lib) == -1 && !lib.isPlatformLibrary; | 220 return INTERNAL_HELPERS.indexOf(lib) == -1 && !lib.isPlatformLibrary; |
| 221 } | 221 } |
| 222 | 222 |
| 223 void assembleProgram() { | 223 void assembleProgram() { |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 result.sort(comparison); | 554 result.sort(comparison); |
| 555 return result; | 555 return result; |
| 556 } | 556 } |
| 557 | 557 |
| 558 compareElements(e0, e1) { | 558 compareElements(e0, e1) { |
| 559 int result = compareBy((e) => e.getLibrary().uri.toString())(e0, e1); | 559 int result = compareBy((e) => e.getLibrary().uri.toString())(e0, e1); |
| 560 if (result != 0) return result; | 560 if (result != 0) return result; |
| 561 return compareBy((e) => e.position().charOffset)(e0, e1); | 561 return compareBy((e) => e.position().charOffset)(e0, e1); |
| 562 } | 562 } |
| 563 | 563 |
| 564 List<Element> sortElements(Collection<Element> elements) => | 564 List<Element> sortElements(Iterable<Element> elements) => |
| 565 sorted(elements, compareElements); | 565 sorted(elements, compareElements); |
| OLD | NEW |