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

Unified Diff: frog/leg/typechecker.dart

Issue 9327001: Implement super initializers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebase and update test expectations. Created 8 years, 10 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: frog/leg/typechecker.dart
diff --git a/frog/leg/typechecker.dart b/frog/leg/typechecker.dart
index d4575baa42176dc0a8073cae854a3fe70e78dff5..6f694f1cc41776ee046f0aef94b47b7f954f2fa3 100644
--- a/frog/leg/typechecker.dart
+++ b/frog/leg/typechecker.dart
@@ -238,9 +238,19 @@ class TypeCheckerVisitor implements Visitor<Type> {
}
Type visitFunctionExpression(FunctionExpression node) {
+ Type type;
+ Type returnType;
+ Type previousType;
final FunctionElement element = elements[node];
- FunctionType functionType = computeType(element);
- Type returnType = functionType.returnType;
+ if (element.kind === ElementKind.GENERATIVE_CONSTRUCTOR ||
+ element.kind === ElementKind.GENERATIVE_CONSTRUCTOR_BODY) {
+ type = types.dynamicType;
+ returnType = types.voidType;
+ } else {
+ FunctionType functionType = computeType(element);
+ returnType = functionType.returnType;
+ type = functionType;
+ }
Type previous = expectedReturnType;
expectedReturnType = returnType;
if (element.isMember()) currentClass = element.enclosingElement;
@@ -256,7 +266,7 @@ class TypeCheckerVisitor implements Visitor<Type> {
reportTypeWarning(node.name, kind);
}
expectedReturnType = previous;
- return functionType;
+ return type;
}
Type visitIdentifier(Identifier node) {

Powered by Google App Engine
This is Rietveld 408576698