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

Unified Diff: tests/compiler/dart2js/mock_compiler.dart

Issue 10836355: Make sure that libraries loaded from dart:core gets dart:core implicitly loaded. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix mock compiler 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/compiler/dart2js/compiler_helper.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/mock_compiler.dart
diff --git a/tests/compiler/dart2js/mock_compiler.dart b/tests/compiler/dart2js/mock_compiler.dart
index 8191444f57fded1605f13964b5a0324098fb7874..b0be8b7794e04ddf904695967990bf54746617b6 100644
--- a/tests/compiler/dart2js/mock_compiler.dart
+++ b/tests/compiler/dart2js/mock_compiler.dart
@@ -51,6 +51,7 @@ final String DEFAULT_INTERCEPTORSLIB = @'''
final String DEFAULT_CORELIB = @'''
print(var obj) {}
+ assert(x) {}
interface int extends num {}
interface double extends num {}
class bool {}
@@ -79,6 +80,9 @@ class MockCompiler extends Compiler {
var script = new Script(uri, new MockFile(coreSource));
coreLibrary = new LibraryElement(script);
parseScript(coreSource, coreLibrary);
+ // We need to set the assert method to avoid calls with a 'null'
+ // target being interpreted as a call to assert.
+ assertMethod = coreLibrary.find(buildSourceString('assert'));
script = new Script(uri, new MockFile(helperSource));
jsHelperLibrary = new LibraryElement(script);
@@ -88,8 +92,6 @@ class MockCompiler extends Compiler {
interceptorsLibrary = new LibraryElement(script);
parseScript(interceptorsSource, interceptorsLibrary);
- scanner.importLibrary(jsHelperLibrary, coreLibrary, null);
- scanner.importLibrary(interceptorsLibrary, coreLibrary, null);
mainApp = mockLibrary(this, "");
initializeSpecialClasses();
}
@@ -119,6 +121,8 @@ class MockCompiler extends Compiler {
print(message);
}
+ bool get compilationFailed => !errors.isEmpty();
+
void clearWarnings() {
warnings = [];
}
@@ -163,6 +167,10 @@ class MockCompiler extends Compiler {
// Do nothing. The mock core library is already handled in the constructor.
}
+ void importCoreLibrary(LibraryElement library) {
+ scanner.importLibrary(library, coreLibrary, null);
+ }
+
// The mock library doesn't need any patches.
Uri resolvePatchUri(String dartLibraryName) => null;
« no previous file with comments | « tests/compiler/dart2js/compiler_helper.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698