Compiler: fix missing name_location
of some calls
#8192
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #8191
I think these were all the missing cases, but I'm not sure.
We have two choices:
location
ifname_location
is missing: that way we'll never know if we missed setting aname_location
somewherename_location
and crash if it's missing: bad for users, though they can still compile their code with--no-debug
, but we'll know we are missing something and we can fix itProbably 2 is better, so I didn't change anything else.
In any case, this line is smelly:
crystal/src/compiler/crystal/codegen/primitives.cr
Line 17 in d1a8e77
it's strange that we check
call.location
to determine copyingcall.name_location
. Shouldn't we check forname_location
?(though this seems to work, probably because
location
is set in more places thanname_location
)