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

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

Issue 10829168: Revert "Skeleton typedef type implementation" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
« no previous file with comments | « lib/compiler/implementation/elements/elements.dart ('k') | lib/compiler/implementation/typechecker.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/resolver.dart
diff --git a/lib/compiler/implementation/resolver.dart b/lib/compiler/implementation/resolver.dart
index d0f65affe054f3c3845d1b1319c6087bb945d918..246a546edf7ae8b40d13e80b57ae7a63b3775156 100644
--- a/lib/compiler/implementation/resolver.dart
+++ b/lib/compiler/implementation/resolver.dart
@@ -344,15 +344,12 @@ class ResolverTask extends CompilerTask {
compiler, node.parameters, node.returnType, element));
}
- void resolveTypedef(TypedefElement element) {
+ FunctionSignature resolveTypedef(TypedefElement element) {
return compiler.withCurrentElement(element, () {
- measure(() {
- Typedef node =
+ Typedef node =
compiler.parser.measure(() => element.parseNode(compiler));
- TypedefResolverVisitor visitor =
- new TypedefResolverVisitor(compiler, element);
- visitor.visit(node);
- });
+ return measure(() => SignatureResolver.analyze(
+ compiler, node.formals, node.returnType, element));
});
}
@@ -772,9 +769,7 @@ class TypeResolver {
type = element.computeType(compiler);
} else if (element.isClass()) {
ClassElement cls = element;
- // TODO(ahe): Should be [ensureResolved].
- compiler.resolver.toResolve.add(cls);
- cls.computeType(compiler);
+ if (!cls.isResolved) compiler.resolveClass(cls);
Link<Type> arguments =
resolveTypeArguments(node, cls.typeVariables, scope,
onFailure, whenResolved);
@@ -785,18 +780,7 @@ class TypeResolver {
type = new InterfaceType(cls, arguments);
}
} else if (element.isTypedef()) {
- TypedefElement typdef = element;
- // TODO(ahe): Should be [ensureResolved].
- typdef.computeType(compiler);
- Link<Type> arguments = resolveTypeArguments(
- node, typdef.typeVariables,
- scope, onFailure, whenResolved);
- if (typdef.typeVariables.isEmpty() && arguments.isEmpty()) {
- // Return the canonical type if it has no type parameters.
- type = typdef.computeType(compiler);
- } else {
- type = new TypedefType(typdef, arguments);
- }
+ type = element.computeType(compiler);
} else if (element.isTypeVariable()) {
type = element.computeType(compiler);
} else {
@@ -1725,34 +1709,13 @@ class TypeDefinitionVisitor extends CommonResolverVisitor<Type> {
}
}
-class TypedefResolverVisitor extends TypeDefinitionVisitor {
- TypedefElement get element() => super.element;
-
- TypedefResolverVisitor(Compiler compiler, TypedefElement typedefElement)
- : super(compiler, typedefElement);
-
- visitTypedef(Typedef node) {
- TypedefType type = element.computeType(compiler);
- scope = new TypeDeclarationScope(scope, element);
- resolveTypeVariableBounds(node.typeParameters);
-
- element.functionSignature = SignatureResolver.analyze(
- compiler, node.formals, node.returnType, element);
-
- element.alias = compiler.computeFunctionType(
- element, element.functionSignature);
-
- // TODO(johnniwinther): Check for cyclic references in the typedef alias.
- }
-}
-
class ClassResolverVisitor extends TypeDefinitionVisitor {
ClassElement get element() => super.element;
ClassResolverVisitor(Compiler compiler, ClassElement classElement)
: super(compiler, classElement);
- visitClassNode(ClassNode node) {
+ Type visitClassNode(ClassNode node) {
compiler.ensure(element !== null);
compiler.ensure(!element.isResolved);
« no previous file with comments | « lib/compiler/implementation/elements/elements.dart ('k') | lib/compiler/implementation/typechecker.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698