mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:57:44 +00:00
LibJS: Make Interpreter::run() a void function
With one small exception, this is how we've been using this API already, and it makes sense: a Program is just a ScopeNode with any number of statements, which are executed one by one. There's no explicit return value at the end, only a completion value of the last value-producing statement, which we then access using VM::last_value() if needed (e.g. in the REPL).
This commit is contained in:
parent
ef3679f9c3
commit
dadf2e8251
3 changed files with 8 additions and 8 deletions
|
@ -555,10 +555,11 @@ JS::Value Document::run_javascript(const StringView& source, const StringView& f
|
|||
return JS::js_undefined();
|
||||
}
|
||||
auto& interpreter = document().interpreter();
|
||||
auto result = interpreter.run(interpreter.global_object(), *program);
|
||||
if (interpreter.exception())
|
||||
interpreter.vm().clear_exception();
|
||||
return result;
|
||||
auto& vm = interpreter.vm();
|
||||
interpreter.run(interpreter.global_object(), *program);
|
||||
if (vm.exception())
|
||||
vm.clear_exception();
|
||||
return vm.last_value();
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-document-createelement
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue