Chromium Code Reviews| Index: pkg/analyzer/lib/src/task/strong/info.dart |
| diff --git a/pkg/analyzer/lib/src/task/strong/info.dart b/pkg/analyzer/lib/src/task/strong/info.dart |
| index 4f39f6b347fcc41ae3c8a28fd177801ee58685df..d66847c6faaa7c4739a6de315c591f05fc8622a5 100644 |
| --- a/pkg/analyzer/lib/src/task/strong/info.dart |
| +++ b/pkg/analyzer/lib/src/task/strong/info.dart |
| @@ -138,6 +138,18 @@ abstract class DownCast extends CoercionInfo { |
| } |
| } |
| + Element staticElement = null; |
| + if (expression is PropertyAccess) { |
| + staticElement = expression.propertyName.staticElement; |
| + } else if (expression is Identifier) { |
| + staticElement = expression.staticElement; |
| + } |
| + // First class functions, where we know the original declaration, will have |
| + // an exact type, so we know a downcast will fail. |
| + if (staticElement is FunctionElement) { |
|
vsm
2016/02/03 23:51:59
Does this guarantee a static or top-level function
Jennifer Messerly
2016/02/04 00:41:30
It includes top-level and local functions (named,
|
| + return new StaticTypeError(rules, expression, toT, reason: reason); |
| + } |
| + |
| // TODO(vsm): Change this to an assert when we have generic methods and |
| // fix TypeRules._coerceTo to disallow implicit sideways casts. |
| if (!rules.isSubtypeOf(toT, fromT)) { |