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

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

Issue 11747010: Process handled exports correctly. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Unittest added. Created 7 years, 11 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 '../../../sdk/lib/_internal/compiler/compiler.dart' as api; 9 import '../../../sdk/lib/_internal/compiler/compiler.dart' as api;
10 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' 10 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart'
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 mainApp = mockLibrary(this, ""); 128 mainApp = mockLibrary(this, "");
129 initializeSpecialClasses(); 129 initializeSpecialClasses();
130 // We need to make sure the Object class is resolved. When registering a 130 // We need to make sure the Object class is resolved. When registering a
131 // dynamic invocation the ArgumentTypesRegistry eventually iterates over 131 // dynamic invocation the ArgumentTypesRegistry eventually iterates over
132 // the interfaces of the Object class which would be 'null' if the class 132 // the interfaces of the Object class which would be 'null' if the class
133 // wasn't resolved. 133 // wasn't resolved.
134 objectClass.ensureResolved(this); 134 objectClass.ensureResolved(this);
135 } 135 }
136 136
137 /** 137 /**
138 * Registers the [source] with [uri] making it possible load [source] as a
139 * library.
140 */
141 void registerSource(Uri uri, String source) {
142 sourceFiles[uri.toString()] = new MockFile(source);
143 }
144
145 /**
138 * Used internally to create a library from a source text. The created library 146 * Used internally to create a library from a source text. The created library
139 * is fixed to export its top-level declarations. 147 * is fixed to export its top-level declarations.
140 */ 148 */
141 LibraryElement createLibrary(String name, String source) { 149 LibraryElement createLibrary(String name, String source) {
142 Uri uri = new Uri.fromComponents(scheme: "source", path: name); 150 Uri uri = new Uri.fromComponents(scheme: "source", path: name);
143 var script = new Script(uri, new MockFile(source)); 151 var script = new Script(uri, new MockFile(source));
144 var library = new LibraryElement(script); 152 var library = new LibraryElement(script);
145 parseScript(source, library); 153 parseScript(source, library);
146 library.setExports(library.localScope.values); 154 library.setExports(library.localScope.values);
147 return library; 155 return library;
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 operator []=(Node node, Element element) { 288 operator []=(Node node, Element element) {
281 map[node] = element; 289 map[node] = element;
282 } 290 }
283 291
284 operator [](Node node) => map[node]; 292 operator [](Node node) => map[node];
285 293
286 void remove(Node node) { 294 void remove(Node node) {
287 map.remove(node); 295 map.remove(node);
288 } 296 }
289 } 297 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698