summaryrefslogtreecommitdiff
path: root/Userland/DevTools/HackStudio
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/DevTools/HackStudio')
-rw-r--r--Userland/DevTools/HackStudio/Debugger/EvaluateExpressionDialog.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/Userland/DevTools/HackStudio/Debugger/EvaluateExpressionDialog.cpp b/Userland/DevTools/HackStudio/Debugger/EvaluateExpressionDialog.cpp
index 30df8d7398..42cd2a3192 100644
--- a/Userland/DevTools/HackStudio/Debugger/EvaluateExpressionDialog.cpp
+++ b/Userland/DevTools/HackStudio/Debugger/EvaluateExpressionDialog.cpp
@@ -108,19 +108,18 @@ void EvaluateExpressionDialog::handle_evaluation(const String& expression)
m_output_container->remove_all_children();
m_output_view->update();
- auto parser = JS::Parser(JS::Lexer(expression));
- auto program = parser.parse_program();
+ auto script_or_error = JS::Script::parse(expression, m_interpreter->realm());
StringBuilder output_html;
auto result = JS::ThrowCompletionOr<JS::Value> { JS::js_undefined() };
- if (parser.has_errors()) {
- auto error = parser.errors()[0];
+ if (script_or_error.is_error()) {
+ auto error = script_or_error.error()[0];
auto hint = error.source_location_hint(expression);
if (!hint.is_empty())
output_html.append(String::formatted("<pre>{}</pre>", escape_html_entities(hint)));
result = m_interpreter->vm().throw_completion<JS::SyntaxError>(m_interpreter->global_object(), error.to_string());
} else {
- result = m_interpreter->run(m_interpreter->global_object(), *program);
+ result = m_interpreter->run(script_or_error.value());
}
if (result.is_error()) {