-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[WIP] Introduce crystal --fake_source=sourcepath flag #4569
[WIP] Introduce crystal --fake_source=sourcepath flag #4569
Conversation
src/compiler/crystal/command.cr
Outdated
@@ -450,6 +450,9 @@ class Crystal::Command | |||
end | |||
|
|||
private def gather_sources(filenames) | |||
if ENV.has_key?("CRYSTAL_FAKE_SOURCE_FILENAME") |
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.
I'd suggest getting rid of extra ENV#[]
call, like:
if fake_source_filename = ENV["CRYSTAL_FAKE_SOURCE_FILENAME"]?
return [Compiler::Source.new(fake_source_filename, STDIN.gets_to_end)]
end
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.
just reworked as --fake-source
flag. looks cleaner.
This seems like a weird solution. I don't mind |
0926c89
to
0589534
Compare
@RX14 Yes, it is just a proposal (how to implement). Now it is Feel free to rework. |
4ef7d90
to
1bd3250
Compare
Followed with #4571 with cleaner code. |
to compile source from STDIN, closes #4561.
Synopsys
cat src/math/math.cr | ./bin/crystal build --no-codegen --no-color -o /dev/null -f json --fake-source src/math/math.cr