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

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: Rebase and refactor ClassElement.constructors. 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 (var element in imported.localMembers) {
194 link = link.tail) { 194 compiler.withCurrentElement(element, () {
195 compiler.withCurrentElement(link.head, () { 195 target.addToScope(element, compiler);
196 target.define(link.head, compiler); 196 });
197 });
198 } 197 }
199 } 198 }
200 199
201 LibraryElement mockLibrary(Compiler compiler, String source) { 200 LibraryElement mockLibrary(Compiler compiler, String source) {
202 Uri uri = new Uri.fromComponents(scheme: "source"); 201 Uri uri = new Uri.fromComponents(scheme: "source");
203 var library = new LibraryElement(new Script(uri, new MockFile(source))); 202 var library = new LibraryElement(new Script(uri, new MockFile(source)));
204 importLibrary(library, compiler.coreLibrary, compiler); 203 importLibrary(library, compiler.coreLibrary, compiler);
205 return library; 204 return library;
206 } 205 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/find_my_name_test.dart ('k') | tests/compiler/dart2js/parser_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698