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('dart:uri'); | 7 #import('dart:uri'); |
8 | 8 |
9 #import('../tree/tree.dart'); | 9 #import('../tree/tree.dart'); |
10 #import('../scanner/scannerlib.dart'); | 10 #import('../scanner/scannerlib.dart'); |
(...skipping 1632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1643 && (element.kind === ElementKind.FUNCTION); | 1643 && (element.kind === ElementKind.FUNCTION); |
1644 } | 1644 } |
1645 | 1645 |
1646 static bool isInstanceSend(Send send, TreeElements elements) { | 1646 static bool isInstanceSend(Send send, TreeElements elements) { |
1647 Element element = elements[send]; | 1647 Element element = elements[send]; |
1648 if (element === null) return !isClosureSend(send, element); | 1648 if (element === null) return !isClosureSend(send, element); |
1649 return isInstanceMethod(element) || isInstanceField(element); | 1649 return isInstanceMethod(element) || isInstanceField(element); |
1650 } | 1650 } |
1651 | 1651 |
1652 static bool isClosureSend(Send send, Element element) { | 1652 static bool isClosureSend(Send send, Element element) { |
1653 if (send.isPropertyAccess) return false; | 1653 if (send.isPropertyAccessOrTypeReference) return false; |
1654 if (send.receiver !== null) return false; | 1654 if (send.receiver !== null) return false; |
1655 // (o)() or foo()(). | 1655 // (o)() or foo()(). |
1656 if (element === null && send.selector.asIdentifier() === null) return true; | 1656 if (element === null && send.selector.asIdentifier() === null) return true; |
1657 if (element === null) return false; | 1657 if (element === null) return false; |
1658 // foo() with foo a local or a parameter. | 1658 // foo() with foo a local or a parameter. |
1659 return isLocal(element); | 1659 return isLocal(element); |
1660 } | 1660 } |
1661 | 1661 |
1662 static SourceString constructConstructorName(SourceString receiver, | 1662 static SourceString constructConstructorName(SourceString receiver, |
1663 SourceString selector) { | 1663 SourceString selector) { |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1873 | 1873 |
1874 MetadataAnnotation ensureResolved(Compiler compiler) { | 1874 MetadataAnnotation ensureResolved(Compiler compiler) { |
1875 if (resolutionState == STATE_NOT_STARTED) { | 1875 if (resolutionState == STATE_NOT_STARTED) { |
1876 compiler.resolver.resolveMetadataAnnotation(this); | 1876 compiler.resolver.resolveMetadataAnnotation(this); |
1877 } | 1877 } |
1878 return this; | 1878 return this; |
1879 } | 1879 } |
1880 | 1880 |
1881 String toString() => 'MetadataAnnotation($value, $resolutionState)'; | 1881 String toString() => 'MetadataAnnotation($value, $resolutionState)'; |
1882 } | 1882 } |
OLD | NEW |