-
Notifications
You must be signed in to change notification settings - Fork 164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix duplicate read when paring python asr #2541
base: main
Are you sure you want to change the base?
Conversation
What is the status of this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please address the review and mark this PR as ready for review!
Thank you
Result<LPython::AST::ast_t*> parse_python_file(Allocator &al, | ||
const std::string &runtime_library_dir, | ||
const std::string &infile, | ||
diag::Diagnostics &diagnostics, | ||
uint32_t prev_loc, | ||
[[maybe_unused]] bool new_parser) { | ||
std::string input_source_code = read_file(infile); | ||
return parse_python_source(al, runtime_library_dir, input_source_code, diagnostics, prev_loc, new_parser); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead, refactor the code to not read in parse_python_file
function in parser.cpp
.
fix issue #2475. I create
parse_python_source
to accept source code literal input to avoid additional file read.Note that there are still mutiple codes sharing the similar logic, like https://github.com/lcompilers/lpython/blob/main/src/bin/lpython.cpp#L254 . If this modification is accepted, I will fix them in this PR later.