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

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

Issue 10867011: Deal with the JS helper separately from the 'native' keyword. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
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 12 matching lines...) Expand all
23 */ 23 */
24 void patchLibrary(Uri patchUri, LibraryElement library) { 24 void patchLibrary(Uri patchUri, LibraryElement library) {
25 leg.Script script = compiler.readScript(patchUri, null); 25 leg.Script script = compiler.readScript(patchUri, null);
26 CompilationUnitElement compilationUnit = 26 CompilationUnitElement compilationUnit =
27 new CompilationUnitElement(script, library); 27 new CompilationUnitElement(script, library);
28 library.addCompilationUnit(compilationUnit); 28 library.addCompilationUnit(compilationUnit);
29 LinkBuilder<tree.ScriptTag> imports = new LinkBuilder<tree.ScriptTag>(); 29 LinkBuilder<tree.ScriptTag> imports = new LinkBuilder<tree.ScriptTag>();
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 // Patch 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 if (tag.isSource()) {
41 Uri resolved = patchUri.resolve(tag.argument.dartString.slowToString()); 41 Uri resolved = patchUri.resolve(tag.argument.dartString.slowToString());
42 compiler.scanner.sourceTagInLibrary(tag, resolved, library); 42 compiler.scanner.sourceTagInLibrary(tag, resolved, library);
43 } else { 43 } else {
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 } 279 }
280 } 280 }
281 281
282 void addMember(Element element) { 282 void addMember(Element element) {
283 if (isMemberPatch || (isClassPatch && element is ClassElement)) { 283 if (isMemberPatch || (isClassPatch && element is ClassElement)) {
284 element.addMetadata(popNode()); 284 element.addMetadata(popNode());
285 } 285 }
286 super.addMember(element); 286 super.addMember(element);
287 } 287 }
288 } 288 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/native_handler.dart ('k') | pkg/dartdoc/mirrors/dart2js_mirror.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698