| 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(() { |
| 11 if (compilationUnit.kind === ElementKind.LIBRARY) { | 11 if (compilationUnit.kind === ElementKind.LIBRARY) { |
| 12 compiler.log("scanning library ${compilationUnit.script.name}"); | 12 compiler.log("scanning library ${compilationUnit.script.name}"); |
| 13 } | 13 } |
| 14 scanElements(compilationUnit); | 14 scanElements(compilationUnit); |
| 15 if (compilationUnit.kind === ElementKind.LIBRARY) { | 15 if (compilationUnit.kind === ElementKind.LIBRARY) { |
| 16 processScriptTags(compilationUnit); | 16 processScriptTags(compilationUnit); |
| 17 } | 17 } |
| 18 native.processNativeClasses(compiler, compilationUnit); | 18 compiler.nativeHandler.processNativeClasses(compilationUnit); |
| 19 }); | 19 }); |
| 20 } | 20 } |
| 21 | 21 |
| 22 void processScriptTags(LibraryElement library) { | 22 void processScriptTags(LibraryElement library) { |
| 23 LinkBuilder<ScriptTag> imports = new LinkBuilder<ScriptTag>(); | 23 LinkBuilder<ScriptTag> imports = new LinkBuilder<ScriptTag>(); |
| 24 Uri cwd = new Uri(scheme: 'file', path: compiler.currentDirectory); | 24 Uri cwd = new Uri(scheme: 'file', path: compiler.currentDirectory); |
| 25 Uri base = cwd.resolve(library.script.name.toString()); | 25 Uri base = cwd.resolve(library.script.name.toString()); |
| 26 for (ScriptTag tag in library.tags.reverse()) { | 26 for (ScriptTag tag in library.tags.reverse()) { |
| 27 SourceString argument = tag.argument.value.copyWithoutQuotes(1, 1); | 27 SourceString argument = tag.argument.value.copyWithoutQuotes(1, 1); |
| 28 Uri resolved = base.resolve(argument.slowToString()); | 28 Uri resolved = base.resolve(argument.slowToString()); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 compiler.dietParser.dietParse(compilationUnit, tokens); | 85 compiler.dietParser.dietParse(compilationUnit, tokens); |
| 86 } | 86 } |
| 87 | 87 |
| 88 LibraryElement loadLibrary(Uri uri, ScriptTag node) { | 88 LibraryElement loadLibrary(Uri uri, ScriptTag node) { |
| 89 bool newLibrary = false; | 89 bool newLibrary = false; |
| 90 LibraryElement library = | 90 LibraryElement library = |
| 91 compiler.universe.libraries.putIfAbsent(uri.toString(), () { | 91 compiler.universe.libraries.putIfAbsent(uri.toString(), () { |
| 92 newLibrary = true; | 92 newLibrary = true; |
| 93 Script script = compiler.readScript(uri, node); | 93 Script script = compiler.readScript(uri, node); |
| 94 LibraryElement element = new LibraryElement(script); | 94 LibraryElement element = new LibraryElement(script); |
| 95 native.checkNativeSupport(compiler, element, uri); | 95 compiler.nativeHandler.checkNativeSupport(element, uri); |
| 96 return element; | 96 return element; |
| 97 }); | 97 }); |
| 98 if (newLibrary) { | 98 if (newLibrary) { |
| 99 compiler.withCurrentElement(library, () => scan(library)); | 99 compiler.withCurrentElement(library, () => scan(library)); |
| 100 } | 100 } |
| 101 return library; | 101 return library; |
| 102 } | 102 } |
| 103 | 103 |
| 104 void importLibrary(LibraryElement library, LibraryElement imported, | 104 void importLibrary(LibraryElement library, LibraryElement imported, |
| 105 LiteralString prefix) { | 105 LiteralString prefix) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 121 final String name = 'Diet Parser'; | 121 final String name = 'Diet Parser'; |
| 122 | 122 |
| 123 dietParse(CompilationUnitElement compilationUnit, Token tokens) { | 123 dietParse(CompilationUnitElement compilationUnit, Token tokens) { |
| 124 measure(() { | 124 measure(() { |
| 125 ElementListener listener = new ElementListener(compiler, compilationUnit); | 125 ElementListener listener = new ElementListener(compiler, compilationUnit); |
| 126 PartialParser parser = new PartialParser(listener); | 126 PartialParser parser = new PartialParser(listener); |
| 127 parser.parseUnit(tokens); | 127 parser.parseUnit(tokens); |
| 128 }); | 128 }); |
| 129 } | 129 } |
| 130 } | 130 } |
| OLD | NEW |