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

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

Issue 10832136: Skeleton typedef type implementation (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased and updated cf. comments Created 8 years, 4 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: lib/compiler/implementation/elements/elements.dart
diff --git a/lib/compiler/implementation/elements/elements.dart b/lib/compiler/implementation/elements/elements.dart
index 8870678023f50765eec73cd5e53a196241a5571e..31536cde58e9e7e094262a869ad10fdd0e5cd2ea 100644
--- a/lib/compiler/implementation/elements/elements.dart
+++ b/lib/compiler/implementation/elements/elements.dart
@@ -491,21 +491,37 @@ class PrefixElement extends Element {
}
class TypedefElement extends Element implements TypeDeclarationElement {
- Type cachedType;
Typedef cachedNode;
+ TypedefType cachedType;
+ Type alias;
+
+ bool isResolved = false;
+ bool isBeingResolved = false;
TypedefElement(SourceString name, Element enclosing)
: super(name, ElementKind.TYPEDEF, enclosing);
- Type computeType(Compiler compiler) {
+ /**
+ * Function signature for a typedef of a function type. The signature is
+ * kept to provide full information about parameter names through the mirror
+ * system.
+ *
+ * The [functionSignature] is not available until the typedef element has been
+ * resolved.
+ */
+ FunctionSignature functionSignature;
+
+ TypedefType computeType(Compiler compiler) {
if (cachedType !== null) return cachedType;
- cachedType = new FunctionType(null, null, this);
- cachedType.initializeFrom(
- compiler.computeFunctionType(this, compiler.resolveTypedef(this)));
+ Typedef node = parseNode(compiler);
+ Link<Type> parameters =
+ TypeDeclarationElement.createTypeVariables(this, node.typeParameters);
+ cachedType = new TypedefType(this, parameters);
+ compiler.resolveTypedef(this);
return cachedType;
}
- Link<Type> get typeVariables() => const EmptyLink<Type>();
+ Link<Type> get typeVariables() => cachedType.typeArguments;
Scope buildScope() =>
new TypeDeclarationScope(enclosingElement.buildScope(), this);
@@ -658,7 +674,7 @@ class VariableListElement extends Element {
VariableListElement cloneTo(Element enclosing, DiagnosticListener listener) {
VariableListElement result;
if (cachedNode !== null) {
- result = new VariableListElement(cachedNode, kind, enclosing);
+ result = new VariableListElement.node(cachedNode, kind, enclosing);
} else {
result = new VariableListElement(kind, modifiers, enclosing);
}
@@ -1489,7 +1505,7 @@ class TypeVariableElement extends Element {
TypeVariableElement cloneTo(Element enclosing, DiagnosticListener listener) {
TypeVariableElement result =
- new TypeVariableElement(name, enclosing, node, type, bound);
+ new TypeVariableElement(name, enclosing, cachedNode, type, bound);
return result;
}
}
« no previous file with comments | « lib/compiler/implementation/compiler.dart ('k') | lib/compiler/implementation/js_backend/native_emitter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698