Correct Trait#__inst in ES3 environments
The previous commit's test case failed in ES3 environments. I'd amend that commit, but Savannah refuses force pushes, and I can't work around that on `master'. * lib/Trait.js (tctor): Assign `__inst' to the public visibility object rather than `vis'.master
parent
5c3b7ab042
commit
55f47a3c5a
10
lib/Trait.js
10
lib/Trait.js
|
@ -947,10 +947,16 @@ function tctor( tc, base, privsym )
|
|||
// (but not private); in return, we will use its own protected
|
||||
// visibility object to gain access to its protected members...quite
|
||||
// the intimate relationship
|
||||
this[ f ] = C( base, this[ privsym ].vis )[ privsym ].vis;
|
||||
var tinst = C( base, this[ privsym ].vis );
|
||||
this[ f ] = tinst[ privsym ].vis;
|
||||
|
||||
// TODO: this should use util.defineSecureProp
|
||||
this[ f ].__inst = this[ privsym ].inst;
|
||||
// we set __inst on the trait object itself (public visibility
|
||||
// object, which is okay, since the trait is encapsulated anyway)
|
||||
// because otherwise, in the case of an ES3 fallback, `vis' will be
|
||||
// affected by __inst defined on `base', leading to a fight over
|
||||
// ownership that I spent too much time trying to figure out
|
||||
tinst.__inst = this[ privsym ].inst;
|
||||
|
||||
// rebind trait's supertype context (if any) to our own, causing us
|
||||
// to share state
|
||||
|
|
Loading…
Reference in New Issue