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

Side by Side Diff: pkg/compiler/lib/src/compiler.dart

Issue 1864433004: Repeats and fixes the changes landed & reverted as CL 1789553003. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updates to external dependents Created 4 years, 8 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
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 7 import 'dart:async' show
8 EventSink, 8 EventSink,
9 Future; 9 Future;
10 10
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 CoreTypes; 43 CoreTypes;
44 import 'dart_backend/dart_backend.dart' as dart_backend; 44 import 'dart_backend/dart_backend.dart' as dart_backend;
45 import 'dart_types.dart' show 45 import 'dart_types.dart' show
46 DartType, 46 DartType,
47 DynamicType, 47 DynamicType,
48 InterfaceType, 48 InterfaceType,
49 Types; 49 Types;
50 import 'deferred_load.dart' show DeferredLoadTask, OutputUnit; 50 import 'deferred_load.dart' show DeferredLoadTask, OutputUnit;
51 import 'diagnostics/code_location.dart'; 51 import 'diagnostics/code_location.dart';
52 import 'diagnostics/diagnostic_listener.dart' show 52 import 'diagnostics/diagnostic_listener.dart' show
53 DiagnosticOptions; 53 DiagnosticReporter;
54 import 'diagnostics/invariant.dart' show 54 import 'diagnostics/invariant.dart' show
55 REPORT_EXCESS_RESOLUTION; 55 REPORT_EXCESS_RESOLUTION;
56 import 'diagnostics/messages.dart' show 56 import 'diagnostics/messages.dart' show
57 Message, 57 Message,
58 MessageTemplate; 58 MessageTemplate;
59 import 'dump_info.dart' show 59 import 'dump_info.dart' show
60 DumpInfoTask; 60 DumpInfoTask;
61 import 'elements/elements.dart'; 61 import 'elements/elements.dart';
62 import 'elements/modelx.dart' show 62 import 'elements/modelx.dart' show
63 ErroneousElementX, 63 ErroneousElementX,
(...skipping 24 matching lines...) Expand all
88 LibraryLoaderListener, 88 LibraryLoaderListener,
89 ResolvedUriTranslator, 89 ResolvedUriTranslator,
90 ScriptLoader; 90 ScriptLoader;
91 import 'mirrors_used.dart' show 91 import 'mirrors_used.dart' show
92 MirrorUsageAnalyzerTask; 92 MirrorUsageAnalyzerTask;
93 import 'common/names.dart' show 93 import 'common/names.dart' show
94 Selectors; 94 Selectors;
95 import 'null_compiler_output.dart' show 95 import 'null_compiler_output.dart' show
96 NullCompilerOutput, 96 NullCompilerOutput,
97 NullSink; 97 NullSink;
98 import 'options.dart' show
99 CompilerOptions,
100 DiagnosticOptions,
101 ParserOptions;
98 import 'parser/diet_parser_task.dart' show 102 import 'parser/diet_parser_task.dart' show
99 DietParserTask; 103 DietParserTask;
100 import 'parser/element_listener.dart' show 104 import 'parser/element_listener.dart' show
101 ScannerOptions; 105 ScannerOptions;
102 import 'parser/parser_task.dart' show 106 import 'parser/parser_task.dart' show
103 ParserTask; 107 ParserTask;
104 import 'patch_parser.dart' show 108 import 'patch_parser.dart' show
105 PatchParserTask; 109 PatchParserTask;
106 import 'resolution/registry.dart' show 110 import 'resolution/registry.dart' show
107 ResolutionRegistry; 111 ResolutionRegistry;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 * Dependencies that are only included due to mirrors. 188 * Dependencies that are only included due to mirrors.
185 * 189 *
186 * We should get rid of this and ensure that all dependencies are 190 * We should get rid of this and ensure that all dependencies are
187 * associated with a particular element. 191 * associated with a particular element.
188 */ 192 */
189 // TODO(johnniwinther): This should not be a [ResolutionRegistry]. 193 // TODO(johnniwinther): This should not be a [ResolutionRegistry].
190 final Registry mirrorDependencies = 194 final Registry mirrorDependencies =
191 new ResolutionRegistry(null, new TreeElementMapping(null)); 195 new ResolutionRegistry(null, new TreeElementMapping(null));
192 196
193 /// Options provided from command-line arguments. 197 /// Options provided from command-line arguments.
194 final api.CompilerOptions options; 198 final CompilerOptions options;
195 199
196 /** 200 /**
197 * If true, stop compilation after type inference is complete. Used for 201 * If true, stop compilation after type inference is complete. Used for
198 * debugging and testing purposes only. 202 * debugging and testing purposes only.
199 */ 203 */
200 bool stopAfterTypeInference = false; 204 bool stopAfterTypeInference = false;
201 205
202 /// Output provider from user of Compiler API. 206 /// Output provider from user of Compiler API.
203 api.CompilerOutput userOutputProvider; 207 api.CompilerOutput userOutputProvider;
204 208
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 353
350 bool get compilationFailed => compilationFailedInternal; 354 bool get compilationFailed => compilationFailedInternal;
351 355
352 void set compilationFailed(bool value) { 356 void set compilationFailed(bool value) {
353 if (value) { 357 if (value) {
354 elementsWithCompileTimeErrors.add(currentElement); 358 elementsWithCompileTimeErrors.add(currentElement);
355 } 359 }
356 compilationFailedInternal = value; 360 compilationFailedInternal = value;
357 } 361 }
358 362
359 Compiler({api.CompilerOptions options, 363 Compiler({CompilerOptions options,
360 api.CompilerOutput outputProvider, 364 api.CompilerOutput outputProvider,
361 this.environment: const _EmptyEnvironment()}) 365 this.environment: const _EmptyEnvironment()})
362 : this.options = options, 366 : this.options = options,
363 this.cacheStrategy = new CacheStrategy(options.hasIncrementalSupport), 367 this.cacheStrategy = new CacheStrategy(options.hasIncrementalSupport),
364 this.userOutputProvider = outputProvider == null 368 this.userOutputProvider = outputProvider == null
365 ? const NullCompilerOutput() : outputProvider { 369 ? const NullCompilerOutput() : outputProvider {
366
367 world = new World(this); 370 world = new World(this);
368 // TODO(johnniwinther): Initialize core types in [initializeCoreClasses] and 371 // TODO(johnniwinther): Initialize core types in [initializeCoreClasses] and
369 // make its field final. 372 // make its field final.
370 _reporter = new _CompilerDiagnosticReporter( 373 _reporter = new _CompilerDiagnosticReporter(this, options);
371 this, options.diagnosticOptions);
372 _parsing = new _CompilerParsing(this); 374 _parsing = new _CompilerParsing(this);
373 _resolution = new _CompilerResolution(this); 375 _resolution = new _CompilerResolution(this);
374 _coreTypes = new _CompilerCoreTypes(_resolution); 376 _coreTypes = new _CompilerCoreTypes(_resolution);
375 types = new Types(_resolution); 377 types = new Types(_resolution);
376 tracer = new Tracer(this, this.outputProvider); 378 tracer = new Tracer(this, this.outputProvider);
377 379
378 if (options.verbose) { 380 if (options.verbose) {
379 progress = new Stopwatch()..start(); 381 progress = new Stopwatch()..start();
380 } 382 }
381 383
(...skipping 10 matching lines...) Expand all
392 backend = jsBackend; 394 backend = jsBackend;
393 } else { 395 } else {
394 backend = new dart_backend.DartBackend(this, options.strips, 396 backend = new dart_backend.DartBackend(this, options.strips,
395 multiFile: options.dart2dartMultiFile); 397 multiFile: options.dart2dartMultiFile);
396 if (options.dumpInfo) { 398 if (options.dumpInfo) {
397 throw new ArgumentError('--dump-info is not supported for dart2dart.'); 399 throw new ArgumentError('--dump-info is not supported for dart2dart.');
398 } 400 }
399 } 401 }
400 402
401 tasks = [ 403 tasks = [
402 dietParser = new DietParserTask( 404 dietParser = new DietParserTask(this, parsing.parserOptions),
403 this, enableConditionalDirectives: options.enableConditionalDirectives ),
404 scanner = createScannerTask(), 405 scanner = createScannerTask(),
405 serialization = new SerializationTask(this), 406 serialization = new SerializationTask(this),
406 libraryLoader = new LibraryLoaderTask(this, 407 libraryLoader = new LibraryLoaderTask(this,
407 new _ResolvedUriTranslator(this), 408 new _ResolvedUriTranslator(this),
408 new _ScriptLoader(this), 409 new _ScriptLoader(this),
409 new _ElementScanner(scanner), 410 new _ElementScanner(scanner),
410 this.serialization, 411 this.serialization,
411 this, 412 this,
412 environment), 413 environment),
413 parser = new ParserTask(this, 414 parser = new ParserTask(this, parsing.parserOptions),
414 enableConditionalDirectives: options.enableConditionalDirectives), 415 patchParser = new PatchParserTask(this, parsing.parserOptions),
415 patchParser = new PatchParserTask(
416 this, enableConditionalDirectives: options.enableConditionalDirectives ),
417 resolver = createResolverTask(), 416 resolver = createResolverTask(),
418 closureToClassMapper = new closureMapping.ClosureTask(this), 417 closureToClassMapper = new closureMapping.ClosureTask(this),
419 checker = new TypeCheckerTask(this), 418 checker = new TypeCheckerTask(this),
420 typesTask = new ti.TypesTask(this), 419 typesTask = new ti.TypesTask(this),
421 constants = backend.constantCompilerTask, 420 constants = backend.constantCompilerTask,
422 deferredLoadTask = new DeferredLoadTask(this), 421 deferredLoadTask = new DeferredLoadTask(this),
423 mirrorUsageAnalyzerTask = new MirrorUsageAnalyzerTask(this), 422 mirrorUsageAnalyzerTask = new MirrorUsageAnalyzerTask(this),
424 enqueuer = new EnqueueTask(this), 423 enqueuer = new EnqueueTask(this),
425 dumpInfoTask = new DumpInfoTask(this), 424 dumpInfoTask = new DumpInfoTask(this),
426 reuseLibraryTask = new GenericTask('Reuse library', this), 425 reuseLibraryTask = new GenericTask('Reuse library', this),
(...skipping 1669 matching lines...) Expand 10 before | Expand all | Expand 10 after
2096 2095
2097 @override 2096 @override
2098 void parsePatchClass(ClassElement cls) { 2097 void parsePatchClass(ClassElement cls) {
2099 compiler.patchParser.measure(() { 2098 compiler.patchParser.measure(() {
2100 if (cls.isPatch) { 2099 if (cls.isPatch) {
2101 compiler.patchParser.parsePatchClassNode(cls); 2100 compiler.patchParser.parsePatchClassNode(cls);
2102 } 2101 }
2103 }); 2102 });
2104 } 2103 }
2105 2104
2106 ScannerOptions getScannerOptionsFor(Element element) { 2105 ScannerOptions getScannerOptionsFor(Element element) =>
2107 return new ScannerOptions( 2106 new ScannerOptions.from(compiler, element.library);
2108 canUseNative: compiler.backend.canLibraryUseNative(element.library)); 2107
2109 } 2108 ParserOptions get parserOptions => compiler.options;
2110 } 2109 }
2111 2110
2112 class GlobalDependencyRegistry extends EagerRegistry { 2111 class GlobalDependencyRegistry extends EagerRegistry {
2113 final Compiler compiler; 2112 final Compiler compiler;
2114 Setlet<Element> _otherDependencies; 2113 Setlet<Element> _otherDependencies;
2115 2114
2116 GlobalDependencyRegistry(this.compiler) : super('GlobalDependencies', null); 2115 GlobalDependencyRegistry(this.compiler) : super('GlobalDependencies', null);
2117 2116
2118 // TODO(johnniwinther): Rename world/universe/enqueuer through out the 2117 // TODO(johnniwinther): Rename world/universe/enqueuer through out the
2119 // compiler. 2118 // compiler.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
2157 _ElementScanner(this.scanner); 2156 _ElementScanner(this.scanner);
2158 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); 2157 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library);
2159 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); 2158 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit);
2160 } 2159 }
2161 2160
2162 class _EmptyEnvironment implements Environment { 2161 class _EmptyEnvironment implements Environment {
2163 const _EmptyEnvironment(); 2162 const _EmptyEnvironment();
2164 2163
2165 String valueOf(String key) => null; 2164 String valueOf(String key) => null;
2166 } 2165 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/common/resolution.dart ('k') | pkg/compiler/lib/src/diagnostics/diagnostic_listener.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698