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 01dc5707385cb7b796a6e953e8bced1569a4e765..b5944249c990aeaf766f8a38208e33bf438a8f15 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; |
| } |
| class ElementKind { |
| @@ -198,6 +198,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; |
|
ahe
2012/07/30 10:30:05
I'd prefer if you keep the condition on the same l
Johnni Winther
2012/08/01 10:12:28
Removed.
|
| + } |
| + return null; |
| + } |
| + |
| Element getEnclosingMember() { |
| for (Element e = this; e !== null; e = e.enclosingElement) { |
| if (e.isMember()) return e; |
| @@ -419,16 +427,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/07/30 10:30:05
I don't think this should be a map. The overhead o
Johnni Winther
2012/08/01 10:12:28
Done.
|
| + |
| 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); |
|
ahe
2012/07/30 10:30:05
This method may be called twice. You need to ensur
Johnni Winther
2012/08/01 10:12:28
Done.
|
| return cachedType; |
| } |
| } |