| Index: compiler/java/com/google/dart/compiler/resolver/Resolver.java
|
| ===================================================================
|
| --- compiler/java/com/google/dart/compiler/resolver/Resolver.java (revision 771)
|
| +++ compiler/java/com/google/dart/compiler/resolver/Resolver.java (working copy)
|
| @@ -44,6 +44,7 @@
|
| import com.google.dart.compiler.ast.DartParameter;
|
| import com.google.dart.compiler.ast.DartPropertyAccess;
|
| import com.google.dart.compiler.ast.DartRedirectConstructorInvocation;
|
| +import com.google.dart.compiler.ast.DartReturnStatement;
|
| import com.google.dart.compiler.ast.DartStatement;
|
| import com.google.dart.compiler.ast.DartStringInterpolation;
|
| import com.google.dart.compiler.ast.DartStringLiteral;
|
| @@ -1115,6 +1116,21 @@
|
| }
|
|
|
| @Override
|
| + public Element visitReturnStatement(DartReturnStatement x) {
|
| + if (x.getValue() != null) {
|
| + // Dart Spec v0.03, section 11.10.
|
| + // Generative constructors cannot return arbitrary expressions in the form: 'return e;'
|
| + // they can though have return statement in the form: 'return;'
|
| + if ((currentMethod == innermostFunction)
|
| + && Elements.isNonFactoryConstructor(currentMethod)) {
|
| + resolutionError(x, DartCompilerErrorCode.INVALID_RETURN_IN_CONSTRUCTOR);
|
| + }
|
| + return x.getValue().accept(this);
|
| + }
|
| + return null;
|
| + }
|
| +
|
| + @Override
|
| public Element visitIntegerLiteral(DartIntegerLiteral node) {
|
| recordType(node, typeProvider.getIntType());
|
| return null;
|
|
|