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

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

Issue 2929643002: Introduce JsStrategy skeleton (Closed)
Patch Set: Updated cf. comments Created 3 years, 6 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
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_model/elements.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/names.dart' show Identifiers, Uris; 8 import 'common/names.dart' show Identifiers, Uris;
9 import 'constants/values.dart'; 9 import 'constants/values.dart';
10 import 'elements/entities.dart'; 10 import 'elements/entities.dart';
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 ConstructorEntity get symbolConstructorTarget { 152 ConstructorEntity get symbolConstructorTarget {
153 // TODO(johnniwinther): Kernel does not include redirecting factories 153 // TODO(johnniwinther): Kernel does not include redirecting factories
154 // so this cannot be found in kernel. Find a consistent way to handle 154 // so this cannot be found in kernel. Find a consistent way to handle
155 // this and similar cases. 155 // this and similar cases.
156 return _symbolConstructorTarget ??= 156 return _symbolConstructorTarget ??=
157 _findConstructor(symbolImplementationClass, ''); 157 _findConstructor(symbolImplementationClass, '');
158 } 158 }
159 159
160 /// Whether [element] is the same as [symbolConstructor]. Used to check 160 /// Whether [element] is the same as [symbolConstructor]. Used to check
161 /// for the constructor without computing it until it is likely to be seen. 161 /// for the constructor without computing it until it is likely to be seen.
162 // TODO(johnniwinther): Change type of [e] to [MemberEntity]. 162 bool isSymbolConstructor(ConstructorEntity element) {
163 bool isSymbolConstructor(Entity e) { 163 return element == symbolConstructorTarget ||
164 return e == symbolConstructorTarget || 164 element == _findConstructor(symbolClass, '', required: false);
165 e == _findConstructor(symbolClass, '', required: false);
166 } 165 }
167 166
168 /// The `MirrorSystem` class in dart:mirrors. 167 /// The `MirrorSystem` class in dart:mirrors.
169 ClassEntity _mirrorSystemClass; 168 ClassEntity _mirrorSystemClass;
170 ClassEntity get mirrorSystemClass => _mirrorSystemClass ??= 169 ClassEntity get mirrorSystemClass => _mirrorSystemClass ??=
171 _findClass(mirrorsLibrary, 'MirrorSystem', required: false); 170 _findClass(mirrorsLibrary, 'MirrorSystem', required: false);
172 171
173 /// Whether [element] is `MirrorClass.getName`. Used to check for the use of 172 /// Whether [element] is `MirrorClass.getName`. Used to check for the use of
174 /// that static method without forcing the resolution of the `MirrorSystem` 173 /// that static method without forcing the resolution of the `MirrorSystem`
175 /// class until it is necessary. 174 /// class until it is necessary.
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 /// 325 ///
327 /// If no type argument is provided, the canonical raw type is returned. 326 /// If no type argument is provided, the canonical raw type is returned.
328 InterfaceType streamType([DartType elementType]) { 327 InterfaceType streamType([DartType elementType]) {
329 if (elementType == null) { 328 if (elementType == null) {
330 return _getRawType(streamClass); 329 return _getRawType(streamClass);
331 } 330 }
332 return _createInterfaceType(streamClass, [elementType]); 331 return _createInterfaceType(streamClass, [elementType]);
333 } 332 }
334 333
335 /// Returns `true` if [element] is a superclass of `String` or `num`. 334 /// Returns `true` if [element] is a superclass of `String` or `num`.
336 // TODO(johnniwinther): Change types to `ClassEntity` when these are not 335 bool isNumberOrStringSupertype(ClassEntity element) {
337 // called with unrelated elements.
338 bool isNumberOrStringSupertype(/*Class*/ Entity element) {
339 return element == _findClass(coreLibrary, 'Comparable', required: false); 336 return element == _findClass(coreLibrary, 'Comparable', required: false);
340 } 337 }
341 338
342 /// Returns `true` if [element] is a superclass of `String`. 339 /// Returns `true` if [element] is a superclass of `String`.
343 // TODO(johnniwinther): Change types to `ClassEntity` when these are not 340 bool isStringOnlySupertype(ClassEntity element) {
344 // called with unrelated elements.
345 bool isStringOnlySupertype(/*Class*/ Entity element) {
346 return element == _findClass(coreLibrary, 'Pattern', required: false); 341 return element == _findClass(coreLibrary, 'Pattern', required: false);
347 } 342 }
348 343
349 /// Returns `true` if [element] is a superclass of `List`. 344 /// Returns `true` if [element] is a superclass of `List`.
350 bool isListSupertype(ClassEntity element) => element == iterableClass; 345 bool isListSupertype(ClassEntity element) => element == iterableClass;
351 346
352 ClassEntity _findClass(LibraryEntity library, String name, 347 ClassEntity _findClass(LibraryEntity library, String name,
353 {bool required: true}) { 348 {bool required: true}) {
354 if (library == null) return null; 349 if (library == null) return null;
355 return _env.lookupClass(library, name, required: required); 350 return _env.lookupClass(library, name, required: required);
(...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after
1275 // TODO(johnniwinther): Remove this when the resolver is removed. 1270 // TODO(johnniwinther): Remove this when the resolver is removed.
1276 DartType getUnaliasedType(DartType type); 1271 DartType getUnaliasedType(DartType type);
1277 1272
1278 /// Returns `true` if [member] a the synthetic getter `loadLibrary` injected 1273 /// Returns `true` if [member] a the synthetic getter `loadLibrary` injected
1279 /// on deferred libraries. 1274 /// on deferred libraries.
1280 bool isDeferredLoadLibraryGetter(MemberEntity member); 1275 bool isDeferredLoadLibraryGetter(MemberEntity member);
1281 1276
1282 /// Returns the metadata constants declared on [member]. 1277 /// Returns the metadata constants declared on [member].
1283 Iterable<ConstantValue> getMemberMetadata(MemberEntity member); 1278 Iterable<ConstantValue> getMemberMetadata(MemberEntity member);
1284 } 1279 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_model/elements.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698