Chromium Code Reviews| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 80 } else { | 80 } else { |
| 81 token = ex.position; | 81 token = ex.position; |
| 82 } | 82 } |
| 83 compiler.cancel(ex.message, token: token); | 83 compiler.cancel(ex.message, token: token); |
| 84 } | 84 } |
| 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 String libraryName = uri.toString(); | |
| 90 LibraryElement library = | 91 LibraryElement library = |
| 91 compiler.universe.libraries.putIfAbsent(uri.toString(), () { | 92 compiler.universe.libraries.putIfAbsent(libraryName, () { |
| 92 newLibrary = true; | 93 newLibrary = true; |
| 93 Script script = compiler.readScript(uri, node); | 94 Script script = compiler.readScript(uri, node); |
| 94 LibraryElement element = new LibraryElement(script); | 95 LibraryElement element = new LibraryElement(script); |
| 95 native.checkNativeSupport(compiler, element); | 96 native.checkNativeSupport(compiler, element, libraryName); |
|
ahe
2012/02/29 17:35:27
I think you should pass the URI in here instead.
ngeoffray
2012/03/01 08:57:57
Done.
| |
| 96 return element; | 97 return element; |
| 97 }); | 98 }); |
| 98 if (newLibrary) { | 99 if (newLibrary) { |
| 99 compiler.withCurrentElement(library, () => scan(library)); | 100 compiler.withCurrentElement(library, () => scan(library)); |
| 100 } | 101 } |
| 101 return library; | 102 return library; |
| 102 } | 103 } |
| 103 | 104 |
| 104 void importLibrary(LibraryElement library, LibraryElement imported, | 105 void importLibrary(LibraryElement library, LibraryElement imported, |
| 105 LiteralString prefix) { | 106 LiteralString prefix) { |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 121 final String name = 'Diet Parser'; | 122 final String name = 'Diet Parser'; |
| 122 | 123 |
| 123 dietParse(CompilationUnitElement compilationUnit, Token tokens) { | 124 dietParse(CompilationUnitElement compilationUnit, Token tokens) { |
| 124 measure(() { | 125 measure(() { |
| 125 ElementListener listener = new ElementListener(compiler, compilationUnit); | 126 ElementListener listener = new ElementListener(compiler, compilationUnit); |
| 126 PartialParser parser = new PartialParser(listener); | 127 PartialParser parser = new PartialParser(listener); |
| 127 parser.parseUnit(tokens); | 128 parser.parseUnit(tokens); |
| 128 }); | 129 }); |
| 129 } | 130 } |
| 130 } | 131 } |
| OLD | NEW |