| 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 class DartBackend extends Backend { | 5 class DartBackend extends Backend { |
| 6 final List<CompilerTask> tasks; | 6 final List<CompilerTask> tasks; |
| 7 final UnparseValidator unparseValidator; | |
| 8 | 7 |
| 9 Map<Element, TreeElements> get resolvedElements() => | 8 Map<Element, TreeElements> get resolvedElements() => |
| 10 compiler.enqueuer.resolution.resolvedElements; | 9 compiler.enqueuer.resolution.resolvedElements; |
| 11 | 10 |
| 12 DartBackend(Compiler compiler, [bool validateUnparse = false]) | 11 DartBackend(Compiler compiler, [bool validateUnparse = false]) |
| 13 : tasks = <CompilerTask>[], | 12 : tasks = <CompilerTask>[], |
| 14 unparseValidator = new UnparseValidator(compiler, validateUnparse), | 13 super(compiler); |
| 15 super(compiler) { | |
| 16 tasks.add(unparseValidator); | |
| 17 } | |
| 18 | 14 |
| 19 void enqueueHelpers(Enqueuer world) { | 15 void enqueueHelpers(Enqueuer world) { } |
| 20 // TODO(antonm): Implement this method, if needed. | |
| 21 } | |
| 22 | |
| 23 void codegen(WorkItem work) { } | 16 void codegen(WorkItem work) { } |
| 24 | |
| 25 void processNativeClasses(Enqueuer world, | 17 void processNativeClasses(Enqueuer world, |
| 26 Collection<LibraryElement> libraries) { | 18 Collection<LibraryElement> libraries) { } |
| 27 } | |
| 28 | 19 |
| 29 void assembleProgram() { | 20 void assembleProgram() { |
| 30 resolvedElements.forEach((element, treeElements) { | |
| 31 unparseValidator.check(element); | |
| 32 }); | |
| 33 | |
| 34 /** | 21 /** |
| 35 * Tells whether we should output given element. Corelib classes like | 22 * Tells whether we should output given element. Corelib classes like |
| 36 * Object should not be in the resulting code. | 23 * Object should not be in the resulting code. |
| 37 */ | 24 */ |
| 38 final LIBS_TO_IGNORE = [ | 25 final LIBS_TO_IGNORE = [ |
| 39 compiler.jsHelperLibrary, | 26 compiler.jsHelperLibrary, |
| 40 compiler.interceptorsLibrary, | 27 compiler.interceptorsLibrary, |
| 41 ]; | 28 ]; |
| 42 bool shouldOutput(Element element) => | 29 bool shouldOutput(Element element) => |
| 43 element.kind !== ElementKind.VOID && | 30 element.kind !== ElementKind.VOID && |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 if (typeElement.isClass()) newClassElementCallback(typeElement); | 172 if (typeElement.isClass()) newClassElementCallback(typeElement); |
| 186 typeAnnotation.visitChildren(this); | 173 typeAnnotation.visitChildren(this); |
| 187 } | 174 } |
| 188 | 175 |
| 189 void collect() { | 176 void collect() { |
| 190 compiler.withCurrentElement(rootElement, () { | 177 compiler.withCurrentElement(rootElement, () { |
| 191 rootElement.parseNode(compiler).accept(this); | 178 rootElement.parseNode(compiler).accept(this); |
| 192 }); | 179 }); |
| 193 } | 180 } |
| 194 } | 181 } |
| OLD | NEW |