D
d d
Hi, I don't think this is possible but it's worth asking.
Is there any way a function can change the property of a variable
in the caller function? Here's a simplified example of what I have:
function mainfunc(){
var myvar = unchangeable_broken_func();
var myvar2 = childfunc2(); //I CAN change this one
...
}
function childfunc2(){
return something_for_myvar2;
}
You see that mainfunc's myvar is being set by the broken function. The
problem is that it's setting it wrongly in a unique situation. Due to QA
resources and schedules, there's no way I can change mainfunc or
unchangeable_broken_func.
I can, however, do things in childfunc2. That's a special customer
optional function. For a specific customer, for a short-term fix, I'd
like to add some code into childfunc2 that basically works around the
bad logic in the broken func.
In visual studio I've seen that this code in childfunc2 works:
childfunc2.caller; //this gives a handle to mainfunc
childfunc2.caller.toString(); //shows the code of mainfunc
I'm looking for a possible syntax that would allow me to change the
mainfunc's myvar variable from childfunc2. Then I can add some logic to
childfunc2 that looks for the unique circumstance that makes the broken
function go wrong and I can auto-correct myvar.
Possible ?
~dd
Is there any way a function can change the property of a variable
in the caller function? Here's a simplified example of what I have:
function mainfunc(){
var myvar = unchangeable_broken_func();
var myvar2 = childfunc2(); //I CAN change this one
...
}
function childfunc2(){
return something_for_myvar2;
}
You see that mainfunc's myvar is being set by the broken function. The
problem is that it's setting it wrongly in a unique situation. Due to QA
resources and schedules, there's no way I can change mainfunc or
unchangeable_broken_func.
I can, however, do things in childfunc2. That's a special customer
optional function. For a specific customer, for a short-term fix, I'd
like to add some code into childfunc2 that basically works around the
bad logic in the broken func.
In visual studio I've seen that this code in childfunc2 works:
childfunc2.caller; //this gives a handle to mainfunc
childfunc2.caller.toString(); //shows the code of mainfunc
I'm looking for a possible syntax that would allow me to change the
mainfunc's myvar variable from childfunc2. Then I can add some logic to
childfunc2 that looks for the unique circumstance that makes the broken
function go wrong and I can auto-correct myvar.
Possible ?
~dd