DescriptionIntroduce a reusable mechanism for representing synthetic kernel objects.
We introduce a class KernelSyntheticExpression which can be used for
synthetic expressions introduced by the front end. It is used for
expressions that represent errors detected by the front end, and it is
also the base class for KernelComplexAssignment. By default, type
inference skips these synthetic expressions, inferring a type of
`dynamic`. (Note, however, that classes dervied from
KernelComplexAssignment override this behavior).
We also introduce a class KernelSyntheticStatement which behaves
similarly, but is used for statements rather than expressions,
e.g. the synthetic assignment introduced at the top of a "for" loop
whose loop variable is defined elsewhere.
Finally, we modify KernelTypeInferrer.inferFieldTopLevel() so that it
deliberatly infers `dynamic` for fields that lack an initializer.
Previously this behavior happened as a result of the hack in
KernelTypeInferrer.inferExpression which caused type inference to
infer `dynamic` for anything that didn't implement KernelExpression.
All of these changes should help pave the way for removing the
aforementioned hack.
R=scheglov@google.com
Committed: https://github.com/dart-lang/sdk/commit/e2037dc9d103dce4240106f31c9131d44a7587ce
Patch Set 1 #
Messages
Total messages: 5 (2 generated)
|