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

Side by Side Diff: lib/compiler/implementation/patch_parser.dart

Issue 10869012: Revert "Support sourceing files in patches." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Re-introduce the refactor in scanner_task. Created 8 years, 3 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
« no previous file with comments | « no previous file | lib/compiler/implementation/scanner/scanner_task.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #library("patchparser"); 5 #library("patchparser");
6 #import("dart:uri"); 6 #import("dart:uri");
7 7
8 #import("tree/tree.dart", prefix: "tree"); 8 #import("tree/tree.dart", prefix: "tree");
9 #import("leg.dart", prefix: 'leg'); // CompilerTask, Compiler. 9 #import("leg.dart", prefix: 'leg'); // CompilerTask, Compiler.
10 #import("apiimpl.dart"); 10 #import("apiimpl.dart");
(...skipping 19 matching lines...) Expand all
30 compiler.withCurrentElement(compilationUnit, () { 30 compiler.withCurrentElement(compilationUnit, () {
31 // This patches the elements of the patch library into [library]. 31 // This patches the elements of the patch library into [library].
32 // Injected elements are added directly under the compilation unit. 32 // Injected elements are added directly under the compilation unit.
33 // Patche elements are stored on the patched functions or classes. 33 // Patche elements are stored on the patched functions or classes.
34 scanLibraryElements(compilationUnit, imports); 34 scanLibraryElements(compilationUnit, imports);
35 }); 35 });
36 // After scanning declarations, we handle the import tags in the patch. 36 // After scanning declarations, we handle the import tags in the patch.
37 // TODO(lrn): These imports end up in the original library and are in 37 // TODO(lrn): These imports end up in the original library and are in
38 // scope for the original methods too. This should be fixed. 38 // scope for the original methods too. This should be fixed.
39 for (tree.ScriptTag tag in imports.toLink()) { 39 for (tree.ScriptTag tag in imports.toLink()) {
40 if (tag.isSource()) { 40 compiler.scanner.importLibraryFromTag(tag, compilationUnit);
41 Uri resolved = patchUri.resolve(tag.argument.dartString.slowToString());
42 compiler.scanner.sourceTagInLibrary(tag, resolved, library);
43 } else {
44 compiler.scanner.importLibraryFromTag(tag, compilationUnit);
45 }
46 } 41 }
47 } 42 }
48 43
49 void scanLibraryElements( 44 void scanLibraryElements(
50 CompilationUnitElement compilationUnit, 45 CompilationUnitElement compilationUnit,
51 LinkBuilder<tree.ScriptTag> imports) { 46 LinkBuilder<tree.ScriptTag> imports) {
52 measure(() { 47 measure(() {
53 // TODO(lrn): Possibly recursively handle #source directives in patch. 48 // TODO(lrn): Possibly recursively handle #source directives in patch.
54 leg.Script script = compilationUnit.script; 49 leg.Script script = compilationUnit.script;
55 Token tokens = new StringScanner(script.text).tokenize(); 50 Token tokens = new StringScanner(script.text).tokenize();
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 } 274 }
280 } 275 }
281 276
282 void addMember(Element element) { 277 void addMember(Element element) {
283 if (isMemberPatch || (isClassPatch && element is ClassElement)) { 278 if (isMemberPatch || (isClassPatch && element is ClassElement)) {
284 element.addMetadata(popNode()); 279 element.addMetadata(popNode());
285 } 280 }
286 super.addMember(element); 281 super.addMember(element);
287 } 282 }
288 } 283 }
OLDNEW
« no previous file with comments | « no previous file | lib/compiler/implementation/scanner/scanner_task.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698