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

Side by Side Diff: tests/compiler/dart2js/mock_compiler.dart

Issue 10830303: Refactor Library/CompilationUnit and how we define local Scope. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix reference in dart2js_mirror.dart 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('mock_compiler'); 5 #library('mock_compiler');
6 6
7 #import("dart:uri"); 7 #import("dart:uri");
8 8
9 #import("../../../lib/compiler/implementation/elements/elements.dart"); 9 #import("../../../lib/compiler/implementation/elements/elements.dart");
10 #import("../../../lib/compiler/implementation/leg.dart"); 10 #import("../../../lib/compiler/implementation/leg.dart");
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 if (found.hasNext()) { 189 if (found.hasNext()) {
190 do { 190 do {
191 print('Additional warning "${found.next()}"'); 191 print('Additional warning "${found.next()}"');
192 } while (found.hasNext()); 192 } while (found.hasNext());
193 fail('Too many warnings'); 193 fail('Too many warnings');
194 } 194 }
195 } 195 }
196 196
197 void importLibrary(LibraryElement target, LibraryElement imported, 197 void importLibrary(LibraryElement target, LibraryElement imported,
198 Compiler compiler) { 198 Compiler compiler) {
199 for (Link<Element> link = imported.topLevelElements; !link.isEmpty(); 199 for (var element in imported.localMembers) {
ahe 2012/08/14 12:45:26 This is a test, so I don't mind using for-in.
200 link = link.tail) { 200 compiler.withCurrentElement(element, () {
201 compiler.withCurrentElement(link.head, () { 201 target.addToScope(element, compiler);
202 target.define(link.head, compiler); 202 });
203 });
204 } 203 }
205 } 204 }
206 205
207 LibraryElement mockLibrary(Compiler compiler, String source) { 206 LibraryElement mockLibrary(Compiler compiler, String source) {
208 Uri uri = new Uri.fromComponents(scheme: "source"); 207 Uri uri = new Uri.fromComponents(scheme: "source");
209 var library = new LibraryElement(new Script(uri, new MockFile(source))); 208 var library = new LibraryElement(new Script(uri, new MockFile(source)));
210 importLibrary(library, compiler.coreLibrary, compiler); 209 importLibrary(library, compiler.coreLibrary, compiler);
211 return library; 210 return library;
212 } 211 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698