DescriptionConvert closures in all initializers, and share the context between them.
Summary:
Previously, we only handled `FieldInitializer` and `LocalInitializer`.
Now we handle all initializers.
Previously, we would create separate contexts for each initializers, which was
incorrect because it changes made to an argument from a closure within one
initializer would not be seen by a closure within another.
Now, we create the context in a `LocalInitializer` so all initializers will see
the same copy of the argument variables.
There is still an outstanding issue where variables introduced as local
initializers and later captured by closures in subsequent initializers are not
placed into the context. However, this will at least trigger an assert in the closure conversion pass.
Test Plan:
'closures_initializers/initializers.dart(.expect)' has been updated with very
simple test cases for super and redirecting initializers. The second bug
mentioned (captured local initializers) has not been reproduced yet.
BUG=
R=dmitryas@google.com
Committed: https://github.com/dart-lang/sdk/commit/a459f73facd32a26514e92e691eb8ab8776e3e75
Patch Set 1 #Patch Set 2 : Fix unnecessary context bug. #
Total comments: 8
Patch Set 3 : Fix test case, review comments. #Patch Set 4 : Change name of the argument extraction pass. #
Total comments: 13
Patch Set 5 : Review comments. #Messages
Total messages: 10 (4 generated)
|