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 Future; | 7 import 'dart:async' show Future; |
8 | 8 |
9 import '../compiler_new.dart' as api; | 9 import '../compiler_new.dart' as api; |
10 import 'closure.dart' as closureMapping show ClosureTask; | 10 import 'closure.dart' as closureMapping show ClosureTask; |
11 import 'common/names.dart' show Selectors; | 11 import 'common/names.dart' show Selectors; |
12 import 'common/names.dart' show Identifiers, Uris; | 12 import 'common/names.dart' show Identifiers, Uris; |
13 import 'common/resolution.dart' | 13 import 'common/resolution.dart' |
14 show | 14 show |
15 ParsingContext, | 15 ParsingContext, |
16 Resolution, | 16 Resolution, |
17 ResolutionWorkItem, | 17 ResolutionWorkItem, |
18 ResolutionImpact, | 18 ResolutionImpact, |
19 Target; | 19 Target; |
20 import 'common/tasks.dart' show CompilerTask, GenericTask, Measurer; | 20 import 'common/tasks.dart' show CompilerTask, GenericTask, Measurer; |
21 import 'common/work.dart' show WorkItem; | 21 import 'common/work.dart' show WorkItem; |
22 import 'common.dart'; | 22 import 'common.dart'; |
23 import 'compile_time_constants.dart'; | 23 import 'compile_time_constants.dart'; |
24 import 'constants/values.dart'; | 24 import 'constants/values.dart'; |
25 import 'common_elements.dart' | 25 import 'common_elements.dart' show CommonElements, ElementEnvironment; |
26 show CommonElements, CommonElementsImpl, ElementEnvironment; | |
27 import 'deferred_load.dart' show DeferredLoadTask; | 26 import 'deferred_load.dart' show DeferredLoadTask; |
28 import 'diagnostics/code_location.dart'; | 27 import 'diagnostics/code_location.dart'; |
29 import 'diagnostics/diagnostic_listener.dart' show DiagnosticReporter; | 28 import 'diagnostics/diagnostic_listener.dart' show DiagnosticReporter; |
30 import 'diagnostics/invariant.dart' show REPORT_EXCESS_RESOLUTION; | 29 import 'diagnostics/invariant.dart' show REPORT_EXCESS_RESOLUTION; |
31 import 'diagnostics/messages.dart' show Message, MessageTemplate; | 30 import 'diagnostics/messages.dart' show Message, MessageTemplate; |
32 import 'dump_info.dart' show DumpInfoTask; | 31 import 'dump_info.dart' show DumpInfoTask; |
33 import 'elements/elements.dart'; | 32 import 'elements/elements.dart'; |
34 import 'elements/entities.dart'; | 33 import 'elements/entities.dart'; |
35 import 'elements/modelx.dart' show ErroneousElementX; | 34 import 'elements/modelx.dart' show ErroneousElementX; |
36 import 'elements/resolution_types.dart' | 35 import 'elements/resolution_types.dart' |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 import 'world.dart' show ClosedWorld, ClosedWorldRefiner, ClosedWorldImpl; | 80 import 'world.dart' show ClosedWorld, ClosedWorldRefiner, ClosedWorldImpl; |
82 | 81 |
83 typedef CompilerDiagnosticReporter MakeReporterFunction( | 82 typedef CompilerDiagnosticReporter MakeReporterFunction( |
84 Compiler compiler, CompilerOptions options); | 83 Compiler compiler, CompilerOptions options); |
85 | 84 |
86 abstract class Compiler { | 85 abstract class Compiler { |
87 Measurer get measurer; | 86 Measurer get measurer; |
88 | 87 |
89 final IdGenerator idGenerator = new IdGenerator(); | 88 final IdGenerator idGenerator = new IdGenerator(); |
90 Types types; | 89 Types types; |
91 CommonElementsImpl _commonElements; | 90 CommonElements _commonElements; |
92 _CompilerElementEnvironment _elementEnvironment; | 91 _CompilerElementEnvironment _elementEnvironment; |
93 CompilerDiagnosticReporter _reporter; | 92 CompilerDiagnosticReporter _reporter; |
94 CompilerResolution _resolution; | 93 CompilerResolution _resolution; |
95 ParsingContext _parsingContext; | 94 ParsingContext _parsingContext; |
96 | 95 |
97 ImpactStrategy impactStrategy = const ImpactStrategy(); | 96 ImpactStrategy impactStrategy = const ImpactStrategy(); |
98 | 97 |
99 /** | 98 /** |
100 * Map from token to the first preceding comment token. | 99 * Map from token to the first preceding comment token. |
101 */ | 100 */ |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 this.userOutputProvider = outputProvider == null | 189 this.userOutputProvider = outputProvider == null |
191 ? const NullCompilerOutput() | 190 ? const NullCompilerOutput() |
192 : outputProvider { | 191 : outputProvider { |
193 if (makeReporter != null) { | 192 if (makeReporter != null) { |
194 _reporter = makeReporter(this, options); | 193 _reporter = makeReporter(this, options); |
195 } else { | 194 } else { |
196 _reporter = new CompilerDiagnosticReporter(this, options); | 195 _reporter = new CompilerDiagnosticReporter(this, options); |
197 } | 196 } |
198 _resolution = createResolution(); | 197 _resolution = createResolution(); |
199 _elementEnvironment = new _CompilerElementEnvironment(this); | 198 _elementEnvironment = new _CompilerElementEnvironment(this); |
200 _commonElements = new CommonElementsImpl(_elementEnvironment); | 199 _commonElements = new CommonElements(_elementEnvironment); |
201 types = new Types(_resolution); | 200 types = new Types(_resolution); |
202 | 201 |
203 if (options.verbose) { | 202 if (options.verbose) { |
204 progress = new Stopwatch()..start(); | 203 progress = new Stopwatch()..start(); |
205 } | 204 } |
206 | 205 |
207 backend = createBackend(); | 206 backend = createBackend(); |
208 enqueuer = backend.makeEnqueuer(); | 207 enqueuer = backend.makeEnqueuer(); |
209 | 208 |
210 tasks = [ | 209 tasks = [ |
(...skipping 1791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2002 ResolutionFunctionType getLocalFunctionType(LocalFunctionElement function) { | 2001 ResolutionFunctionType getLocalFunctionType(LocalFunctionElement function) { |
2003 return function.type; | 2002 return function.type; |
2004 } | 2003 } |
2005 | 2004 |
2006 @override | 2005 @override |
2007 ResolutionDartType getUnaliasedType(ResolutionDartType type) { | 2006 ResolutionDartType getUnaliasedType(ResolutionDartType type) { |
2008 type.computeUnaliased(_resolution); | 2007 type.computeUnaliased(_resolution); |
2009 return type.unaliased; | 2008 return type.unaliased; |
2010 } | 2009 } |
2011 } | 2010 } |
OLD | NEW |