1
0
Fork 0

Current __self -> __inst; __self will be used in a different manner in following commits

closure/master
Mike Gerwitz 2011-04-03 11:57:15 -04:00
parent 1abf127ccc
commit dddd26761c
2 changed files with 7 additions and 7 deletions

View File

@ -525,11 +525,11 @@ function attachPropInit( prototype, properties, members, cid )
// provide a means to access the actual instance (rather than the
// property/visibility object) internally (this will translate to
// this.__self from within a method), but only if we're on our final
// this.__inst from within a method), but only if we're on our final
// object (not a parent)
if ( typeof parent_init !== 'function' )
{
util.defineSecureProp( vis, '__self', this );
util.defineSecureProp( vis, '__inst', this );
}
});
}

View File

@ -38,7 +38,7 @@ var common = require( './common' ),
* Unfortunately, there's really no way around that. Maybe a more elegant
* solution will arise in the future. For now, not likely.
*
* We need to provide a means to reference the actual instance. __self is that
* We need to provide a means to reference the actual instance. __inst is that
* solution.
*/
( function testSelfPropertyReferencesInstanceRatherThanPropObj()
@ -51,22 +51,22 @@ var common = require( './common' ),
{
// rather than returning, assign to external var so that we can
// rest assured that the return value wasn't manipulated
result = this.__self;
result = this.__inst;
ref = this;
}
} )();
assert.deepEqual( result, foo,
"this.__self returns reference to actual instance"
"this.__inst returns reference to actual instance"
);
// the property should be read-only
if ( util.definePropertyFallback() === false )
{
assert.equal(
Object.getOwnPropertyDescriptor( ref, '__self' ).writable,
Object.getOwnPropertyDescriptor( ref, '__inst' ).writable,
false,
"this.__self is not writable"
"this.__inst is not writable"
);
}
} )();