Chromium Code Reviews| 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; |
| } |
| } |