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

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

Issue 2265473004: Introduce "CommonElements" (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 3 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.common.resolution; 5 library dart2js.common.resolution;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../compile_time_constants.dart'; 8 import '../compile_time_constants.dart';
9 import '../compiler.dart' show Compiler; 9 import '../compiler.dart' show Compiler;
10 import '../constants/expressions.dart' show ConstantExpression; 10 import '../constants/expressions.dart' show ConstantExpression;
11 import '../constants/values.dart' show ConstantValue; 11 import '../constants/values.dart' show ConstantValue;
12 import '../core_types.dart' show CoreClasses, CoreTypes; 12 import '../core_types.dart' show CoreClasses, CoreTypes, CommonElements;
13 import '../dart_types.dart' show DartType, Types; 13 import '../dart_types.dart' show DartType, Types;
14 import '../elements/elements.dart' 14 import '../elements/elements.dart'
15 show 15 show
16 AstElement, 16 AstElement,
17 ClassElement, 17 ClassElement,
18 ConstructorElement, 18 ConstructorElement,
19 Element, 19 Element,
20 ExecutableElement, 20 ExecutableElement,
21 FunctionElement, 21 FunctionElement,
22 FunctionSignature, 22 FunctionSignature,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 Iterable<Feature> get features => const <Feature>[]; 63 Iterable<Feature> get features => const <Feature>[];
64 Iterable<MapLiteralUse> get mapLiterals => const <MapLiteralUse>[]; 64 Iterable<MapLiteralUse> get mapLiterals => const <MapLiteralUse>[];
65 Iterable<ListLiteralUse> get listLiterals => const <ListLiteralUse>[]; 65 Iterable<ListLiteralUse> get listLiterals => const <ListLiteralUse>[];
66 Iterable<String> get constSymbolNames => const <String>[]; 66 Iterable<String> get constSymbolNames => const <String>[];
67 Iterable<ConstantExpression> get constantLiterals => 67 Iterable<ConstantExpression> get constantLiterals =>
68 const <ConstantExpression>[]; 68 const <ConstantExpression>[];
69 69
70 Iterable<dynamic> get nativeData => const <dynamic>[]; 70 Iterable<dynamic> get nativeData => const <dynamic>[];
71 } 71 }
72 72
73
74 /// Interface for the accessing the front-end analysis. 73 /// Interface for the accessing the front-end analysis.
75 // TODO(johnniwinther): Find a better name for this. 74 // TODO(johnniwinther): Find a better name for this.
76 abstract class Frontend { 75 abstract class Frontend {
77 /// Returns the [ResolutionImpact] for [element]. 76 /// Returns the [ResolutionImpact] for [element].
78 ResolutionImpact getResolutionImpact(Element element); 77 ResolutionImpact getResolutionImpact(Element element);
79 } 78 }
80 79
81 /// Interface defining target-specific behavior for resolution. 80 /// Interface defining target-specific behavior for resolution.
82 abstract class Target { 81 abstract class Target {
83 /// Returns `true` if [library] is a target specific library whose members 82 /// Returns `true` if [library] is a target specific library whose members
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 /// Returns `true` if this target supports async/await. 114 /// Returns `true` if this target supports async/await.
116 bool get supportsAsyncAwait => true; 115 bool get supportsAsyncAwait => true;
117 } 116 }
118 117
119 // TODO(johnniwinther): Rename to `Resolver` or `ResolverContext`. 118 // TODO(johnniwinther): Rename to `Resolver` or `ResolverContext`.
120 abstract class Resolution implements Frontend { 119 abstract class Resolution implements Frontend {
121 ParsingContext get parsingContext; 120 ParsingContext get parsingContext;
122 DiagnosticReporter get reporter; 121 DiagnosticReporter get reporter;
123 CoreClasses get coreClasses; 122 CoreClasses get coreClasses;
124 CoreTypes get coreTypes; 123 CoreTypes get coreTypes;
124 CommonElements get commonElements;
125 Types get types; 125 Types get types;
126 Target get target; 126 Target get target;
127 ResolverTask get resolver; 127 ResolverTask get resolver;
128 ResolutionEnqueuer get enqueuer; 128 ResolutionEnqueuer get enqueuer;
129 CompilerOptions get options; 129 CompilerOptions get options;
130 IdGenerator get idGenerator; 130 IdGenerator get idGenerator;
131 ConstantEnvironment get constants; 131 ConstantEnvironment get constants;
132 MirrorUsageAnalyzerTask get mirrorUsageAnalyzerTask; 132 MirrorUsageAnalyzerTask get mirrorUsageAnalyzerTask;
133 133
134 // TODO(het): Move all elements into common/elements.dart 134 /// Whether internally we computed the constant for the [proxy] variable
135 LibraryElement get coreLibrary; 135 /// defined in dart:core (used only for testing).
136 FunctionElement get identicalFunction; 136 bool get wasProxyConstantComputedTestingOnly;
137 ClassElement get mirrorSystemClass;
138 FunctionElement get mirrorSystemGetNameFunction;
139 ConstructorElement get mirrorsUsedConstructor;
140 ConstructorElement get symbolConstructor;
141
142 // TODO(het): This is only referenced in a test...
143 /// The constant for the [proxy] variable defined in dart:core.
144 ConstantValue get proxyConstant;
145 137
146 /// If set to `true` resolution caches will not be cleared. Use this only for 138 /// If set to `true` resolution caches will not be cleared. Use this only for
147 /// testing. 139 /// testing.
148 bool retainCachesForTesting; 140 bool retainCachesForTesting;
149 141
150 void resolveTypedef(TypedefElement typdef); 142 void resolveTypedef(TypedefElement typdef);
151 void resolveClass(ClassElement cls); 143 void resolveClass(ClassElement cls);
152 void registerClass(ClassElement cls); 144 void registerClass(ClassElement cls);
153 void resolveMetadataAnnotation(MetadataAnnotation metadataAnnotation); 145 void resolveMetadataAnnotation(MetadataAnnotation metadataAnnotation);
154 FunctionSignature resolveSignature(FunctionElement function); 146 FunctionSignature resolveSignature(FunctionElement function);
155 DartType resolveTypeAnnotation(Element element, TypeAnnotation node); 147 DartType resolveTypeAnnotation(Element element, TypeAnnotation node);
156 148
157 /// Returns `true` if [element] has been resolved. 149 /// Returns `true` if [element] has been resolved.
158 // TODO(johnniwinther): Normalize semantics between normal and deserialized 150 // TODO(johnniwinther): Normalize semantics between normal and deserialized
159 // elements; deserialized elements are always resolved but the method will 151 // elements; deserialized elements are always resolved but the method will
160 // return `false`. 152 // return `false`.
161 bool hasBeenResolved(Element element); 153 bool hasBeenResolved(Element element);
162 154
163 /// Resolve [element] if it has not already been resolved. 155 /// Resolve [element] if it has not already been resolved.
164 void ensureResolved(Element element); 156 void ensureResolved(Element element);
165 157
166 /// Called whenever a class has been resolved.
167 void onClassResolved(ClassElement element);
168
169 /// Registers that [element] has a compile time error. 158 /// Registers that [element] has a compile time error.
170 /// 159 ///
171 /// The error itself is given in [message]. 160 /// The error itself is given in [message].
172 void registerCompileTimeError(Element element, DiagnosticMessage message); 161 void registerCompileTimeError(Element element, DiagnosticMessage message);
173 162
174 ResolutionWorkItem createWorkItem( 163 ResolutionWorkItem createWorkItem(
175 Element element, ItemCompilationContext compilationContext); 164 Element element, ItemCompilationContext compilationContext);
176 165
177 /// Returns `true` if [element] as a fully computed [ResolvedAst]. 166 /// Returns `true` if [element] as a fully computed [ResolvedAst].
178 bool hasResolvedAst(ExecutableElement element); 167 bool hasResolvedAst(ExecutableElement element);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 if (cls.isPatch) { 248 if (cls.isPatch) {
260 patchParser.parsePatchClassNode(cls); 249 patchParser.parsePatchClassNode(cls);
261 } 250 }
262 }); 251 });
263 } 252 }
264 253
265 @override 254 @override
266 ScannerOptions getScannerOptionsFor(Element element) => new ScannerOptions( 255 ScannerOptions getScannerOptionsFor(Element element) => new ScannerOptions(
267 canUseNative: backend.canLibraryUseNative(element.library)); 256 canUseNative: backend.canLibraryUseNative(element.library));
268 } 257 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/compile_time_constants.dart » ('j') | pkg/compiler/lib/src/compiler.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698