| 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 return library; | 103 return library; |
| 104 } | 104 } |
| 105 | 105 |
| 106 void importLibrary(LibraryElement library, LibraryElement imported, | 106 void importLibrary(LibraryElement library, LibraryElement imported, |
| 107 ScriptTag tag) { | 107 ScriptTag tag) { |
| 108 if (tag !== null && tag.prefix !== null) { | 108 if (tag !== null && tag.prefix !== null) { |
| 109 SourceString prefix = | 109 SourceString prefix = |
| 110 new SourceString(tag.prefix.dartString.slowToString()); | 110 new SourceString(tag.prefix.dartString.slowToString()); |
| 111 Element e = library.find(prefix); | 111 Element e = library.find(prefix); |
| 112 if (e === null) { | 112 if (e === null) { |
| 113 e = new PrefixElement(prefix, library); | 113 e = new PrefixElement(prefix, library, tag.getBeginToken()); |
| 114 library.define(e, compiler); | 114 library.define(e, compiler); |
| 115 } | 115 } |
| 116 if (e.kind !== ElementKind.PREFIX) { | 116 if (e.kind !== ElementKind.PREFIX) { |
| 117 compiler.withCurrentElement(e, () { | 117 compiler.withCurrentElement(e, () { |
| 118 compiler.reportWarning(new Identifier(e.position()), | 118 compiler.reportWarning(new Identifier(e.position()), |
| 119 'duplicated definition'); | 119 'duplicated definition'); |
| 120 }); | 120 }); |
| 121 compiler.reportError(tag.prefix, 'duplicate defintion'); | 121 compiler.reportError(tag.prefix, 'duplicate defintion'); |
| 122 } | 122 } |
| 123 imported.forEachExport((Element element) { | 123 imported.forEachExport((Element element) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 148 final String name = 'Diet Parser'; | 148 final String name = 'Diet Parser'; |
| 149 | 149 |
| 150 dietParse(CompilationUnitElement compilationUnit, Token tokens) { | 150 dietParse(CompilationUnitElement compilationUnit, Token tokens) { |
| 151 measure(() { | 151 measure(() { |
| 152 ElementListener listener = new ElementListener(compiler, compilationUnit); | 152 ElementListener listener = new ElementListener(compiler, compilationUnit); |
| 153 PartialParser parser = new PartialParser(listener); | 153 PartialParser parser = new PartialParser(listener); |
| 154 parser.parseUnit(tokens); | 154 parser.parseUnit(tokens); |
| 155 }); | 155 }); |
| 156 } | 156 } |
| 157 } | 157 } |
| OLD | NEW |