| 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 e = new PrefixElement(prefix, library, tag.getBeginToken()); | 139 e = new PrefixElement(prefix, library, tag.getBeginToken()); |
| 140 library.define(e, compiler); | 140 library.define(e, compiler); |
| 141 } | 141 } |
| 142 if (e.kind !== ElementKind.PREFIX) { | 142 if (e.kind !== ElementKind.PREFIX) { |
| 143 compiler.withCurrentElement(e, () { | 143 compiler.withCurrentElement(e, () { |
| 144 compiler.reportWarning(new Identifier(e.position()), | 144 compiler.reportWarning(new Identifier(e.position()), |
| 145 'duplicated definition'); | 145 'duplicated definition'); |
| 146 }); | 146 }); |
| 147 compiler.reportError(tag.prefix, 'duplicate defintion'); | 147 compiler.reportError(tag.prefix, 'duplicate defintion'); |
| 148 } | 148 } |
| 149 PrefixElement prefixElement = e; |
| 149 imported.forEachExport((Element element) { | 150 imported.forEachExport((Element element) { |
| 150 Element existing = e.imported.putIfAbsent(element.name, () => element); | 151 Element existing = |
| 152 prefixElement.imported.putIfAbsent(element.name, () => element); |
| 151 if (existing !== element) { | 153 if (existing !== element) { |
| 152 compiler.withCurrentElement(existing, () { | 154 compiler.withCurrentElement(existing, () { |
| 153 compiler.reportWarning(new Identifier(existing.position()), | 155 compiler.reportWarning(new Identifier(existing.position()), |
| 154 'duplicated import'); | 156 'duplicated import'); |
| 155 }); | 157 }); |
| 156 compiler.withCurrentElement(element, () { | 158 compiler.withCurrentElement(element, () { |
| 157 compiler.reportError(new Identifier(element.position()), | 159 compiler.reportError(new Identifier(element.position()), |
| 158 'duplicated import'); | 160 'duplicated import'); |
| 159 }); | 161 }); |
| 160 } | 162 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 static final int RESOURCE = 4; | 196 static final int RESOURCE = 4; |
| 195 | 197 |
| 196 /** Next state. */ | 198 /** Next state. */ |
| 197 static final List<int> NEXT = | 199 static final List<int> NEXT = |
| 198 const <int>[NO_TAG_SEEN, | 200 const <int>[NO_TAG_SEEN, |
| 199 IMPORT, // Only one library tag is allowed. | 201 IMPORT, // Only one library tag is allowed. |
| 200 IMPORT, | 202 IMPORT, |
| 201 SOURCE, | 203 SOURCE, |
| 202 RESOURCE]; | 204 RESOURCE]; |
| 203 } | 205 } |
| OLD | NEW |