Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(124)

Side by Side Diff: lib/compiler/implementation/scanner/scanner_task.dart

Issue 10703188: Allow patch files to add top-level declarations to the patched library. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix errors caught by editor. Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 if (newLibrary) { 123 if (newLibrary) {
124 compiler.withCurrentElement(library, () { 124 compiler.withCurrentElement(library, () {
125 scan(library); 125 scan(library);
126 compiler.onLibraryLoaded(library, uri); 126 compiler.onLibraryLoaded(library, uri);
127 }); 127 });
128 } 128 }
129 return library; 129 return library;
130 } 130 }
131 131
132 void importLibrary(LibraryElement library, LibraryElement imported, 132 void importLibrary(LibraryElement library, LibraryElement imported,
133 ScriptTag tag, [CompilationUnitElement patch]) { 133 ScriptTag tag, [Script override]) {
134 if (!imported.hasLibraryName()) { 134 if (!imported.hasLibraryName()) {
135 compiler.withCurrentElement(library, () { 135 compiler.withCurrentElement(library, () {
136 compiler.reportError(tag === null ? null : tag.argument, 136 compiler.reportError(tag === null ? null : tag.argument,
137 'no #library tag found in ${imported.script.uri}'); 137 'no #library tag found in ${imported.script.uri}');
138 }); 138 });
139 } 139 }
140 if (tag !== null && tag.prefix !== null) { 140 if (tag !== null && tag.prefix !== null) {
141 SourceString prefix = 141 SourceString prefix =
142 new SourceString(tag.prefix.dartString.slowToString()); 142 new SourceString(tag.prefix.dartString.slowToString());
143 Element e = library.find(prefix); 143 Element e = library.find(prefix);
144 if (e === null) { 144 if (e === null) {
145 e = new PrefixElement(prefix, library, tag.getBeginToken(), patch); 145 e = new PrefixElement(prefix, library, tag.getBeginToken());
146 e.scriptOverride = override;
146 library.define(e, compiler); 147 library.define(e, compiler);
147 } 148 }
148 if (e.kind !== ElementKind.PREFIX) { 149 if (e.kind !== ElementKind.PREFIX) {
149 compiler.withCurrentElement(e, () { 150 compiler.withCurrentElement(e, () {
150 compiler.reportWarning(new Identifier(e.position()), 151 compiler.reportWarning(new Identifier(e.position()),
151 'duplicated definition'); 152 'duplicated definition');
152 }); 153 });
153 compiler.reportError(tag.prefix, 'duplicate defintion'); 154 compiler.reportError(tag.prefix, 'duplicate defintion');
154 } 155 }
155 PrefixElement prefixElement = e; 156 PrefixElement prefixElement = e;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 static final int RESOURCE = 4; 205 static final int RESOURCE = 4;
205 206
206 /** Next state. */ 207 /** Next state. */
207 static final List<int> NEXT = 208 static final List<int> NEXT =
208 const <int>[NO_TAG_SEEN, 209 const <int>[NO_TAG_SEEN,
209 IMPORT, // Only one library tag is allowed. 210 IMPORT, // Only one library tag is allowed.
210 IMPORT, 211 IMPORT,
211 SOURCE, 212 SOURCE,
212 RESOURCE]; 213 RESOURCE];
213 } 214 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/scanner/listener.dart ('k') | lib/compiler/implementation/ssa/codegen.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698