| 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 '../common.dart'; | 7 import '../common.dart'; |
| 8 import '../common/resolution.dart' show Resolution; | 8 import '../common/resolution.dart' show Resolution; |
| 9 import '../compiler.dart' show Compiler; | 9 import '../compiler.dart' show Compiler; |
| 10 import '../constants/constructors.dart'; | 10 import '../constants/constructors.dart'; |
| 11 import '../constants/expressions.dart'; | 11 import '../constants/expressions.dart'; |
| 12 import '../core_types.dart' show CoreClasses, CommonElements; | 12 import '../core_types.dart' show CommonElements; |
| 13 import '../dart_types.dart'; | 13 import '../dart_types.dart'; |
| 14 import '../ordered_typeset.dart' show OrderedTypeSet; | 14 import '../ordered_typeset.dart' show OrderedTypeSet; |
| 15 import '../resolution/scope.dart' show Scope; | 15 import '../resolution/scope.dart' show Scope; |
| 16 import '../resolution/tree_elements.dart' show TreeElements; | 16 import '../resolution/tree_elements.dart' show TreeElements; |
| 17 import '../script.dart'; | 17 import '../script.dart'; |
| 18 import '../tokens/token.dart' | 18 import '../tokens/token.dart' |
| 19 show Token, isUserDefinableOperator, isMinusOperator; | 19 show Token, isUserDefinableOperator, isMinusOperator; |
| 20 import '../tree/tree.dart'; | 20 import '../tree/tree.dart'; |
| 21 import '../util/characters.dart' show $_; | 21 import '../util/characters.dart' show $_; |
| 22 import '../util/util.dart'; | 22 import '../util/util.dart'; |
| (...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 800 Element element, ClosedWorld closedWorld) { | 800 Element element, ClosedWorld closedWorld) { |
| 801 if (closedWorld.commonElements.typedDataLibrary == null) return false; | 801 if (closedWorld.commonElements.typedDataLibrary == null) return false; |
| 802 if (!element.isConstructor) return false; | 802 if (!element.isConstructor) return false; |
| 803 ConstructorElement constructor = element.implementation; | 803 ConstructorElement constructor = element.implementation; |
| 804 constructor = constructor.effectiveTarget; | 804 constructor = constructor.effectiveTarget; |
| 805 ClassElement cls = constructor.enclosingClass; | 805 ClassElement cls = constructor.enclosingClass; |
| 806 return cls.library == closedWorld.commonElements.typedDataLibrary && | 806 return cls.library == closedWorld.commonElements.typedDataLibrary && |
| 807 closedWorld.backendClasses.isNative(cls) && | 807 closedWorld.backendClasses.isNative(cls) && |
| 808 closedWorld.isSubtypeOf( | 808 closedWorld.isSubtypeOf( |
| 809 cls, closedWorld.commonElements.typedDataClass) && | 809 cls, closedWorld.commonElements.typedDataClass) && |
| 810 closedWorld.isSubtypeOf(cls, closedWorld.coreClasses.listClass) && | 810 closedWorld.isSubtypeOf(cls, closedWorld.commonElements.listClass) && |
| 811 constructor.name == ''; | 811 constructor.name == ''; |
| 812 } | 812 } |
| 813 | 813 |
| 814 static bool switchStatementHasContinue( | 814 static bool switchStatementHasContinue( |
| 815 SwitchStatement node, TreeElements elements) { | 815 SwitchStatement node, TreeElements elements) { |
| 816 for (SwitchCase switchCase in node.cases) { | 816 for (SwitchCase switchCase in node.cases) { |
| 817 for (Node labelOrCase in switchCase.labelsAndCases) { | 817 for (Node labelOrCase in switchCase.labelsAndCases) { |
| 818 Node label = labelOrCase.asLabel(); | 818 Node label = labelOrCase.asLabel(); |
| 819 if (label != null) { | 819 if (label != null) { |
| 820 LabelDefinition labelElement = elements.getLabelDefinition(label); | 820 LabelDefinition labelElement = elements.getLabelDefinition(label); |
| (...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1537 bool get isUnnamedMixinApplication; | 1537 bool get isUnnamedMixinApplication; |
| 1538 | 1538 |
| 1539 bool get hasBackendMembers; | 1539 bool get hasBackendMembers; |
| 1540 bool get hasLocalScopeMembers; | 1540 bool get hasLocalScopeMembers; |
| 1541 | 1541 |
| 1542 /// Returns `true` if this class is `Object` from dart:core. | 1542 /// Returns `true` if this class is `Object` from dart:core. |
| 1543 bool get isObject; | 1543 bool get isObject; |
| 1544 | 1544 |
| 1545 /// Returns `true` if this class implements [Function] either by directly | 1545 /// Returns `true` if this class implements [Function] either by directly |
| 1546 /// implementing the interface or by providing a [call] method. | 1546 /// implementing the interface or by providing a [call] method. |
| 1547 bool implementsFunction(CoreClasses coreClasses); | 1547 bool implementsFunction(CommonElements commonElements); |
| 1548 | 1548 |
| 1549 /// Returns `true` if this class extends [cls] directly or indirectly. | 1549 /// Returns `true` if this class extends [cls] directly or indirectly. |
| 1550 /// | 1550 /// |
| 1551 /// This method is not to be used for checking type hierarchy and assignments, | 1551 /// This method is not to be used for checking type hierarchy and assignments, |
| 1552 /// because it does not take parameterized types into account. | 1552 /// because it does not take parameterized types into account. |
| 1553 bool isSubclassOf(ClassElement cls); | 1553 bool isSubclassOf(ClassElement cls); |
| 1554 | 1554 |
| 1555 /// Returns `true` if this class explicitly implements [intrface]. | 1555 /// Returns `true` if this class explicitly implements [intrface]. |
| 1556 /// | 1556 /// |
| 1557 /// Note that, if [intrface] is the `Function` class, this method returns | 1557 /// Note that, if [intrface] is the `Function` class, this method returns |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1934 /// by a field. | 1934 /// by a field. |
| 1935 bool get isDeclaredByField; | 1935 bool get isDeclaredByField; |
| 1936 | 1936 |
| 1937 /// Returns `true` if this member is abstract. | 1937 /// Returns `true` if this member is abstract. |
| 1938 bool get isAbstract; | 1938 bool get isAbstract; |
| 1939 | 1939 |
| 1940 /// If abstract, [implementation] points to the overridden concrete member, | 1940 /// If abstract, [implementation] points to the overridden concrete member, |
| 1941 /// if any. Otherwise [implementation] points to the member itself. | 1941 /// if any. Otherwise [implementation] points to the member itself. |
| 1942 Member get implementation; | 1942 Member get implementation; |
| 1943 } | 1943 } |
| OLD | NEW |