| Index: pkg/compiler/lib/src/compiler.dart
|
| diff --git a/pkg/compiler/lib/src/compiler.dart b/pkg/compiler/lib/src/compiler.dart
|
| index 762e315d9979c2145465fa688ea0e7e136e5318d..4ee036fc0d5ef79a9d8327a248f8c7c5c8ea1a1e 100644
|
| --- a/pkg/compiler/lib/src/compiler.dart
|
| +++ b/pkg/compiler/lib/src/compiler.dart
|
| @@ -322,7 +322,8 @@ abstract class Compiler implements LibraryLoaderListener {
|
| serialization = new SerializationTask(this),
|
| libraryLoader = new LibraryLoaderTask(
|
| resolvedUriTranslator,
|
| - new _ScriptLoader(this),
|
| + options.compileOnly
|
| + ? new _NoScriptLoader(this) : new _ScriptLoader(this),
|
| new _ElementScanner(scanner),
|
| serialization,
|
| this,
|
| @@ -2165,6 +2166,18 @@ class _ScriptLoader implements ScriptLoader {
|
| compiler.readScript(uri, spannable);
|
| }
|
|
|
| +/// [ScriptLoader] used to ensure that scripts are not loaded accidentally
|
| +/// through the [LibraryLoader] when `CompilerOptions.compileOnly` is `true`.
|
| +class _NoScriptLoader implements ScriptLoader {
|
| + Compiler compiler;
|
| + _NoScriptLoader(this.compiler);
|
| +
|
| + Future<Script> readScript(Uri uri, [Spannable spannable]) {
|
| + compiler.reporter.internalError(spannable,
|
| + "Script loading of '$uri' is not enabled.");
|
| + }
|
| +}
|
| +
|
| class _ElementScanner implements ElementScanner {
|
| ScannerTask scanner;
|
| _ElementScanner(this.scanner);
|
|
|