summaryrefslogtreecommitdiffstats
path: root/src/scripttools/debugging/scripts/commands/return.qs
blob: 372c818d1e804ce145bca8a756c781f215249874 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
name = "return";

group = "running";

shortDescription = "Make selected stack frame return to its caller";

longDescription = "";

argumentTypes = [ "script" ];

function execute() {
    // TODO:
    // 1. schedule evaluate of the expression.
    // 2. install event handler/filter, so that we're notified when the evaluate is done.
    //    - what if another event occurs while we evaluate? (e.g. an exception or breakpoint)
    //    - the event filter needs to uninstall itself, or the event needs to be consumed internally
    // 3. in the event handler, schedule forced return with the result as argument.
    setEvaluateAction(1);
    scheduleEvaluate(getCurrentFrameIndex(), arguments[0], "console input (" + Date() + ")");
};