mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-03 07:07:23 +00:00
Shell: Use NonnullRefPtr to store non-null subnodes
Also replaces null-is-invalid nodes with syntax error nodes.
This commit is contained in:
committed by
Andreas Kling
parent
2d7aaab897
commit
51e598cf0b
@@ -292,7 +292,9 @@ Vector<AST::Command> Shell::expand_aliases(Vector<AST::Command> initial_commands
|
||||
auto* ast = static_cast<AST::Execute*>(subcommand_ast.ptr());
|
||||
subcommand_ast = ast->command();
|
||||
}
|
||||
RefPtr<AST::Node> substitute = adopt(*new AST::Join(subcommand_ast->position(), subcommand_ast, adopt(*new AST::CommandLiteral(subcommand_ast->position(), command))));
|
||||
NonnullRefPtr<AST::Node> substitute = adopt(*new AST::Join(subcommand_ast->position(),
|
||||
subcommand_ast.release_nonnull(),
|
||||
adopt(*new AST::CommandLiteral(subcommand_ast->position(), command))));
|
||||
for (auto& subst_command : substitute->run(*this)->resolve_as_commands(*this)) {
|
||||
if (!subst_command.argv.is_empty() && subst_command.argv.first() == argv0) // Disallow an alias resolving to itself.
|
||||
commands.append(subst_command);
|
||||
|
||||
Reference in New Issue
Block a user