Chromium Code Reviews
DescriptionPopulate TypeInferrerImpl.closureContext more frequently.
Previously, we only used a ClosureContext in the case where the
innermost function being inferred was a function expression. This
meant that we couldn't use the declared return type as the context for
`return` or `yield` statements in any other sort of function. As a
first step towards fixing that, this CL makes the following changes:
- The entry point to type inference is now a separate
TypeInferrer.inferFunctionBody method rather than re-using
TypeInferrer.inferStatement; this gives us an opportunity to set up
the context.
- Some of the logic from KernelFunctionExpression._inferExpression
(particularly to do with asynchronous and generator functions) is
moved to ClosureContext so that it can be used for other sorts of
functions.
- The only time TypeInferrerImpl.closureContext is ever `null` is now
when inferring a top level or field initializer expression, so we
can eliminate some null checks from
KernelReturnStatement._inferStatement and
KernelYieldStatement._inferStatement.
R=scheglov@google.com
Committed: https://github.com/dart-lang/sdk/commit/0d31c8c524d73a2265df23113d77204fbe0370aa
Patch Set 1 #
Messages
Total messages: 5 (2 generated)
|
|||||||||||||||||||||||||||||||||||||