Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Unified Diff: sdk/lib/_internal/compiler/implementation/elements/modelx.dart

Issue 27019003: Update check for cyclic typedefs. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add positive test Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/compiler/implementation/elements/modelx.dart
diff --git a/sdk/lib/_internal/compiler/implementation/elements/modelx.dart b/sdk/lib/_internal/compiler/implementation/elements/modelx.dart
index b19debaebf1397226bf66d25c385cbffaef8cae7..dacfa9a5ca063294c1d6973c69db0259bd5e7019 100644
--- a/sdk/lib/_internal/compiler/implementation/elements/modelx.dart
+++ b/sdk/lib/_internal/compiler/implementation/elements/modelx.dart
@@ -997,6 +997,9 @@ class TypedefElementX extends ElementX implements TypedefElement {
*/
DartType alias;
+ /// [:true:] if the typedef has been checked for cyclic reference.
+ bool cyclicCheck = false;
karlklose 2013/10/16 14:00:57 How about 'hasBeenCheckedForCycles'?
+
bool get isResolved => mapping != null;
// TODO(johnniwinther): Store the mapping in the resolution enqueuer instead.
@@ -1040,6 +1043,13 @@ class TypedefElementX extends ElementX implements TypedefElement {
Scope buildScope() {
return new TypeDeclarationScope(enclosingElement.buildScope(), this);
}
+
+ void checkCyclicReference(Compiler compiler) {
+ if (cyclicCheck) return;
+ var visitor = new TypedefCyclicVisitor(compiler, this);
+ computeType(compiler).accept(visitor, null);
+ cyclicCheck = true;
+ }
}
class VariableElementX extends ElementX implements VariableElement {

Powered by Google App Engine
This is Rietveld 408576698