| 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; |
| 11 import 'closure.dart' as closureMapping show ClosureTask; | 11 import 'closure.dart' as closureMapping show ClosureTask; |
| 12 import 'common/backend_api.dart' show Backend; | 12 import 'common/backend_api.dart' show Backend; |
| 13 import 'common/codegen.dart' show CodegenWorkItem; | 13 import 'common/codegen.dart' show CodegenWorkItem; |
| 14 import 'common/names.dart' show Selectors; | 14 import 'common/names.dart' show Selectors; |
| 15 import 'common/names.dart' show Identifiers, Uris; | 15 import 'common/names.dart' show Identifiers, Uris; |
| 16 import 'common/registry.dart' show EagerRegistry, Registry; | 16 import 'common/registry.dart' show EagerRegistry, Registry; |
| 17 import 'common/resolution.dart' | 17 import 'common/resolution.dart' |
| 18 show | 18 show |
| 19 ParsingContext, | 19 ParsingContext, |
| 20 Resolution, | 20 Resolution, |
| 21 ResolutionWorkItem, | 21 ResolutionWorkItem, |
| 22 ResolutionImpact, | 22 ResolutionImpact, |
| 23 Target; | 23 Target; |
| 24 import 'common/tasks.dart' show CompilerTask, GenericTask, Measurer; | 24 import 'common/tasks.dart' show CompilerTask, GenericTask, Measurer; |
| 25 import 'common/work.dart' show ItemCompilationContext, WorkItem; | 25 import 'common/work.dart' show ItemCompilationContext, WorkItem; |
| 26 import 'common.dart'; | 26 import 'common.dart'; |
| 27 import 'compile_time_constants.dart'; | 27 import 'compile_time_constants.dart'; |
| 28 import 'constants/values.dart'; | 28 import 'constants/values.dart'; |
| 29 import 'core_types.dart' show CoreClasses, CoreTypes; | 29 import 'core_types.dart' show CoreClasses, CoreTypes; |
| 30 import 'dart_backend/dart_backend.dart' as dart_backend; | |
| 31 import 'dart_types.dart' show DartType, DynamicType, InterfaceType, Types; | 30 import 'dart_types.dart' show DartType, DynamicType, InterfaceType, Types; |
| 32 import 'deferred_load.dart' show DeferredLoadTask; | 31 import 'deferred_load.dart' show DeferredLoadTask; |
| 33 import 'diagnostics/code_location.dart'; | 32 import 'diagnostics/code_location.dart'; |
| 34 import 'diagnostics/diagnostic_listener.dart' show DiagnosticReporter; | 33 import 'diagnostics/diagnostic_listener.dart' show DiagnosticReporter; |
| 35 import 'diagnostics/invariant.dart' show REPORT_EXCESS_RESOLUTION; | 34 import 'diagnostics/invariant.dart' show REPORT_EXCESS_RESOLUTION; |
| 36 import 'diagnostics/messages.dart' show Message, MessageTemplate; | 35 import 'diagnostics/messages.dart' show Message, MessageTemplate; |
| 37 import 'dump_info.dart' show DumpInfoTask; | 36 import 'dump_info.dart' show DumpInfoTask; |
| 38 import 'elements/elements.dart'; | 37 import 'elements/elements.dart'; |
| 39 import 'elements/modelx.dart' show ErroneousElementX; | 38 import 'elements/modelx.dart' show ErroneousElementX; |
| 40 import 'enqueue.dart' | 39 import 'enqueue.dart' |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 if (options.verbose) { | 294 if (options.verbose) { |
| 296 progress = new Stopwatch()..start(); | 295 progress = new Stopwatch()..start(); |
| 297 } | 296 } |
| 298 | 297 |
| 299 // TODO(johnniwinther): Separate the dependency tracking from the enqueuing | 298 // TODO(johnniwinther): Separate the dependency tracking from the enqueuing |
| 300 // for global dependencies. | 299 // for global dependencies. |
| 301 globalDependencies = new GlobalDependencyRegistry(this); | 300 globalDependencies = new GlobalDependencyRegistry(this); |
| 302 | 301 |
| 303 if (makeBackend != null) { | 302 if (makeBackend != null) { |
| 304 backend = makeBackend(this); | 303 backend = makeBackend(this); |
| 305 } else if (options.emitJavaScript) { | 304 } else { |
| 306 js_backend.JavaScriptBackend jsBackend = new js_backend.JavaScriptBackend( | 305 js_backend.JavaScriptBackend jsBackend = new js_backend.JavaScriptBackend( |
| 307 this, | 306 this, |
| 308 generateSourceMap: options.generateSourceMap, | 307 generateSourceMap: options.generateSourceMap, |
| 309 useStartupEmitter: options.useStartupEmitter, | 308 useStartupEmitter: options.useStartupEmitter, |
| 310 useNewSourceInfo: options.useNewSourceInfo); | 309 useNewSourceInfo: options.useNewSourceInfo); |
| 311 backend = jsBackend; | 310 backend = jsBackend; |
| 312 } else { | |
| 313 backend = new dart_backend.DartBackend(this, options.strips, | |
| 314 multiFile: options.dart2dartMultiFile); | |
| 315 if (options.dumpInfo) { | |
| 316 throw new ArgumentError('--dump-info is not supported for dart2dart.'); | |
| 317 } | |
| 318 } | 311 } |
| 319 | 312 |
| 320 if (options.dumpInfo && options.useStartupEmitter) { | 313 if (options.dumpInfo && options.useStartupEmitter) { |
| 321 throw new ArgumentError( | 314 throw new ArgumentError( |
| 322 '--dump-info is not supported with the fast startup emitter'); | 315 '--dump-info is not supported with the fast startup emitter'); |
| 323 } | 316 } |
| 324 | 317 |
| 325 tasks = [ | 318 tasks = [ |
| 326 dietParser = | 319 dietParser = |
| 327 new DietParserTask(options, idGenerator, backend, reporter, measurer), | 320 new DietParserTask(options, idGenerator, backend, reporter, measurer), |
| (...skipping 1846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2174 _ElementScanner(this.scanner); | 2167 _ElementScanner(this.scanner); |
| 2175 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); | 2168 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); |
| 2176 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); | 2169 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); |
| 2177 } | 2170 } |
| 2178 | 2171 |
| 2179 class _EmptyEnvironment implements Environment { | 2172 class _EmptyEnvironment implements Environment { |
| 2180 const _EmptyEnvironment(); | 2173 const _EmptyEnvironment(); |
| 2181 | 2174 |
| 2182 String valueOf(String key) => null; | 2175 String valueOf(String key) => null; |
| 2183 } | 2176 } |
| OLD | NEW |