Index: pkg/analyzer/lib/src/task/strong/rules.dart |
diff --git a/pkg/analyzer/lib/src/task/strong/rules.dart b/pkg/analyzer/lib/src/task/strong/rules.dart |
index 32236a8aaee630c3d0584190def357676a92d62e..6503c22cdac75484430ffdea653a371f5f211a08 100644 |
--- a/pkg/analyzer/lib/src/task/strong/rules.dart |
+++ b/pkg/analyzer/lib/src/task/strong/rules.dart |
@@ -421,6 +421,7 @@ class TypeRules { |
var reason = null; |
var errors = <String>[]; |
+ |
var ok = inferrer.inferExpression(expr, toT, errors); |
if (ok) return InferredType.create(this, expr, toT); |
reason = (errors.isNotEmpty) ? errors.first : null; |
@@ -508,24 +509,11 @@ class DownwardsInference { |
/// Downward inference |
bool _inferExpression(Expression e, DartType t, List<String> errors, |
{cast: true}) { |
- if (e is ConditionalExpression) { |
- return _inferConditionalExpression(e, t, errors); |
- } |
- if (e is ParenthesizedExpression) { |
- return _inferParenthesizedExpression(e, t, errors); |
- } |
if (rules.isSubTypeOf(rules.getStaticType(e), t)) return true; |
if (cast && rules.getStaticType(e).isDynamic) { |
annotateCastFromDynamic(e, t); |
return true; |
} |
- if (e is FunctionExpression) return _inferFunctionExpression(e, t, errors); |
- if (e is ListLiteral) return _inferListLiteral(e, t, errors); |
- if (e is MapLiteral) return _inferMapLiteral(e, t, errors); |
- if (e is NamedExpression) return _inferNamedExpression(e, t, errors); |
- if (e is InstanceCreationExpression) { |
- return _inferInstanceCreationExpression(e, t, errors); |
- } |
errors.add("$e cannot be typed as $t"); |
return false; |
} |