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

Unified Diff: lib/compiler/implementation/elements/elements.dart

Issue 10628007: Resolve typedefs. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 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
« no previous file with comments | « no previous file | lib/compiler/implementation/resolver.dart » ('j') | lib/compiler/implementation/resolver.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/elements/elements.dart
diff --git a/lib/compiler/implementation/elements/elements.dart b/lib/compiler/implementation/elements/elements.dart
index 12ffc0f8d3115878728d63cd1e9dc9b764b68d1e..279e93b9f5975ed97087e44aa88a6116faf93cf9 100644
--- a/lib/compiler/implementation/elements/elements.dart
+++ b/lib/compiler/implementation/elements/elements.dart
@@ -38,7 +38,7 @@ class ElementCategory {
static final int IMPLIES_TYPE = CLASS | ALIAS | TYPE_VARIABLE;
- static final int IS_EXTENDABLE = CLASS | ALIAS;
+ static final int IS_EXTENDABLE = CLASS;
ahe 2012/06/22 08:59:11 Could you add a TODO that this will be legal when
}
class ElementKind {
@@ -186,6 +186,14 @@ class Element implements Hashable {
return null;
}
+ Element getEnclosingClassOrTypedef() {
+ for (Element e = this; e !== null; e = e.enclosingElement) {
+ if (e.kind === ElementKind.CLASS
+ || e.kind === ElementKind.TYPEDEF) return e;
+ }
+ return null;
+ }
+
Element getEnclosingMember() {
for (Element e = this; e !== null; e = e.enclosingElement) {
if (e.isMember()) return e;
@@ -375,16 +383,18 @@ class PrefixElement extends Element {
}
class TypedefElement extends Element {
+ TypedefElement(SourceString name, Element enclosing)
+ : typeParameters = new LinkedHashMap<SourceString, TypeVariableElement>(),
+ super(name, ElementKind.TYPEDEF, enclosing);
+
+ LinkedHashMap<SourceString, TypeVariableElement> typeParameters;
ahe 2012/06/22 08:59:11 I think it is overkill to have a map here. A list
+
Type cachedType;
Typedef cachedNode;
- TypedefElement(SourceString name, Element enclosing)
- : super(name, ElementKind.TYPEDEF, enclosing);
-
Type computeType(Compiler compiler) {
if (cachedType !== null) return cachedType;
- cachedType = compiler.computeFunctionType(
- this, compiler.resolveTypedef(this));
+ compiler.resolveTypedef(this);
return cachedType;
}
}
« no previous file with comments | « no previous file | lib/compiler/implementation/resolver.dart » ('j') | lib/compiler/implementation/resolver.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698