| 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 475379524568806ba530b53be5ec29afa5c76ac2..27bdb64342aa9a2c21736d43d878c04459b14293 100644
|
| --- a/compiler/java/com/google/dart/compiler/resolver/CompileTimeConstantAnalyzer.java
|
| +++ b/compiler/java/com/google/dart/compiler/resolver/CompileTimeConstantAnalyzer.java
|
| @@ -13,7 +13,6 @@ import com.google.dart.compiler.InternalCompilerException;
|
| import com.google.dart.compiler.ast.ASTVisitor;
|
| import com.google.dart.compiler.ast.DartArrayLiteral;
|
| import com.google.dart.compiler.ast.DartBinaryExpression;
|
| -import com.google.dart.compiler.ast.DartBlock;
|
| import com.google.dart.compiler.ast.DartBooleanLiteral;
|
| import com.google.dart.compiler.ast.DartClass;
|
| import com.google.dart.compiler.ast.DartDeclaration;
|
| @@ -27,7 +26,6 @@ import com.google.dart.compiler.ast.DartIntegerLiteral;
|
| import com.google.dart.compiler.ast.DartInvocation;
|
| import com.google.dart.compiler.ast.DartMapLiteral;
|
| import com.google.dart.compiler.ast.DartMapLiteralEntry;
|
| -import com.google.dart.compiler.ast.DartMethodDefinition;
|
| import com.google.dart.compiler.ast.DartMethodInvocation;
|
| import com.google.dart.compiler.ast.DartNamedExpression;
|
| import com.google.dart.compiler.ast.DartNewExpression;
|
| @@ -152,7 +150,7 @@ public class CompileTimeConstantAnalyzer {
|
| */
|
| private Type getMostSpecificType(DartNode node) {
|
| if (node != null) {
|
| - Element element = (Element) node.getElement();
|
| + Element element = node.getElement();
|
| Type type = inferredTypes.get(node);
|
| if (type != null) {
|
| return type;
|
| @@ -267,7 +265,7 @@ public class CompileTimeConstantAnalyzer {
|
| rememberInferredType(x, intType);
|
| } else if (lhsType.equals(doubleType) && rhsType.equals(doubleType)) {
|
| rememberInferredType(x, doubleType);
|
| - } else if (lhsType.equals(doubleType) && rhsType.equals(intType)
|
| + } else if (lhsType.equals(doubleType) && rhsType.equals(intType)
|
| || lhsType.equals(intType) && rhsType.equals(doubleType)) {
|
| rememberInferredType(x, doubleType);
|
| } else {
|
| @@ -350,7 +348,7 @@ public class CompileTimeConstantAnalyzer {
|
| if (!element.getModifiers().isConstant() && !element.getModifiers().isFinal()) {
|
| expectedConstant(x);
|
| }
|
| -
|
| +
|
| // Infer type by visiting node or cached from Element.
|
| final Type inferredType;
|
| if (element instanceof FieldNodeElement) {
|
| @@ -359,19 +357,19 @@ public class CompileTimeConstantAnalyzer {
|
| fieldNode.accept(this);
|
| inferredType = getMostSpecificType(fieldNode);
|
| fieldNodeElement.setConstantType(inferredType);
|
| - } else if (fieldElement.getType() != null
|
| + } else if (fieldElement.getType() != null
|
| && !fieldElement.getType().equals(dynamicType)) {
|
| inferredType = fieldElement.getType();
|
| } else {
|
| inferredType = fieldElement.getConstantType();
|
| }
|
| -
|
| +
|
| // Done with this element.
|
| visitedElements.remove(element);
|
|
|
| rememberInferredType(x, inferredType);
|
| break;
|
| -
|
| +
|
| case METHOD:
|
| if (!element.getModifiers().isStatic() && !Elements.isTopLevel(element)) {
|
| expectedConstant(x);
|
|
|