@@ -94,15 +94,19 @@ fileprivate extension Compiler.ByteCodeGen {
94
94
}
95
95
} else {
96
96
if optimizationsEnabled && s. allSatisfy ( { char in char. isASCII} ) {
97
- for char in s {
97
+ for char in s. dropLast ( 1 ) {
98
98
// Note: only cr-lf is multiple scalars
99
99
for scalar in char. unicodeScalars {
100
- // Only boundary check if we are the last scalar in the last character
101
- // to make sure that there isn't a combining scalar after the quoted literal
102
- let boundaryCheck = char == s. last! && scalar == char. unicodeScalars. last!
103
- builder. buildMatchScalar ( scalar, boundaryCheck: boundaryCheck)
100
+ builder. buildMatchScalar ( scalar, boundaryCheck: false )
104
101
}
105
102
}
103
+ let lastChar = s. last!
104
+ for scalar in lastChar. unicodeScalars {
105
+ // Only boundary check if we are the last scalar in the last character
106
+ // to make sure that there isn't a combining scalar after the quoted literal
107
+ let boundaryCheck = scalar == lastChar. unicodeScalars. last!
108
+ builder. buildMatchScalar ( scalar, boundaryCheck: boundaryCheck)
109
+ }
106
110
} else {
107
111
builder. buildMatchSequence ( s)
108
112
}
@@ -286,7 +290,7 @@ fileprivate extension Compiler.ByteCodeGen {
286
290
return
287
291
}
288
292
289
- if optimizationsEnabled { // lily note: should we just do this unconditionally?
293
+ if optimizationsEnabled { // should we just do this unconditionally?
290
294
builder. buildMatchScalar ( s, boundaryCheck: false )
291
295
} else {
292
296
builder. buildConsume ( by: consumeScalar {
0 commit comments