mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:18:12 +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:
parent
2d7aaab897
commit
51e598cf0b
4 changed files with 162 additions and 144 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue