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

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

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