Hello Paul and Johnni,
I reduced the set of situations where promotions of some private final instance variables (aka property promotions) can be "inherited" via an anonymous method. This means that only the parameterless kind are covered (as in `x.=> _y.isEven` is allowed if the type of `x._y` has been promoted to `int`, but `x.(p) => _y.isEven` is an error). This improves on the consistency: This kind of property promotion inheritance is new, and it is only supported with a new concept (namely the new kind of `this` that goes with anonymous methods), and the explicitly declared parameter is treated the same as local variables in general. This would make Leaf more happy, and perhaps others. ;-)
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Added a question to some new code in the CFE.
}Johnni, is this an appropriate way to maintain that the lessons learned during the execution of an anonymous method are available to the context?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
bool isParameterless = node.variable.isSynthesized;Move this above line 11873 and use it in line 11880.
(Also, we should an `isParameterless` property to `AnonymousMethodExpression` and use it instead of `node.variable.isSynthesized`.)
Johnni, is this an appropriate way to maintain that the lessons learned during the execution of an anonymous method are available to the context?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Small changes, to have a nicer `isParameterless`.
bool isParameterless = node.variable.isSynthesized;Move this above line 11873 and use it in line 11880.
(Also, we should an `isParameterless` property to `AnonymousMethodExpression` and use it instead of `node.variable.isSynthesized`.)
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Modify property promotion: only `this`
https://dart-review.googlesource.com/c/sdk/+/498840 added support for
promotion of properties (private, final instance variables with a name
which isn't used much for other purposes) in the context of anonymous
methods.
This CL reduces the set of situations where this feature is enabled such
that only `this` will allow property promotions to be carried in (such
that `this._x` is promoted in `v.=> this._x` when `v` is such that
`v._x` has been promoted before the anonymous method occurs). It also
generalizes the mechanism such that property promotions are carried out
(so we can do `if (v.=> _x is int) v._x.isEven;`).
Tests has been adjusted accordingly.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |