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

Side by Side Diff: tests/compiler/dart2js/mock_compiler.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('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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 if (found.hasNext()) { 183 if (found.hasNext()) {
184 do { 184 do {
185 print('Additional warning "${found.next()}"'); 185 print('Additional warning "${found.next()}"');
186 } while (found.hasNext()); 186 } while (found.hasNext());
187 fail('Too many warnings'); 187 fail('Too many warnings');
188 } 188 }
189 } 189 }
190 190
191 void importLibrary(LibraryElement target, LibraryElement imported, 191 void importLibrary(LibraryElement target, LibraryElement imported,
192 Compiler compiler) { 192 Compiler compiler) {
193 for (Link<Element> link = imported.topLevelElements; !link.isEmpty(); 193 for (Link<Element> link = imported.localMembers; !link.isEmpty();
Lasse Reichstein Nielsen 2012/08/08 14:22:12 Can you use for-in here too?
Anders Johnsen 2012/08/08 17:30:37 Done.
194 link = link.tail) { 194 link = link.tail) {
195 compiler.withCurrentElement(link.head, () { 195 compiler.withCurrentElement(link.head, () {
196 target.define(link.head, compiler); 196 target.addToScope(link.head, compiler);
197 }); 197 });
198 } 198 }
199 } 199 }
200 200
201 LibraryElement mockLibrary(Compiler compiler, String source) { 201 LibraryElement mockLibrary(Compiler compiler, String source) {
202 Uri uri = new Uri.fromComponents(scheme: "source"); 202 Uri uri = new Uri.fromComponents(scheme: "source");
203 var library = new LibraryElement(new Script(uri, new MockFile(source))); 203 var library = new LibraryElement(new Script(uri, new MockFile(source)));
204 importLibrary(library, compiler.coreLibrary, compiler); 204 importLibrary(library, compiler.coreLibrary, compiler);
205 return library; 205 return library;
206 } 206 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698