Skip to content

Commit

Permalink
[PRISM] Reset $. when done reading STDIN
Browse files Browse the repository at this point in the history
  • Loading branch information
kddnewton committed Aug 21, 2024
1 parent f604998 commit 773cf88
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions prism_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -10534,6 +10534,9 @@ pm_parse_stdin_fgets(char *string, int size, void *stream)
return string;
}

// We need access to this function when we're done parsing stdin.
void rb_reset_argf_lineno(long n);

/**
* Parse the source off STDIN and store the resulting scope node in the given
* parse result struct. It is assumed that the parse result object is zeroed
Expand All @@ -10552,6 +10555,10 @@ pm_parse_stdin(pm_parse_result_t *result)
// free the buffer itself.
pm_string_owned_init(&result->input, (uint8_t *) pm_buffer_value(&buffer), pm_buffer_length(&buffer));

// When we're done parsing, we reset $. because we don't want the fact that
// we went through an IO object to be visible to the user.
rb_reset_argf_lineno(0);

return pm_parse_process(result, node);
}

Expand Down

0 comments on commit 773cf88

Please sign in to comment.