app/assets/htmls/gobstones-code-runner.html in gobstones-code-runner-0.2.0 vs app/assets/htmls/gobstones-code-runner.html in gobstones-code-runner-0.3.0
- old
+ new
@@ -4172,25 +4172,25 @@
}, []);
}
}
run({ ast, request, throttle, callbacks }) {
- const { states, returnValue } = this._interpret(ast, request);
- this._runWithThrottle(states, returnValue, throttle, callbacks);
+ const { states, returnValue, actualReturnValue } = this._interpret(ast, request);
+ this._runWithThrottle(states, { returnValue, actualReturnValue }, throttle, callbacks);
}
clear() {
this.handles.forEach(clearInterval);
this.handles = [];
}
- _runWithThrottle(states, returnValue, throttle, { onResult, onStop, onReturnValue }) {
+ _runWithThrottle(states, { returnValue, actualReturnValue }, throttle, { onResult, onStop, onReturnValue }) {
const _onResult = (state) => onResult(state.board || state, state);
const _onEnd = () => {
onStop("end");
- onReturnValue(returnValue);
+ onReturnValue(returnValue, actualReturnValue);
}
if (throttle === 0) {
const lastState = states[states.length - 1];
_onResult(lastState);
@@ -4214,10 +4214,11 @@
_interpret(ast, { initialState, code }) {
try {
var result = this.parser.interpret(ast.program, initialState);
return {
states: this._getStates(result, ast.teacher),
- returnValue: result.returnValue
+ returnValue: result.returnValue,
+ actualReturnValue: result.actualReturnValue
};
} catch (e) {
e.location = this.parser.getErrorLineAndMode(e, code);
return {
states: this._getStates(e, ast.teacher, { error: e })
\ No newline at end of file