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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | pkg/compiler/lib/src/dart2js.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 dart2js.compiler_base; 5 library dart2js.compiler_base;
6 6
7 import 'dart:async' show EventSink, Future; 7 import 'dart:async' show EventSink, Future;
8 8
9 import '../compiler_new.dart' as api; 9 import '../compiler_new.dart' as api;
10 import 'cache_strategy.dart' show CacheStrategy; 10 import 'cache_strategy.dart' show CacheStrategy;
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 '--dump-info is not supported with the fast startup emitter'); 315 '--dump-info is not supported with the fast startup emitter');
316 } 316 }
317 317
318 tasks = [ 318 tasks = [
319 dietParser = 319 dietParser =
320 new DietParserTask(options, idGenerator, backend, reporter, measurer), 320 new DietParserTask(options, idGenerator, backend, reporter, measurer),
321 scanner = createScannerTask(), 321 scanner = createScannerTask(),
322 serialization = new SerializationTask(this), 322 serialization = new SerializationTask(this),
323 libraryLoader = new LibraryLoaderTask( 323 libraryLoader = new LibraryLoaderTask(
324 resolvedUriTranslator, 324 resolvedUriTranslator,
325 new _ScriptLoader(this), 325 options.compileOnly
326 ? new _NoScriptLoader(this) : new _ScriptLoader(this),
326 new _ElementScanner(scanner), 327 new _ElementScanner(scanner),
327 serialization, 328 serialization,
328 this, 329 this,
329 environment, 330 environment,
330 reporter, 331 reporter,
331 measurer), 332 measurer),
332 parser = new ParserTask(this, options), 333 parser = new ParserTask(this, options),
333 patchParser = new PatchParserTask(this, options), 334 patchParser = new PatchParserTask(this, options),
334 resolver = createResolverTask(), 335 resolver = createResolverTask(),
335 closureToClassMapper = new closureMapping.ClosureTask(this), 336 closureToClassMapper = new closureMapping.ClosureTask(this),
(...skipping 1822 matching lines...) Expand 10 before | Expand all | Expand 10 after
2158 } 2159 }
2159 2160
2160 class _ScriptLoader implements ScriptLoader { 2161 class _ScriptLoader implements ScriptLoader {
2161 Compiler compiler; 2162 Compiler compiler;
2162 _ScriptLoader(this.compiler); 2163 _ScriptLoader(this.compiler);
2163 2164
2164 Future<Script> readScript(Uri uri, [Spannable spannable]) => 2165 Future<Script> readScript(Uri uri, [Spannable spannable]) =>
2165 compiler.readScript(uri, spannable); 2166 compiler.readScript(uri, spannable);
2166 } 2167 }
2167 2168
2169 /// [ScriptLoader] used to ensure that scripts are not loaded accidentally
2170 /// through the [LibraryLoader] when `CompilerOptions.compileOnly` is `true`.
2171 class _NoScriptLoader implements ScriptLoader {
2172 Compiler compiler;
2173 _NoScriptLoader(this.compiler);
2174
2175 Future<Script> readScript(Uri uri, [Spannable spannable]) {
2176 compiler.reporter.internalError(spannable,
2177 "Script loading of '$uri' is not enabled.");
2178 }
2179 }
2180
2168 class _ElementScanner implements ElementScanner { 2181 class _ElementScanner implements ElementScanner {
2169 ScannerTask scanner; 2182 ScannerTask scanner;
2170 _ElementScanner(this.scanner); 2183 _ElementScanner(this.scanner);
2171 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); 2184 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library);
2172 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); 2185 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit);
2173 } 2186 }
2174 2187
2175 class _EmptyEnvironment implements Environment { 2188 class _EmptyEnvironment implements Environment {
2176 const _EmptyEnvironment(); 2189 const _EmptyEnvironment();
2177 2190
2178 String valueOf(String key) => null; 2191 String valueOf(String key) => null;
2179 } 2192 }
OLDNEW
« 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