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

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

Issue 3008793002: Use the entity model for dump_info. (Closed)
Patch Set: Created 3 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 // TODO(sigmund): rename and move to common/elements.dart 5 // TODO(sigmund): rename and move to common/elements.dart
6 library dart2js.type_system; 6 library dart2js.type_system;
7 7
8 import 'common.dart'; 8 import 'common.dart';
9 import 'common/names.dart' show Identifiers, Uris; 9 import 'common/names.dart' show Identifiers, Uris;
10 import 'constants/values.dart'; 10 import 'constants/values.dart';
11 import 'elements/entities.dart'; 11 import 'elements/entities.dart';
12 import 'elements/names.dart' show PublicName; 12 import 'elements/names.dart' show PublicName;
13 import 'elements/types.dart'; 13 import 'elements/types.dart';
14 import 'js_backend/backend.dart' show JavaScriptBackend; 14 import 'js_backend/backend.dart' show JavaScriptBackend;
15 import 'js_backend/constant_system_javascript.dart'; 15 import 'js_backend/constant_system_javascript.dart';
16 import 'js_backend/native_data.dart' show NativeBasicData; 16 import 'js_backend/native_data.dart' show NativeBasicData;
17 import 'constants/expressions.dart' show ConstantExpression;
17 import 'universe/call_structure.dart' show CallStructure; 18 import 'universe/call_structure.dart' show CallStructure;
18 import 'universe/selector.dart' show Selector; 19 import 'universe/selector.dart' show Selector;
19 import 'universe/call_structure.dart'; 20 import 'universe/call_structure.dart';
20 21
21 /// The common elements and types in Dart. 22 /// The common elements and types in Dart.
22 class CommonElements { 23 class CommonElements {
23 final ElementEnvironment _env; 24 final ElementEnvironment _env;
24 25
25 CommonElements(this._env); 26 CommonElements(this._env);
26 27
(...skipping 1218 matching lines...) Expand 10 before | Expand all | Expand 10 after
1245 1246
1246 /// Calls [f] for each class member declared or inherited in [cls] together 1247 /// Calls [f] for each class member declared or inherited in [cls] together
1247 /// with the class that declared the member. 1248 /// with the class that declared the member.
1248 /// 1249 ///
1249 /// TODO(johnniwinther): This should not include static members of 1250 /// TODO(johnniwinther): This should not include static members of
1250 /// superclasses. 1251 /// superclasses.
1251 void forEachClassMember( 1252 void forEachClassMember(
1252 ClassEntity cls, void f(ClassEntity declarer, MemberEntity member)); 1253 ClassEntity cls, void f(ClassEntity declarer, MemberEntity member));
1253 1254
1254 /// Calls [f] for every constructor declared in [cls]. 1255 /// Calls [f] for every constructor declared in [cls].
1256 ///
1257 /// Will ensure that the class and all constructors are resolved if
1258 /// [ensureResolved] is `true`.
1255 void forEachConstructor( 1259 void forEachConstructor(
1256 ClassEntity cls, void f(ConstructorEntity constructor)); 1260 ClassEntity cls, void f(ConstructorEntity constructor),
1261 {bool ensureResolved: true});
Siggi Cherem (dart-lang) 2017/08/30 17:30:42 since we don't really have "resolution" in the new
Harry Terkelsen 2017/08/30 21:28:50 Done, except for classes I'm still asking if it wa
1257 1262
1258 /// Calls [f] for every constructor body in [cls]. 1263 /// Calls [f] for every constructor body in [cls].
1259 void forEachConstructorBody( 1264 void forEachConstructorBody(
1260 ClassEntity cls, void f(ConstructorBodyEntity constructorBody)); 1265 ClassEntity cls, void f(ConstructorBodyEntity constructorBody));
1261 1266
1267 /// Calls [f] for each nested closure in [member].
1268 void forEachNestedClosure(
1269 MemberEntity member, void f(FunctionEntity closure));
1270
1262 /// Returns the superclass of [cls]. 1271 /// Returns the superclass of [cls].
1263 /// 1272 ///
1264 /// If [skipUnnamedMixinApplications] is `true`, unnamed mixin applications 1273 /// If [skipUnnamedMixinApplications] is `true`, unnamed mixin applications
1265 /// are excluded, for instance for these classes 1274 /// are excluded, for instance for these classes
1266 /// 1275 ///
1267 /// class S {} 1276 /// class S {}
1268 /// class M {} 1277 /// class M {}
1269 /// class C extends S with M {} 1278 /// class C extends S with M {}
1270 /// 1279 ///
1271 /// the result of `getSuperClass(C)` is the unnamed mixin application 1280 /// the result of `getSuperClass(C)` is the unnamed mixin application
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1331 1340
1332 /// Returns the type of [function]. 1341 /// Returns the type of [function].
1333 FunctionType getFunctionType(FunctionEntity function); 1342 FunctionType getFunctionType(FunctionEntity function);
1334 1343
1335 /// Returns the type of [field]. 1344 /// Returns the type of [field].
1336 DartType getFieldType(FieldEntity field); 1345 DartType getFieldType(FieldEntity field);
1337 1346
1338 /// Returns the type of the [local] function. 1347 /// Returns the type of the [local] function.
1339 FunctionType getLocalFunctionType(Local local); 1348 FunctionType getLocalFunctionType(Local local);
1340 1349
1350 /// Gets the constant value of [field], or `null` if [field] is non-const.
1351 ConstantExpression getFieldConstant(FieldEntity field);
1352
1341 /// Returns the 'unaliased' type of [type]. For typedefs this is the function 1353 /// Returns the 'unaliased' type of [type]. For typedefs this is the function
1342 /// type it is an alias of, for other types it is the type itself. 1354 /// type it is an alias of, for other types it is the type itself.
1343 /// 1355 ///
1344 /// Use this during resolution to ensure that the alias has been computed. 1356 /// Use this during resolution to ensure that the alias has been computed.
1345 // TODO(johnniwinther): Remove this when the resolver is removed. 1357 // TODO(johnniwinther): Remove this when the resolver is removed.
1346 DartType getUnaliasedType(DartType type); 1358 DartType getUnaliasedType(DartType type);
1347 1359
1348 /// Returns `true` if [member] a the synthetic getter `loadLibrary` injected 1360 /// Returns `true` if [member] a the synthetic getter `loadLibrary` injected
1349 /// on deferred libraries. 1361 /// on deferred libraries.
1350 bool isDeferredLoadLibraryGetter(MemberEntity member); 1362 bool isDeferredLoadLibraryGetter(MemberEntity member);
1351 1363
1352 /// Returns the metadata constants declared on [library]. 1364 /// Returns the metadata constants declared on [library].
1353 Iterable<ConstantValue> getLibraryMetadata(LibraryEntity library); 1365 Iterable<ConstantValue> getLibraryMetadata(LibraryEntity library);
1354 1366
1355 /// Returns the metadata constants declared on [cls]. 1367 /// Returns the metadata constants declared on [cls].
1356 Iterable<ConstantValue> getClassMetadata(ClassEntity cls); 1368 Iterable<ConstantValue> getClassMetadata(ClassEntity cls);
1357 1369
1358 /// Returns the metadata constants declared on [typedef]. 1370 /// Returns the metadata constants declared on [typedef].
1359 Iterable<ConstantValue> getTypedefMetadata(TypedefEntity typedef); 1371 Iterable<ConstantValue> getTypedefMetadata(TypedefEntity typedef);
1360 1372
1361 /// Returns the metadata constants declared on [member]. 1373 /// Returns the metadata constants declared on [member].
1362 Iterable<ConstantValue> getMemberMetadata(MemberEntity member, 1374 Iterable<ConstantValue> getMemberMetadata(MemberEntity member,
1363 {bool includeParameterMetadata: false}); 1375 {bool includeParameterMetadata: false});
1364 1376
1365 /// Returns the function type that is an alias of a [typedef]. 1377 /// Returns the function type that is an alias of a [typedef].
1366 FunctionType getFunctionTypeOfTypedef(TypedefEntity typedef); 1378 FunctionType getFunctionTypeOfTypedef(TypedefEntity typedef);
1379
1380 /// Returns `true` if [entity] has been resolved.
1381 bool hasBeenResolved(Entity entity);
1382
1383 /// Returns `true` if [cls] has been resolved.
1384 bool hasClassBeenResolved(ClassEntity cls);
1367 } 1385 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698