Index: compiler/java/com/google/dart/compiler/resolver/CompileTimeConstantAnalyzer.java |
diff --git a/compiler/java/com/google/dart/compiler/resolver/CompileTimeConstantAnalyzer.java b/compiler/java/com/google/dart/compiler/resolver/CompileTimeConstantAnalyzer.java |
index 2b00c88ef7291a4d8aad98b946ce45d519bec292..6a6e2953a5273d92ff9368623963c95fbd1ab9df 100644 |
--- a/compiler/java/com/google/dart/compiler/resolver/CompileTimeConstantAnalyzer.java |
+++ b/compiler/java/com/google/dart/compiler/resolver/CompileTimeConstantAnalyzer.java |
@@ -35,6 +35,7 @@ import com.google.dart.compiler.ast.DartPropertyAccess; |
import com.google.dart.compiler.ast.DartRedirectConstructorInvocation; |
import com.google.dart.compiler.ast.DartStringInterpolation; |
import com.google.dart.compiler.ast.DartStringLiteral; |
+import com.google.dart.compiler.ast.DartSuperConstructorInvocation; |
import com.google.dart.compiler.ast.DartSuperExpression; |
import com.google.dart.compiler.ast.DartThisExpression; |
import com.google.dart.compiler.ast.DartUnaryExpression; |
@@ -428,8 +429,9 @@ public class CompileTimeConstantAnalyzer { |
@Override |
public Void visitSuperExpression(DartSuperExpression x) { |
- // No need to traverse further - super() expressions are never constant |
- expectedConstant(x); |
+ if (!x.getSymbol().getModifiers().isConstant()) { |
+ expectedConstant(x); |
+ } |
return null; |
} |
@@ -468,6 +470,12 @@ public class CompileTimeConstantAnalyzer { |
} |
@Override |
+ public Void visitSuperConstructorInvocation(DartSuperConstructorInvocation x) { |
+ x.visitChildren(this); |
+ return null; |
+ } |
+ |
+ @Override |
public Void visitUnqualifiedInvocation(DartUnqualifiedInvocation x) { |
// No need to traverse, always disallowed. |
expectedConstant(x); |
@@ -520,6 +528,18 @@ public class CompileTimeConstantAnalyzer { |
} |
return null; |
} |
+ |
+ @Override |
+ public Void visitRedirectConstructorInvocation(DartRedirectConstructorInvocation node) { |
+ // Don't evaluate now, wait until it is referenced and evaluate as part of the expression |
+ return null; |
+ } |
+ |
+ @Override |
+ public Void visitSuperConstructorInvocation(DartSuperConstructorInvocation node) { |
+ // Don't evaluate now, wait until it is referenced and evaluate as part of the expression |
+ return null; |
+ } |
} |
public static class Phase implements DartCompilationPhase { |