Index: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/resolver/ResolverVisitor.java |
diff --git a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/resolver/ResolverVisitor.java b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/resolver/ResolverVisitor.java |
index f998bcd8a84cbc2288ba3bf3cdcea85b9bb5cdbb..b1bb4729f45a427bc44793022cff23a3be13a330 100644 |
--- a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/resolver/ResolverVisitor.java |
+++ b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/resolver/ResolverVisitor.java |
@@ -912,34 +912,22 @@ public class ResolverVisitor extends ScopedVisitor { |
protected void promote(Expression expression, Type potentialType) { |
VariableElement element = getPromotionStaticElement(expression); |
if (element != null) { |
- promote(element, potentialType); |
- } |
- } |
- |
- /** |
- * If it is appropriate to do so, promotes the current type of the given element with the given |
- * type. Generally speaking, it is appropriate if the given type is more specific than the current |
- * type. |
- * |
- * @param element the element whose type might be promoted |
- * @param potentialType the potential type of the element |
- */ |
- protected void promote(VariableElement element, Type potentialType) { |
- // Declared type should not be "dynamic". |
- Type type = element.getType(); |
- if (type == null || type.isDynamic()) { |
- return; |
- } |
- // Promoted type should not be "dynamic". |
- if (potentialType == null || potentialType.isDynamic()) { |
- return; |
- } |
- // Promoted type should be more specific than declared. |
- if (!potentialType.isMoreSpecificThan(type)) { |
- return; |
+ Type type = expression.getStaticType(); |
+ // Declared type should not be "dynamic". |
+ if (type == null || type.isDynamic()) { |
+ return; |
+ } |
+ // Promoted type should not be "dynamic". |
+ if (potentialType == null || potentialType.isDynamic()) { |
+ return; |
+ } |
+ // Promoted type should be more specific than declared. |
+ if (!potentialType.isMoreSpecificThan(type)) { |
+ return; |
+ } |
+ // Do promote type of variable. |
+ promoteManager.setType(element, potentialType); |
} |
- // Do promote type of variable. |
- promoteManager.setType(element, potentialType); |
} |
/** |