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