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

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: Updated cf. comments. 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 fccf1bff5dd05c409fdc765f129c7d63055dc9c1..c2234a4dc64fb57220a86198da320826ab9d5af0 100644
--- a/sdk/lib/_internal/compiler/implementation/elements/modelx.dart
+++ b/sdk/lib/_internal/compiler/implementation/elements/modelx.dart
@@ -995,6 +995,9 @@ class TypedefElementX extends ElementX implements TypedefElement {
*/
DartType alias;
+ /// [:true:] if the typedef has been checked for cyclic reference.
+ bool hasBeenCheckedForCycles = false;
+
bool get isResolved => mapping != null;
// TODO(johnniwinther): Store the mapping in the resolution enqueuer instead.
@@ -1038,6 +1041,13 @@ class TypedefElementX extends ElementX implements TypedefElement {
Scope buildScope() {
return new TypeDeclarationScope(enclosingElement.buildScope(), this);
}
+
+ void checkCyclicReference(Compiler compiler) {
+ if (hasBeenCheckedForCycles) return;
+ var visitor = new TypedefCyclicVisitor(compiler, this);
+ computeType(compiler).accept(visitor, null);
+ hasBeenCheckedForCycles = true;
+ }
}
class VariableElementX extends ElementX implements VariableElement {

Powered by Google App Engine
This is Rietveld 408576698