Commit ff03372
fix: escape single quotes and backslashes in IR string output
Strings containing single quotes or backslashes would break the IR
parser because appendQuotedString emitted them unescaped inside
single-quote delimiters.
- Add escapeIRString() helper that escapes \, ', \n, \r, \t
- Apply it in appendQuotedString() (removes the long-standing TODO)
- Fix the LiteralString IR case to route through appendQuotedString
instead of its own inline template literal
- Add two regression tests (single-quote and backslash in string literals)
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>1 parent f4c3ba5 commit ff03372
File tree
2 files changed
+35
-3
lines changed- compiler/companion/src/native
2 files changed
+35
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
96 | 105 | | |
97 | 106 | | |
98 | 107 | | |
| |||
105 | 114 | | |
106 | 115 | | |
107 | 116 | | |
108 | | - | |
109 | | - | |
| 117 | + | |
110 | 118 | | |
111 | 119 | | |
112 | 120 | | |
| |||
355 | 363 | | |
356 | 364 | | |
357 | 365 | | |
358 | | - | |
| 366 | + | |
359 | 367 | | |
360 | 368 | | |
361 | 369 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4035 | 4035 | | |
4036 | 4036 | | |
4037 | 4037 | | |
| 4038 | + | |
| 4039 | + | |
| 4040 | + | |
| 4041 | + | |
| 4042 | + | |
| 4043 | + | |
| 4044 | + | |
| 4045 | + | |
| 4046 | + | |
| 4047 | + | |
| 4048 | + | |
| 4049 | + | |
| 4050 | + | |
| 4051 | + | |
| 4052 | + | |
| 4053 | + | |
| 4054 | + | |
| 4055 | + | |
| 4056 | + | |
| 4057 | + | |
| 4058 | + | |
| 4059 | + | |
| 4060 | + | |
| 4061 | + | |
4038 | 4062 | | |
0 commit comments