| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 imports.addLast(tag); | 50 imports.addLast(tag); |
| 51 } else if (tag.isLibrary()) { | 51 } else if (tag.isLibrary()) { |
| 52 tagState = checkTag(TagState.LIBRARY, tag); | 52 tagState = checkTag(TagState.LIBRARY, tag); |
| 53 if (library.libraryTag !== null) { | 53 if (library.libraryTag !== null) { |
| 54 compiler.cancel("duplicated library declaration", node: tag); | 54 compiler.cancel("duplicated library declaration", node: tag); |
| 55 } else { | 55 } else { |
| 56 library.libraryTag = tag; | 56 library.libraryTag = tag; |
| 57 } | 57 } |
| 58 } else if (tag.isSource()) { | 58 } else if (tag.isSource()) { |
| 59 tagState = checkTag(TagState.SOURCE, tag); | 59 tagState = checkTag(TagState.SOURCE, tag); |
| 60 Script script = compiler.readScript(resolved, argument); | 60 Script script = compiler.readScript(resolved, tag); |
| 61 CompilationUnitElement unit = | 61 CompilationUnitElement unit = |
| 62 new CompilationUnitElement(script, library); | 62 new CompilationUnitElement(script, library); |
| 63 compiler.withCurrentElement(unit, () => scan(unit)); | 63 compiler.withCurrentElement(unit, () => scan(unit)); |
| 64 } else if (tag.isResource()) { | 64 } else if (tag.isResource()) { |
| 65 tagState = checkTag(TagState.RESOURCE, tag); | 65 tagState = checkTag(TagState.RESOURCE, tag); |
| 66 compiler.reportWarning(tag, 'ignoring resource tag'); | 66 compiler.reportWarning(tag, 'ignoring resource tag'); |
| 67 } else { | 67 } else { |
| 68 compiler.cancel("illegal script tag: ${tag.tag}", node: tag); | 68 compiler.cancel("illegal script tag: ${tag.tag}", node: tag); |
| 69 } | 69 } |
| 70 } | 70 } |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 static final int RESOURCE = 4; | 200 static final int RESOURCE = 4; |
| 201 | 201 |
| 202 /** Next state. */ | 202 /** Next state. */ |
| 203 static final List<int> NEXT = | 203 static final List<int> NEXT = |
| 204 const <int>[NO_TAG_SEEN, | 204 const <int>[NO_TAG_SEEN, |
| 205 IMPORT, // Only one library tag is allowed. | 205 IMPORT, // Only one library tag is allowed. |
| 206 IMPORT, | 206 IMPORT, |
| 207 SOURCE, | 207 SOURCE, |
| 208 RESOURCE]; | 208 RESOURCE]; |
| 209 } | 209 } |
| OLD | NEW |