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

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

Issue 10885031: Issue 3968. Support for redirecting factory constructors (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
Index: compiler/java/com/google/dart/compiler/resolver/MemberBuilder.java
diff --git a/compiler/java/com/google/dart/compiler/resolver/MemberBuilder.java b/compiler/java/com/google/dart/compiler/resolver/MemberBuilder.java
index 7c9b55be3a3a163040f398f3933a786b0d372ebd..6f5280992e3b27e91f10e87ca12ccbf23fd5045f 100644
--- a/compiler/java/com/google/dart/compiler/resolver/MemberBuilder.java
+++ b/compiler/java/com/google/dart/compiler/resolver/MemberBuilder.java
@@ -8,8 +8,6 @@ import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Objects;
import com.google.dart.compiler.DartCompilerContext;
import com.google.dart.compiler.ErrorCode;
-import com.google.dart.compiler.PackageLibraryManager;
-import com.google.dart.compiler.Source;
import com.google.dart.compiler.ast.ASTVisitor;
import com.google.dart.compiler.ast.DartBlock;
import com.google.dart.compiler.ast.DartClass;
@@ -584,9 +582,10 @@ public class MemberBuilder {
if (modifiers.isFactory()) {
if (modifiers.isConstant()) {
- // Allow const factory ... native ... ; type of constructors, used in core libraries
+ // Allow const factory ... native ... ; type of constructors, used in core libraries.
+ // Allow const factory redirecting.
DartBlock dartBlock = method.getFunction().getBody();
- if (dartBlock == null || !(dartBlock instanceof DartNativeBlock)) {
+ if (!(dartBlock instanceof DartNativeBlock || method.getRedirectedTypeName() != null)) {
resolutionError(method.getName(), ResolverErrorCode.FACTORY_CANNOT_BE_CONST);
}
}

Powered by Google App Engine
This is Rietveld 408576698