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 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1129 */ | 1129 */ |
1130 // TODO(lrn): Consider using [defaultImplementation] to store the patch. | 1130 // TODO(lrn): Consider using [defaultImplementation] to store the patch. |
1131 FunctionElement patch = null; | 1131 FunctionElement patch = null; |
1132 FunctionElement origin = null; | 1132 FunctionElement origin = null; |
1133 | 1133 |
1134 /** | 1134 /** |
1135 * If this is a redirecting factory, [defaultImplementation] will be | 1135 * If this is a redirecting factory, [defaultImplementation] will be |
1136 * changed by the resolver to point to the redirection target. If | 1136 * changed by the resolver to point to the redirection target. If |
1137 * this is an interface constructor, [defaultImplementation] will be | 1137 * this is an interface constructor, [defaultImplementation] will be |
1138 * changed by the resolver to point to the default implementation. | 1138 * changed by the resolver to point to the default implementation. |
1139 * Otherwise, [:defaultImplementation === this:]. | 1139 * Otherwise, [:identical(defaultImplementation, this):]. |
1140 */ | 1140 */ |
1141 // TODO(ahe): Rename this field to redirectionTarget and remove | 1141 // TODO(ahe): Rename this field to redirectionTarget and remove |
1142 // mention of interface constructors above. | 1142 // mention of interface constructors above. |
1143 FunctionElement defaultImplementation; | 1143 FunctionElement defaultImplementation; |
1144 | 1144 |
1145 FunctionElement(SourceString name, | 1145 FunctionElement(SourceString name, |
1146 ElementKind kind, | 1146 ElementKind kind, |
1147 Modifiers modifiers, | 1147 Modifiers modifiers, |
1148 Element enclosing) | 1148 Element enclosing) |
1149 : this.tooMuchOverloading(name, null, kind, modifiers, enclosing, null); | 1149 : this.tooMuchOverloading(name, null, kind, modifiers, enclosing, null); |
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1861 return const SourceString(r'operator$sub'); | 1861 return const SourceString(r'operator$sub'); |
1862 } else if (identical(value, 'unary-')) { | 1862 } else if (identical(value, 'unary-')) { |
1863 return const SourceString(r'operator$negate'); | 1863 return const SourceString(r'operator$negate'); |
1864 } else { | 1864 } else { |
1865 return name; | 1865 return name; |
1866 } | 1866 } |
1867 } | 1867 } |
1868 | 1868 |
1869 static SourceString constructOperatorName(SourceString op, bool isUnary) { | 1869 static SourceString constructOperatorName(SourceString op, bool isUnary) { |
1870 String value = op.stringValue; | 1870 String value = op.stringValue; |
1871 if ((value === '==') || | 1871 if ((identical(value, '==')) || |
1872 (value === '~') || | 1872 (identical(value, '~')) || |
1873 (value === '[]') || | 1873 (identical(value, '[]')) || |
1874 (value === '[]=') || | 1874 (identical(value, '[]=')) || |
1875 (value === '*') || | 1875 (identical(value, '*')) || |
1876 (value === '/') || | 1876 (identical(value, '/')) || |
1877 (value === '%') || | 1877 (identical(value, '%')) || |
1878 (value === '~/') || | 1878 (identical(value, '~/')) || |
1879 (value === '+') || | 1879 (identical(value, '+')) || |
1880 (value === '<<') || | 1880 (identical(value, '<<')) || |
1881 (value === '>>>') || | 1881 (identical(value, '>>>')) || |
1882 (value === '>>') || | 1882 (identical(value, '>>')) || |
1883 (value === '>=') || | 1883 (identical(value, '>=')) || |
1884 (value === '>') || | 1884 (identical(value, '>')) || |
1885 (value === '<=') || | 1885 (identical(value, '<=')) || |
1886 (value === '<') || | 1886 (identical(value, '<')) || |
1887 (value === '&') || | 1887 (identical(value, '&')) || |
1888 (value === '^') || | 1888 (identical(value, '^')) || |
1889 (value === '|')) { | 1889 (identical(value, '|'))) { |
1890 return op; | 1890 return op; |
1891 } else if (value === '-') { | 1891 } else if (identical(value, '-')) { |
1892 return isUnary ? const SourceString('unary-') : op; | 1892 return isUnary ? const SourceString('unary-') : op; |
1893 } else { | 1893 } else { |
1894 throw 'Unhandled operator: ${op.slowToString()}'; | 1894 throw 'Unhandled operator: ${op.slowToString()}'; |
1895 } | 1895 } |
1896 } | 1896 } |
1897 | 1897 |
1898 static SourceString mapToUserOperator(SourceString op) { | 1898 static SourceString mapToUserOperator(SourceString op) { |
1899 String value = op.stringValue; | 1899 String value = op.stringValue; |
1900 | 1900 |
1901 if (identical(value, '!=')) return const SourceString('=='); | 1901 if (identical(value, '!=')) return const SourceString('=='); |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2051 | 2051 |
2052 MetadataAnnotation ensureResolved(Compiler compiler) { | 2052 MetadataAnnotation ensureResolved(Compiler compiler) { |
2053 if (resolutionState == STATE_NOT_STARTED) { | 2053 if (resolutionState == STATE_NOT_STARTED) { |
2054 compiler.resolver.resolveMetadataAnnotation(this); | 2054 compiler.resolver.resolveMetadataAnnotation(this); |
2055 } | 2055 } |
2056 return this; | 2056 return this; |
2057 } | 2057 } |
2058 | 2058 |
2059 String toString() => 'MetadataAnnotation($value, $resolutionState)'; | 2059 String toString() => 'MetadataAnnotation($value, $resolutionState)'; |
2060 } | 2060 } |
OLD | NEW |