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 elements; | 5 library elements; |
6 | 6 |
7 import '../compiler.dart' show | 7 import '../compiler.dart' show |
8 Compiler; | 8 Compiler; |
9 import '../constants/constructors.dart'; | 9 import '../constants/constructors.dart'; |
10 import '../constants/expressions.dart'; | 10 import '../constants/expressions.dart'; |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 | 293 |
294 /// Returns true if this [Element] is a top level element. | 294 /// Returns true if this [Element] is a top level element. |
295 /// That is, if it is not defined within the scope of a class. | 295 /// That is, if it is not defined within the scope of a class. |
296 /// | 296 /// |
297 /// This means whether the enclosing element is a compilation unit. | 297 /// This means whether the enclosing element is a compilation unit. |
298 /// With the exception of [ClosureClassElement] that is considered top level | 298 /// With the exception of [ClosureClassElement] that is considered top level |
299 /// as all other classes. | 299 /// as all other classes. |
300 bool get isTopLevel; | 300 bool get isTopLevel; |
301 bool get isAssignable; | 301 bool get isAssignable; |
302 bool get isNative; | 302 bool get isNative; |
| 303 bool get isJsInterop; |
303 bool get isDeferredLoaderGetter; | 304 bool get isDeferredLoaderGetter; |
304 | 305 |
305 /// True if the element is declared in a patch library but has no | 306 /// True if the element is declared in a patch library but has no |
306 /// corresponding declaration in the origin library. | 307 /// corresponding declaration in the origin library. |
307 bool get isInjected; | 308 bool get isInjected; |
308 | 309 |
309 /// `true` if this element is a constructor, top level or local variable, | 310 /// `true` if this element is a constructor, top level or local variable, |
310 /// or static field that is declared `const`. | 311 /// or static field that is declared `const`. |
311 bool get isConst; | 312 bool get isConst; |
312 | 313 |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 // it specially. | 505 // it specially. |
505 if (element.isGenerativeConstructorBody) return true; | 506 if (element.isGenerativeConstructorBody) return true; |
506 return !Elements.isUnresolved(element) && | 507 return !Elements.isUnresolved(element) && |
507 !element.isAbstract && | 508 !element.isAbstract && |
508 element.isInstanceMember && | 509 element.isInstanceMember && |
509 (element.isFunction || element.isAccessor); | 510 (element.isFunction || element.isAccessor); |
510 } | 511 } |
511 | 512 |
512 static bool isNativeOrExtendsNative(ClassElement element) { | 513 static bool isNativeOrExtendsNative(ClassElement element) { |
513 if (element == null) return false; | 514 if (element == null) return false; |
514 if (element.isNative) return true; | 515 if (element.isNative || element.isJsInterop) return true; |
515 assert(element.isResolved); | 516 assert(element.isResolved); |
516 return isNativeOrExtendsNative(element.superclass); | 517 return isNativeOrExtendsNative(element.superclass); |
517 } | 518 } |
518 | 519 |
519 static bool isInstanceSend(Send send, TreeElements elements) { | 520 static bool isInstanceSend(Send send, TreeElements elements) { |
520 Element element = elements[send]; | 521 Element element = elements[send]; |
521 if (element == null) return !isClosureSend(send, element); | 522 if (element == null) return !isClosureSend(send, element); |
522 return isInstanceMethod(element) || | 523 return isInstanceMethod(element) || |
523 isInstanceField(element) || | 524 isInstanceField(element) || |
524 (send.isConditional && !element.isStatic); | 525 (send.isConditional && !element.isStatic); |
(...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1352 | 1353 |
1353 bool get hasConstructor; | 1354 bool get hasConstructor; |
1354 Link<Element> get constructors; | 1355 Link<Element> get constructors; |
1355 | 1356 |
1356 ClassElement get patch; | 1357 ClassElement get patch; |
1357 ClassElement get origin; | 1358 ClassElement get origin; |
1358 ClassElement get declaration; | 1359 ClassElement get declaration; |
1359 ClassElement get implementation; | 1360 ClassElement get implementation; |
1360 | 1361 |
1361 String get nativeTagInfo; | 1362 String get nativeTagInfo; |
| 1363 bool get isJsInterop; |
1362 | 1364 |
1363 /// `true` if this class is an enum declaration. | 1365 /// `true` if this class is an enum declaration. |
1364 bool get isEnumClass; | 1366 bool get isEnumClass; |
1365 bool get isMixinApplication; | 1367 bool get isMixinApplication; |
1366 bool get isUnnamedMixinApplication; | 1368 bool get isUnnamedMixinApplication; |
1367 bool get hasBackendMembers; | 1369 bool get hasBackendMembers; |
1368 bool get hasLocalScopeMembers; | 1370 bool get hasLocalScopeMembers; |
1369 | 1371 |
1370 /// Returns `true` if this class is `Object` from dart:core. | 1372 /// Returns `true` if this class is `Object` from dart:core. |
1371 bool get isObject; | 1373 bool get isObject; |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1653 bool get isDeclaredByField; | 1655 bool get isDeclaredByField; |
1654 | 1656 |
1655 /// Returns `true` if this member is abstract. | 1657 /// Returns `true` if this member is abstract. |
1656 bool get isAbstract; | 1658 bool get isAbstract; |
1657 | 1659 |
1658 /// If abstract, [implementation] points to the overridden concrete member, | 1660 /// If abstract, [implementation] points to the overridden concrete member, |
1659 /// if any. Otherwise [implementation] points to the member itself. | 1661 /// if any. Otherwise [implementation] points to the member itself. |
1660 Member get implementation; | 1662 Member get implementation; |
1661 } | 1663 } |
1662 | 1664 |
OLD | NEW |