Chromium Code Reviews| Index: lib/src/checker/resolver.dart |
| diff --git a/lib/src/checker/resolver.dart b/lib/src/checker/resolver.dart |
| index c31a1d72abf741d2bae2f38824996938a2de116d..0c3956a5e2b82006b0ec6469351911d1523bc2ae 100644 |
| --- a/lib/src/checker/resolver.dart |
| +++ b/lib/src/checker/resolver.dart |
| @@ -396,6 +396,24 @@ class RestrictedStaticTypeAnalyzer extends StaticTypeAnalyzer { |
| } |
| } |
| + @override |
| + visitConditionalExpression(ConditionalExpression node) { |
| + // TODO(vsm): This seems to be a bug in the analyzer. The static type of |
| + // a conditional should be the LUB of the then and else expressions. |
| + // The analyzer appears to compute dynamic when one or the other is the |
| + // null literal. |
|
vsm
2015/03/16 13:20:54
I think the better fix would be in getLeastUpperBo
vsm
2015/03/16 13:44:58
Bug filed at: https://code.google.com/p/dart/issue
|
| + super.visitConditionalExpression(node); |
| + if (node.staticType.isDynamic) { |
| + var thenExpr = node.thenExpression; |
| + var elseExpr = node.elseExpression; |
| + if (thenExpr.staticType.isBottom) { |
| + node.staticType = elseExpr.staticType; |
| + } else if (elseExpr.staticType.isBottom) { |
| + node.staticType = thenExpr.staticType; |
| + } |
| + } |
| + } |
| + |
| // Review note: no longer need to override visitFunctionExpression, this is |
| // handled by the analyzer internally. |
| // TODO(vsm): in visitbinaryExpression: check computeStaticReturnType result? |