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

Unified Diff: compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java

Issue 8438042: https://code.google.com/p/dart/issues/detail?id=182 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years, 1 month 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: compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java
===================================================================
--- compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java (revision 1098)
+++ compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java (working copy)
@@ -1114,20 +1114,12 @@
@Override
public Type visitReturnStatement(DartReturnStatement node) {
DartExpression value = node.getValue();
- Type type;
if (value == null) {
if (!types.isSubtype(voidType, expected)) {
typeError(node, TypeErrorCode.MISSING_RETURN_VALUE, expected);
}
} else {
- type = typeOf(value);
- if (expected.equals(voidType)) {
- if (value != null) {
- typeError(value, TypeErrorCode.VOID_CANNOT_RETURN_VALUE);
- return voidType;
- }
- }
- checkAssignable(value == null ? node : value, expected, type);
+ checkAssignable(value == null ? node : value, expected, typeOf(value));
}
return voidType;
}

Powered by Google App Engine
This is Rietveld 408576698