Commit 86baa2f
fix: bare
When `split` was called without an explicit string argument (e.g., bare
`split` or `split /PAT/`), it relied on the runtime fallback to
getGlobalVariable("main::_"). This worked in JVM-compiled code but failed
in bytecode-interpreted code (eval'd strings because the bytecode compiler
compiled the empty argument list in scalar context, producing a spurious
value that was then treated as the string to split.
Fix: In parseSplit(), when no string argument is provided, explicitly add
-A as the default argument in the AST. This is consistent with how other
operators (defined, print, chomp) handle the -A default, and ensures both
JVM and bytecode backends correctly resolve -A at runtime.
This fixes ExifTool Writer test 6 (TimeCodes encoding), Geotag tests
2/4/9/10 (GPX parsing), and Geolocation test 5 (GPS track processing),
all of which used bare inside eval'd code strings.
ExifTool test results: 113/113 files pass, 600/600 tests pass (100%).
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
EOF
)split without string argument now correctly uses $_ in eval'd code1 parent b5078ad commit 86baa2f
File tree
2 files changed
+9
-2
lines changed- src/main/java/org/perlonjava
- core
- frontend/parser
2 files changed
+9
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| |||
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
911 | 911 | | |
912 | 912 | | |
913 | 913 | | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
914 | 921 | | |
915 | 922 | | |
916 | 923 | | |
| |||
0 commit comments