| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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.modelx; | 5 library elements.modelx; |
| 6 | 6 |
| 7 import 'elements.dart'; | 7 import 'elements.dart'; |
| 8 import '../../compiler.dart' as api; | 8 import '../../compiler.dart' as api; |
| 9 import '../tree/tree.dart'; | 9 import '../tree/tree.dart'; |
| 10 import '../util/util.dart'; | 10 import '../util/util.dart'; |
| (...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 988 * | 988 * |
| 989 * The [rawType] is computed together with [thisType] in [computeType]. | 989 * The [rawType] is computed together with [thisType] in [computeType]. |
| 990 */ | 990 */ |
| 991 TypedefType rawType; | 991 TypedefType rawType; |
| 992 | 992 |
| 993 /** | 993 /** |
| 994 * The type annotation which defines this typedef. | 994 * The type annotation which defines this typedef. |
| 995 */ | 995 */ |
| 996 DartType alias; | 996 DartType alias; |
| 997 | 997 |
| 998 /// [:true:] if the typedef has been checked for cyclic reference. |
| 999 bool hasBeenCheckedForCycles = false; |
| 1000 |
| 998 bool get isResolved => mapping != null; | 1001 bool get isResolved => mapping != null; |
| 999 | 1002 |
| 1000 // TODO(johnniwinther): Store the mapping in the resolution enqueuer instead. | 1003 // TODO(johnniwinther): Store the mapping in the resolution enqueuer instead. |
| 1001 TreeElements mapping; | 1004 TreeElements mapping; |
| 1002 | 1005 |
| 1003 TypedefElementX(SourceString name, Element enclosing) | 1006 TypedefElementX(SourceString name, Element enclosing) |
| 1004 : super(name, ElementKind.TYPEDEF, enclosing); | 1007 : super(name, ElementKind.TYPEDEF, enclosing); |
| 1005 | 1008 |
| 1006 /** | 1009 /** |
| 1007 * Function signature for a typedef of a function type. The signature is | 1010 * Function signature for a typedef of a function type. The signature is |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1031 } | 1034 } |
| 1032 compiler.resolveTypedef(this); | 1035 compiler.resolveTypedef(this); |
| 1033 return thisType; | 1036 return thisType; |
| 1034 } | 1037 } |
| 1035 | 1038 |
| 1036 Link<DartType> get typeVariables => thisType.typeArguments; | 1039 Link<DartType> get typeVariables => thisType.typeArguments; |
| 1037 | 1040 |
| 1038 Scope buildScope() { | 1041 Scope buildScope() { |
| 1039 return new TypeDeclarationScope(enclosingElement.buildScope(), this); | 1042 return new TypeDeclarationScope(enclosingElement.buildScope(), this); |
| 1040 } | 1043 } |
| 1044 |
| 1045 void checkCyclicReference(Compiler compiler) { |
| 1046 if (hasBeenCheckedForCycles) return; |
| 1047 var visitor = new TypedefCyclicVisitor(compiler, this); |
| 1048 computeType(compiler).accept(visitor, null); |
| 1049 hasBeenCheckedForCycles = true; |
| 1050 } |
| 1041 } | 1051 } |
| 1042 | 1052 |
| 1043 class VariableElementX extends ElementX implements VariableElement { | 1053 class VariableElementX extends ElementX implements VariableElement { |
| 1044 final VariableListElement variables; | 1054 final VariableListElement variables; |
| 1045 Expression cachedNode; // The send or the identifier in the variables list. | 1055 Expression cachedNode; // The send or the identifier in the variables list. |
| 1046 | 1056 |
| 1047 Modifiers get modifiers => variables.modifiers; | 1057 Modifiers get modifiers => variables.modifiers; |
| 1048 | 1058 |
| 1049 VariableElementX(SourceString name, | 1059 VariableElementX(SourceString name, |
| 1050 VariableListElement variables, | 1060 VariableListElement variables, |
| (...skipping 1276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2327 | 2337 |
| 2328 MetadataAnnotation ensureResolved(Compiler compiler) { | 2338 MetadataAnnotation ensureResolved(Compiler compiler) { |
| 2329 if (resolutionState == STATE_NOT_STARTED) { | 2339 if (resolutionState == STATE_NOT_STARTED) { |
| 2330 compiler.resolver.resolveMetadataAnnotation(this); | 2340 compiler.resolver.resolveMetadataAnnotation(this); |
| 2331 } | 2341 } |
| 2332 return this; | 2342 return this; |
| 2333 } | 2343 } |
| 2334 | 2344 |
| 2335 String toString() => 'MetadataAnnotation($value, $resolutionState)'; | 2345 String toString() => 'MetadataAnnotation($value, $resolutionState)'; |
| 2336 } | 2346 } |
| OLD | NEW |