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

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

Issue 10832203: Refactor Library/CompilationUnit and how we define local Scope. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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 #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 22 matching lines...) Expand all
33 scanLibraryElements(library); 33 scanLibraryElements(library);
34 compiler.onLibraryLoaded(library, uri); 34 compiler.onLibraryLoaded(library, uri);
35 }); 35 });
36 } 36 }
37 return library; 37 return library;
38 } 38 }
39 39
40 void scanLibraryElements(LibraryElement library) { 40 void scanLibraryElements(LibraryElement library) {
41 measure(() { 41 measure(() {
42 // TODO(lrn): Possibly recursively handle #source directives in patch. 42 // TODO(lrn): Possibly recursively handle #source directives in patch.
43 leg.Script script = library.script; 43 leg.Script script = library.entryCompilationUnit.script;
44 Token tokens = new StringScanner(script.text).tokenize(); 44 Token tokens = new StringScanner(script.text).tokenize();
45 Function idGenerator = compiler.getNextFreeClassId; 45 Function idGenerator = compiler.getNextFreeClassId;
46 PatchListener patchListener = 46 PatchListener patchListener =
47 new PatchElementListener(compiler, library, idGenerator); 47 new PatchElementListener(compiler,
48 library.entryCompilationUnit,
49 idGenerator);
48 new PatchParser(patchListener).parseUnit(tokens); 50 new PatchParser(patchListener).parseUnit(tokens);
49 }); 51 });
50 } 52 }
51 53
52 tree.ClassNode parsePatchClassNode(PartialClassElement element) { 54 tree.ClassNode parsePatchClassNode(PartialClassElement element) {
53 // Parse [PartialClassElement] using a "patch"-aware parser instead 55 // Parse [PartialClassElement] using a "patch"-aware parser instead
54 // of calling its [parseNode] method. 56 // of calling its [parseNode] method.
55 if (element.cachedNode != null) return element.cachedNode; 57 if (element.cachedNode != null) return element.cachedNode;
56 PatchMemberListener listener = 58 PatchMemberListener listener =
57 new PatchMemberListener(compiler, element); 59 new PatchMemberListener(compiler, element);
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 } 210 }
209 } 211 }
210 212
211 void addMember(Element element) { 213 void addMember(Element element) {
212 if (isMemberPatch || (isClassPatch && element is ClassElement)) { 214 if (isMemberPatch || (isClassPatch && element is ClassElement)) {
213 element.addMetadata(popNode()); 215 element.addMetadata(popNode());
214 } 216 }
215 super.addMember(element); 217 super.addMember(element);
216 } 218 }
217 } 219 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698