mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:47:44 +00:00
parent
23fc1f988f
commit
33a3f0e134
1 changed files with 8 additions and 1 deletions
|
@ -2103,7 +2103,14 @@ ErrorOr<RefPtr<AST::Node>> Parser::parse_io_file(AST::Position start_position, O
|
||||||
auto is_less = io_operator == Token::Type::LessAnd;
|
auto is_less = io_operator == Token::Type::LessAnd;
|
||||||
auto source_fd = fd.value_or(is_less ? 0 : 1);
|
auto source_fd = fd.value_or(is_less ? 0 : 1);
|
||||||
if (word->is_bareword()) {
|
if (word->is_bareword()) {
|
||||||
auto maybe_target_fd = static_ptr_cast<AST::BarewordLiteral>(word)->text().bytes_as_string_view().to_int();
|
auto text = static_ptr_cast<AST::BarewordLiteral>(word)->text();
|
||||||
|
if (!is_less && text == "-"sv) {
|
||||||
|
return make_ref_counted<AST::CloseFdRedirection>(
|
||||||
|
position,
|
||||||
|
source_fd);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto maybe_target_fd = text.bytes_as_string_view().to_int();
|
||||||
if (maybe_target_fd.has_value()) {
|
if (maybe_target_fd.has_value()) {
|
||||||
auto target_fd = maybe_target_fd.release_value();
|
auto target_fd = maybe_target_fd.release_value();
|
||||||
if (is_less)
|
if (is_less)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue