| 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 | 7 |
| 8 import '../constants/expressions.dart'; | 8 import '../constants/expressions.dart'; |
| 9 import '../tree/tree.dart'; | 9 import '../tree/tree.dart'; |
| 10 import '../util/util.dart'; | 10 import '../util/util.dart'; |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 element = closureClass.methodElement; | 483 element = closureClass.methodElement; |
| 484 } | 484 } |
| 485 Element outer = element.outermostEnclosingMemberOrTopLevel; | 485 Element outer = element.outermostEnclosingMemberOrTopLevel; |
| 486 if (isUnresolved(outer)) return true; | 486 if (isUnresolved(outer)) return true; |
| 487 if (outer.isTopLevel) return true; | 487 if (outer.isTopLevel) return true; |
| 488 if (outer.isGenerativeConstructor) return false; | 488 if (outer.isGenerativeConstructor) return false; |
| 489 if (outer.isInstanceMember) return false; | 489 if (outer.isInstanceMember) return false; |
| 490 return true; | 490 return true; |
| 491 } | 491 } |
| 492 | 492 |
| 493 static bool hasAccessToTypeVariables(Element element) { |
| 494 Element outer = element.outermostEnclosingMemberOrTopLevel; |
| 495 return (outer != null && outer.isFactoryConstructor) || |
| 496 !isInStaticContext(element); |
| 497 } |
| 498 |
| 493 static bool isStaticOrTopLevelField(Element element) { | 499 static bool isStaticOrTopLevelField(Element element) { |
| 494 return isStaticOrTopLevel(element) | 500 return isStaticOrTopLevel(element) |
| 495 && (identical(element.kind, ElementKind.FIELD) | 501 && (identical(element.kind, ElementKind.FIELD) |
| 496 || identical(element.kind, ElementKind.GETTER) | 502 || identical(element.kind, ElementKind.GETTER) |
| 497 || identical(element.kind, ElementKind.SETTER)); | 503 || identical(element.kind, ElementKind.SETTER)); |
| 498 } | 504 } |
| 499 | 505 |
| 500 static bool isStaticOrTopLevelFunction(Element element) { | 506 static bool isStaticOrTopLevelFunction(Element element) { |
| 501 return isStaticOrTopLevel(element) | 507 return isStaticOrTopLevel(element) |
| 502 && (identical(element.kind, ElementKind.FUNCTION)); | 508 && (identical(element.kind, ElementKind.FUNCTION)); |
| (...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1626 bool get isDeclaredByField; | 1632 bool get isDeclaredByField; |
| 1627 | 1633 |
| 1628 /// Returns `true` if this member is abstract. | 1634 /// Returns `true` if this member is abstract. |
| 1629 bool get isAbstract; | 1635 bool get isAbstract; |
| 1630 | 1636 |
| 1631 /// If abstract, [implementation] points to the overridden concrete member, | 1637 /// If abstract, [implementation] points to the overridden concrete member, |
| 1632 /// if any. Otherwise [implementation] points to the member itself. | 1638 /// if any. Otherwise [implementation] points to the member itself. |
| 1633 Member get implementation; | 1639 Member get implementation; |
| 1634 } | 1640 } |
| 1635 | 1641 |
| OLD | NEW |