| 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 ScannerTask extends CompilerTask { | 5 class ScannerTask extends CompilerTask { |
| 6 ScannerTask(Compiler compiler) : super(compiler); | 6 ScannerTask(Compiler compiler) : super(compiler); |
| 7 String get name() => 'Scanner'; | 7 String get name() => 'Scanner'; |
| 8 | 8 |
| 9 void scan(CompilationUnitElement compilationUnit) { | 9 void scan(CompilationUnitElement compilationUnit) { |
| 10 measure(() { | 10 measure(() { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 } | 31 } |
| 32 } else if (tag.isSource()) { | 32 } else if (tag.isSource()) { |
| 33 Script script = compiler.readScript(resolved, tag); | 33 Script script = compiler.readScript(resolved, tag); |
| 34 CompilationUnitElement unit = | 34 CompilationUnitElement unit = |
| 35 new CompilationUnitElement(script, library); | 35 new CompilationUnitElement(script, library); |
| 36 compiler.withCurrentElement(unit, () => scan(unit)); | 36 compiler.withCurrentElement(unit, () => scan(unit)); |
| 37 } else { | 37 } else { |
| 38 compiler.cancel("illegal script tag: ${tag.tag}", node: tag); | 38 compiler.cancel("illegal script tag: ${tag.tag}", node: tag); |
| 39 } | 39 } |
| 40 } | 40 } |
| 41 if (library !== compiler.coreLibrary) { | 41 if (compiler.coreLibrary !== null) { |
| 42 importLibrary(library, compiler.coreLibrary, null); | 42 importLibrary(library, compiler.coreLibrary, null); |
| 43 } | 43 } |
| 44 } | 44 } |
| 45 | 45 |
| 46 void scanElements(CompilationUnitElement compilationUnit) { | 46 void scanElements(CompilationUnitElement compilationUnit) { |
| 47 compiler.log("scanning $compilationUnit"); | 47 compiler.log("scanning $compilationUnit"); |
| 48 Script script = compilationUnit.script; | 48 Script script = compilationUnit.script; |
| 49 Token tokens; | 49 Token tokens; |
| 50 try { | 50 try { |
| 51 tokens = new StringScanner(script.text).tokenize(); | 51 tokens = new StringScanner(script.text).tokenize(); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 } else { | 86 } else { |
| 87 for (Link<Element> link = imported.topLevelElements; !link.isEmpty(); | 87 for (Link<Element> link = imported.topLevelElements; !link.isEmpty(); |
| 88 link = link.tail) { | 88 link = link.tail) { |
| 89 compiler.withCurrentElement(link.head, () { | 89 compiler.withCurrentElement(link.head, () { |
| 90 library.define(link.head, compiler); | 90 library.define(link.head, compiler); |
| 91 }); | 91 }); |
| 92 } | 92 } |
| 93 } | 93 } |
| 94 } | 94 } |
| 95 } | 95 } |
| OLD | NEW |