Fix #line directive to support unquoted filenames#325
Merged
Conversation
Perl allows both quoted and unquoted filenames in #line directives: - #line N "filename" (quoted - already worked) - #line N filename (unquoted bareword - now fixed) The fix adds an else clause in ErrorMessageUtil.getSourceLocationAccurate() to also handle IDENTIFIER tokens as unquoted filenames. This fixes Moo croak-locations.t: 29 failures -> 3 failures. The remaining 3 are complex nested eval cases related to Carp stack walking. Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <noreply@cognition.ai>
Problem: caller() was returning empty/wrong package for subroutine stack frames because saveSourceLocation() was only called during parsing, when subroutines don't yet have their own class context. Solution: Modified setDebugInfoLineNumber() to also call saveSourceLocation() during bytecode emission. This ensures source locations are saved with the correct package context from the subroutine's symbol table. - ByteCodeSourceMapper.java: Added saveSourceLocation() call to setDebugInfoLineNumber() - Added dev/design/caller_package_context.md with detailed analysis - Updated dev/design/moo_support.md with Phase 28 entry Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <noreply@cognition.ai>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
#linedirectives:#line N "filename"(quoted - already worked)#line N filename(unquoted bareword - now fixed)ErrorMessageUtil.getSourceLocationAccurate()Impact
Test Plan
make)Generated with Devin