mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 13:06:59 -04:00
Added "width= and height=" to symbols exported to html;
Added a backtrace function to the script evaluator, error messages now include a 'stack trace' of functions that were called. git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@446 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
+21
-2
@@ -116,8 +116,27 @@ ScriptValueP Context::eval(const Script& script, bool useScope) {
|
||||
stack.pop_back();
|
||||
}
|
||||
instr += i.data; // skip arguments
|
||||
// get function and call
|
||||
stack.back() = stack.back()->eval(*this);
|
||||
try {
|
||||
// get function and call
|
||||
stack.back() = stack.back()->eval(*this);
|
||||
} catch (const Error& e) {
|
||||
// try to determine what named function was called
|
||||
// the instructions for this look like:
|
||||
// I_GET_VAR name of function
|
||||
// *code* arguments
|
||||
// I_CALL number of arguments = i.data
|
||||
// I_NOP * n arg names
|
||||
// next <--- instruction pointer points here
|
||||
// skip the stack effect of the arguments themselfs
|
||||
const Instruction* instr_bt = script.backtraceSkip(instr - i.data - 2, i.data);
|
||||
// have we have reached the name
|
||||
if (instr_bt && instr_bt->instr == I_GET_VAR) {
|
||||
// this is a valid instruction, it is I_GET_VAR
|
||||
throw ScriptError(e.what() + _("\n in function: ") + variable_to_string(instr_bt->data));
|
||||
} else {
|
||||
throw e; // rethrow
|
||||
}
|
||||
}
|
||||
// restore scope
|
||||
closeScope(scope);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user