Verified Commit 186a9a61 authored by Camil Staps's avatar Camil Staps 🙂

Cleanup abc-interpreter.js; reduce trace length; add last_error

parent 8fd39cfb
Pipeline #43798 passed with stages
in 11 minutes and 35 seconds
"use strict";
var ABC_DEBUG=false;
var ABC_TRACE_LENGTH=50;
var ABC_TRACE_LENGTH=20;
class ABCError extends Error {
constructor(desc,arg) {
......@@ -218,8 +218,7 @@ class ABCInterpreter {
ABC=old_ABC;
}
if (typeof result!='undefined')
return result;
return result;
};
f.shared_clean_value_index=index;
return f;
......@@ -756,12 +755,19 @@ class ABCInterpreter {
const old_ABC=ABC;
try {
ABC=me;
me.last_error=null;
me.interpreter.instance.exports.interpret();
ABC=old_ABC;
me.interpreter.instance.exports.set_pc(old_pc);
me.interpreter.instance.exports.set_asp(old_asp);
} catch (e) {
me.last_error=e;
ABC=old_ABC;
me.interpreter.instance.exports.set_pc(old_pc);
me.interpreter.instance.exports.set_asp(old_asp);
if (e.constructor.name!='ABCError' &&
(e.fileName!='abc-interpreter.js' || e.lineNumber>700))
(e.fileName!='abc-interpreter.js' || e.lineNumber>1000))
throw e;
var trace=[e.message, '\n'].concat(me.get_trace());
......@@ -769,9 +775,6 @@ class ABCInterpreter {
throw e.toString();
}
me.interpreter.instance.exports.set_pc(old_pc);
me.interpreter.instance.exports.set_asp(old_asp);
};
return me;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment