the follow code, first push joinpoint to a stack , and then remove it
so what's the reason?
// TODO: Use Object.freeze once v8 perf problem is fixed joinpoint = pushJoinpoint({ target: context, method: method, args: args, proceed: proceedCall, proceedApply: proceedApply, proceedCount: proceedCount }); try { // Call supplied around advice function return around.call(context, joinpoint); } finally { popJoinpoint(); }
var meld = require('meld');
// A simple test fixture object to advisevar o1 = { method: function(x) {}};
meld.around(o1, 'method', function(joinpoint) { // meld.joinpoint() here MUST provide the new args // This should log true console.log(meld.joinpoint().args[0] === joinpoint.args[0]);});
meld.around(o1, 'method', function(joinpoint) { // Proceed with different args return joinpoint.proceed(2);});
// Call advisedo1.method(1);