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

Unified Diff: pkg/compiler/lib/src/compiler.dart

Issue 2239933003: Ensure that no scripts are resolved when compiling purely from deserialized data. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 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 | « no previous file | pkg/compiler/lib/src/dart2js.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « no previous file | pkg/compiler/lib/src/dart2js.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698