| 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 // TODO(ahe): Rename prefix to 'api' when VM bug is fixed. | 9 // TODO(ahe): Rename prefix to 'api' when VM bug is fixed. |
| 10 import '../../compiler.dart' as api_e; | 10 import '../../compiler.dart' as api_e; |
| (...skipping 1849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1860 static bool isClosureSend(Send send, Element element) { | 1860 static bool isClosureSend(Send send, Element element) { |
| 1861 if (send.isPropertyAccess) return false; | 1861 if (send.isPropertyAccess) return false; |
| 1862 if (send.receiver != null) return false; | 1862 if (send.receiver != null) return false; |
| 1863 // (o)() or foo()(). | 1863 // (o)() or foo()(). |
| 1864 if (element == null && send.selector.asIdentifier() == null) return true; | 1864 if (element == null && send.selector.asIdentifier() == null) return true; |
| 1865 if (element == null) return false; | 1865 if (element == null) return false; |
| 1866 // foo() with foo a local or a parameter. | 1866 // foo() with foo a local or a parameter. |
| 1867 return isLocal(element); | 1867 return isLocal(element); |
| 1868 } | 1868 } |
| 1869 | 1869 |
| 1870 /** | |
| 1871 * Returns [:true:] if [element] represents an entity that can be used as the | |
| 1872 * left-hand side of an assignment. For example a non-final field, a setter, | |
| 1873 * or an abstract field with a setter. | |
| 1874 */ | |
| 1875 static bool isAssignable(Element element) { | |
| 1876 if (element == null) return false; | |
| 1877 if (element.isField()) { | |
| 1878 return !element.modifiers.isFinalOrConst(); | |
| 1879 } else if (element.isAbstractField()) { | |
| 1880 AbstractFieldElement abstractFieldElement = element; | |
| 1881 return abstractFieldElement.setter != null; | |
| 1882 } else if (element.isSetter()) { | |
| 1883 return true; | |
| 1884 } | |
| 1885 return false; | |
| 1886 } | |
| 1887 | |
| 1888 | |
| 1889 static SourceString constructConstructorName(SourceString receiver, | 1870 static SourceString constructConstructorName(SourceString receiver, |
| 1890 SourceString selector) { | 1871 SourceString selector) { |
| 1891 String r = receiver.slowToString(); | 1872 String r = receiver.slowToString(); |
| 1892 String s = selector.slowToString(); | 1873 String s = selector.slowToString(); |
| 1893 return new SourceString('$r\$$s'); | 1874 return new SourceString('$r\$$s'); |
| 1894 } | 1875 } |
| 1895 | 1876 |
| 1896 static SourceString deconstructConstructorName(SourceString name, | 1877 static SourceString deconstructConstructorName(SourceString name, |
| 1897 ClassElement holder) { | 1878 ClassElement holder) { |
| 1898 String r = '${holder.name.slowToString()}\$'; | 1879 String r = '${holder.name.slowToString()}\$'; |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2184 | 2165 |
| 2185 MetadataAnnotation ensureResolved(Compiler compiler) { | 2166 MetadataAnnotation ensureResolved(Compiler compiler) { |
| 2186 if (resolutionState == STATE_NOT_STARTED) { | 2167 if (resolutionState == STATE_NOT_STARTED) { |
| 2187 compiler.resolver.resolveMetadataAnnotation(this); | 2168 compiler.resolver.resolveMetadataAnnotation(this); |
| 2188 } | 2169 } |
| 2189 return this; | 2170 return this; |
| 2190 } | 2171 } |
| 2191 | 2172 |
| 2192 String toString() => 'MetadataAnnotation($value, $resolutionState)'; | 2173 String toString() => 'MetadataAnnotation($value, $resolutionState)'; |
| 2193 } | 2174 } |
| OLD | NEW |