diff --git a/Shell/Parser.cpp b/Shell/Parser.cpp index 70357de132..d7e038261a 100644 --- a/Shell/Parser.cpp +++ b/Shell/Parser.cpp @@ -123,7 +123,10 @@ RefPtr Parser::parse() // Parsing stopped midway, this is a syntax error. auto error_start = push_start(); m_offset = m_input.length(); - return create(move(toplevel), create("Unexpected tokens past the end")); + auto syntax_error_node = create("Unexpected tokens past the end"); + if (toplevel) + return create(move(toplevel), move(syntax_error_node)); + return syntax_error_node; } return toplevel;