mirror of
https://github.com/RGBCube/serenity
synced 2025-05-30 21:58:10 +00:00
Shell: Skip creating a Join node when nothing was parsed
This fixes a crash when Shell tries to highlight `|`.
This commit is contained in:
parent
d86dbfe9e8
commit
b5e04cb070
1 changed files with 4 additions and 1 deletions
|
@ -123,7 +123,10 @@ RefPtr<AST::Node> Parser::parse()
|
|||
// Parsing stopped midway, this is a syntax error.
|
||||
auto error_start = push_start();
|
||||
m_offset = m_input.length();
|
||||
return create<AST::Join>(move(toplevel), create<AST::SyntaxError>("Unexpected tokens past the end"));
|
||||
auto syntax_error_node = create<AST::SyntaxError>("Unexpected tokens past the end");
|
||||
if (toplevel)
|
||||
return create<AST::Join>(move(toplevel), move(syntax_error_node));
|
||||
return syntax_error_node;
|
||||
}
|
||||
|
||||
return toplevel;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue