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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 Element get implementation => isPatched ? patch : this; | 224 Element get implementation => isPatched ? patch : this; |
225 | 225 |
226 /** | 226 /** |
227 * Returns the element which introduces the entity of this element. | 227 * Returns the element which introduces the entity of this element. |
228 * | 228 * |
229 * See [:patch_parser.dart:] for a description of the terminology. | 229 * See [:patch_parser.dart:] for a description of the terminology. |
230 */ | 230 */ |
231 Element get declaration => isPatch ? origin : this; | 231 Element get declaration => isPatch ? origin : this; |
232 | 232 |
233 Element get patch { | 233 Element get patch { |
234 throw new UnsupportedOperationException('patch is not supported on $this'); | 234 throw new StateError('patch is not supported on $this'); |
235 } | 235 } |
236 | 236 |
237 Element get origin { | 237 Element get origin { |
238 throw new UnsupportedOperationException('origin is not supported on $this'); | 238 throw new StateError('origin is not supported on $this'); |
239 } | 239 } |
240 | 240 |
241 // TODO(johnniwinther): This breaks for libraries (for which enclosing | 241 // TODO(johnniwinther): This breaks for libraries (for which enclosing |
242 // elements are null) and is invalid for top level variable declarations for | 242 // elements are null) and is invalid for top level variable declarations for |
243 // which the enclosing element is a VariableDeclarations and not a compilation | 243 // which the enclosing element is a VariableDeclarations and not a compilation |
244 // unit. | 244 // unit. |
245 bool isTopLevel() { | 245 bool isTopLevel() { |
246 return enclosingElement != null && enclosingElement.isCompilationUnit(); | 246 return enclosingElement != null && enclosingElement.isCompilationUnit(); |
247 } | 247 } |
248 | 248 |
(...skipping 1686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1935 | 1935 |
1936 MetadataAnnotation ensureResolved(Compiler compiler) { | 1936 MetadataAnnotation ensureResolved(Compiler compiler) { |
1937 if (resolutionState == STATE_NOT_STARTED) { | 1937 if (resolutionState == STATE_NOT_STARTED) { |
1938 compiler.resolver.resolveMetadataAnnotation(this); | 1938 compiler.resolver.resolveMetadataAnnotation(this); |
1939 } | 1939 } |
1940 return this; | 1940 return this; |
1941 } | 1941 } |
1942 | 1942 |
1943 String toString() => 'MetadataAnnotation($value, $resolutionState)'; | 1943 String toString() => 'MetadataAnnotation($value, $resolutionState)'; |
1944 } | 1944 } |
OLD | NEW |