mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:47:35 +00:00
Spreadsheet: Check for parse errors after parsing the source
There won't be any parse errors before we actually try to parse something. Fixes input like "=1+" crashing the spreadsheet instead of just causing an error in the cell.
This commit is contained in:
parent
fef165f1d2
commit
7b4fa860d2
1 changed files with 1 additions and 1 deletions
|
@ -199,10 +199,10 @@ Sheet::ValueAndException Sheet::evaluate(const StringView& source, Cell* on_beha
|
|||
ScopeGuard clear_exception { [&] { interpreter().vm().clear_exception(); } };
|
||||
|
||||
auto parser = JS::Parser(JS::Lexer(source));
|
||||
auto program = parser.parse_program();
|
||||
if (parser.has_errors() || interpreter().exception())
|
||||
return { JS::js_undefined(), interpreter().exception() };
|
||||
|
||||
auto program = parser.parse_program();
|
||||
interpreter().run(global_object(), program);
|
||||
if (interpreter().exception()) {
|
||||
auto exc = interpreter().exception();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue