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 1839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1850 return isLocal(element); | 1850 return isLocal(element); |
1851 } | 1851 } |
1852 | 1852 |
1853 static SourceString constructConstructorName(SourceString receiver, | 1853 static SourceString constructConstructorName(SourceString receiver, |
1854 SourceString selector) { | 1854 SourceString selector) { |
1855 String r = receiver.slowToString(); | 1855 String r = receiver.slowToString(); |
1856 String s = selector.slowToString(); | 1856 String s = selector.slowToString(); |
1857 return new SourceString('$r\$$s'); | 1857 return new SourceString('$r\$$s'); |
1858 } | 1858 } |
1859 | 1859 |
| 1860 static SourceString deconstructConstructorName(SourceString name, |
| 1861 ClassElement holder) { |
| 1862 String r = '${holder.name.slowToString()}\$'; |
| 1863 String s = name.slowToString(); |
| 1864 if (s.startsWith(r)) { |
| 1865 return new SourceString(s.substring(r.length)); |
| 1866 } |
| 1867 return null; |
| 1868 } |
| 1869 |
1860 /** | 1870 /** |
1861 * Map an operator-name to a valid Dart identifier. | 1871 * Map an operator-name to a valid Dart identifier. |
1862 * | 1872 * |
1863 * For non-operator names, this metod just returns its input. | 1873 * For non-operator names, this metod just returns its input. |
1864 * | 1874 * |
1865 * The results returned from this method are guaranteed to be valid | 1875 * The results returned from this method are guaranteed to be valid |
1866 * JavaScript identifers, except it may include reserved words for | 1876 * JavaScript identifers, except it may include reserved words for |
1867 * non-operator names. | 1877 * non-operator names. |
1868 */ | 1878 */ |
1869 static SourceString operatorNameToIdentifier(SourceString name) { | 1879 static SourceString operatorNameToIdentifier(SourceString name) { |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2114 | 2124 |
2115 MetadataAnnotation ensureResolved(Compiler compiler) { | 2125 MetadataAnnotation ensureResolved(Compiler compiler) { |
2116 if (resolutionState == STATE_NOT_STARTED) { | 2126 if (resolutionState == STATE_NOT_STARTED) { |
2117 compiler.resolver.resolveMetadataAnnotation(this); | 2127 compiler.resolver.resolveMetadataAnnotation(this); |
2118 } | 2128 } |
2119 return this; | 2129 return this; |
2120 } | 2130 } |
2121 | 2131 |
2122 String toString() => 'MetadataAnnotation($value, $resolutionState)'; | 2132 String toString() => 'MetadataAnnotation($value, $resolutionState)'; |
2123 } | 2133 } |
OLD | NEW |