Descriptiondart2js cps: Change how type variables are accessed in constructors.
Previously there was a problem with type variables referenced inside
a closure inside a field initializer, like so:
class Foo<T> {
var field = () => T;
}
The type variable cannot be accessed on 'this' because the closure is
created before 'this'. It also cannot be accessed as a parameter.
It is now properly treated as an unboxed free variable, and at
closure creation the value is taken from the constructor parameter
holding the type variable.
As with everything else during constructor build-up, the type variables
are now held in the IR builder's environment. It has proven to be a
robust way of doing things so far.
This simplifies the IR builder's role in this. The builder will not
detect how a type variable should be accessed (i.e. "if inside
a closure inside a field..."). If the type variable is in the
environment that's the one it will use, otherwise it defaults to
extract it from the receiver object.
Also, the closure conversion phase now detects type variables
mentioned in "on T catch()" clauses.
BUG=
R=karlklose@google.com
Committed: https://github.com/dart-lang/sdk/commit/5f97e22d8064d2e6abd93e9d4ecb1f9f2345bfc5
Patch Set 1 #
Total comments: 13
Patch Set 2 : Comments #Patch Set 3 : Moved test into non-cps section #Patch Set 4 : Rebase + status file #
Messages
Total messages: 5 (1 generated)
|