| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |