void * buf = __qmljs_create_exception_handler(ctx);
if (setjmp(*(jmp_buf *)buf)) {
- if (QQmlJS::VM::ErrorObject *e = ctx->res.asErrorObject())
+ if (QQmlJS::VM::ErrorObject *e = ctx->engine->exception.asErrorObject())
std::cerr << "Uncaught exception: " << qPrintable(e->value.toString(ctx)->toQString()) << std::endl;
else
- std::cerr << "Uncaught exception: " << qPrintable(ctx->res.toString(ctx)->toQString()) << std::endl;
+ std::cerr << "Uncaught exception: " << qPrintable(ctx->engine->exception.toString(ctx)->toQString()) << std::endl;
return EXIT_FAILURE;
}
};
QVector<ExceptionHandler> unwindStack;
+ Value exception;
ExecutionEngine(EValISelFactory *factory);
variableEnvironment = new DeclarativeEnvironment(eng);
lexicalEnvironment = variableEnvironment;
thisObject = Value::nullValue();
- res = Value::undefinedValue();
+ eng->exception = Value::undefinedValue();
}
PropertyDescriptor *ExecutionContext::lookupPropertyDescriptor(String *name, PropertyDescriptor *tmp)
lexicalEnvironment = variableEnvironment;
thisObject = that;
- res = Value::undefinedValue();
}
void ExecutionContext::leaveCallContext()
DeclarativeEnvironment *lexicalEnvironment;
DeclarativeEnvironment *variableEnvironment;
Value thisObject;
- Value res;
void init(ExecutionEngine *eng);
context = context->parent;
}
- handler.context->res = value;
+ context->engine->exception = value;
longjmp(handler.stackFrame, 1);
}
void *__qmljs_create_exception_handler(ExecutionContext *context)
{
+ context->engine->exception = Value::undefinedValue();
context->engine->unwindStack.append(ExecutionEngine::ExceptionHandler());
ExecutionEngine::ExceptionHandler &handler = context->engine->unwindStack.last();
handler.context = context;
Value __qmljs_get_exception(ExecutionContext *context)
{
- return context->res;
+ return context->engine->exception;
}
Value __qmljs_builtin_typeof(Value val, ExecutionContext *context)