coope/lst/ctor-factory-priv-nested-fi...

20 lines
426 B
JavaScript

function wrap( method )
{
return function()
{
var prev = this.__priv;
// expose private member object
this.__priv =
this.constructor[ _privname ];
var retval = method.apply(
this, arguments
);
// restore previous value
this.__priv = prev;
return retval;
};
}