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

Side by Side Diff: frog/leg/scanner/scanner_task.dart

Issue 9418045: Support for native in leg, and start moving native tests to a specific test suite. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 10 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(() {
11 scanElements(compilationUnit); 11 scanElements(compilationUnit);
12 if (compilationUnit.kind === ElementKind.LIBRARY) { 12 if (compilationUnit.kind === ElementKind.LIBRARY) {
13 processScriptTags(compilationUnit); 13 processScriptTags(compilationUnit);
14 } 14 }
15 for (Link<Element> link = compilationUnit.topLevelElements;
ahe 2012/02/19 14:38:02 This should be in the if case above. Also, I'd lik
ngeoffray 2012/02/20 09:09:37 How about elements defined in a non-library compil
16 !link.isEmpty(); link = link.tail) {
17 Element element = link.head;
18 if (element.kind == ElementKind.CLASS) {
19 ClassElement classElement = element;
20 if (element.isNative()) {
21 compiler.registerInstantiatedClass(classElement);
22 // Also parse the node to know all its methods because
23 // otherwise it will only be parsed if there is a call to
24 // one of its constructor.
25 element.parseNode(compiler);
26 }
27 }
28 }
15 }); 29 });
16 } 30 }
17 31
18 void processScriptTags(LibraryElement library) { 32 void processScriptTags(LibraryElement library) {
19 LinkBuilder<ScriptTag> imports = new LinkBuilder<ScriptTag>(); 33 LinkBuilder<ScriptTag> imports = new LinkBuilder<ScriptTag>();
20 Uri cwd = new Uri(scheme: 'file', path: compiler.currentDirectory); 34 Uri cwd = new Uri(scheme: 'file', path: compiler.currentDirectory);
21 Uri base = cwd.resolve(library.script.name.toString()); 35 Uri base = cwd.resolve(library.script.name.toString());
22 for (ScriptTag tag in library.tags.reverse()) { 36 for (ScriptTag tag in library.tags.reverse()) {
23 SourceString argument = tag.argument.value.copyWithoutQuotes(1, 1); 37 SourceString argument = tag.argument.value.copyWithoutQuotes(1, 1);
24 Uri resolved = base.resolve(argument.toString()); 38 Uri resolved = base.resolve(argument.toString());
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 } else { 119 } else {
106 for (Link<Element> link = imported.topLevelElements; !link.isEmpty(); 120 for (Link<Element> link = imported.topLevelElements; !link.isEmpty();
107 link = link.tail) { 121 link = link.tail) {
108 compiler.withCurrentElement(link.head, () { 122 compiler.withCurrentElement(link.head, () {
109 library.define(link.head, compiler); 123 library.define(link.head, compiler);
110 }); 124 });
111 } 125 }
112 } 126 }
113 } 127 }
114 } 128 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698