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

Unified Diff: compiler/java/com/google/dart/compiler/resolver/Resolver.java

Issue 8390059: https://code.google.com/p/dart/issues/detail?id=225 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/dart/
Patch Set: '' Created 9 years, 2 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 | « compiler/java/com/google/dart/compiler/DartCompilerErrorCode.java ('k') | tests/language/language.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « compiler/java/com/google/dart/compiler/DartCompilerErrorCode.java ('k') | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698