Skip to content

Commit ce4abe1

Browse files
authored
Merge pull request #3668 from Earlopain/unintended-change
Fix unintended change
2 parents d048418 + 4a80ba5 commit ce4abe1

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

snapshots/seattlerb/dstr_evstr.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
├── flags: ∅
77
└── body: (length: 1)
88
└── @ InterpolatedStringNode (location: (1,0)-(1,12))
9-
├── flags: newline, mutable
9+
├── flags: newline
1010
├── opening_loc: (1,0)-(1,1) = "\""
1111
├── parts: (length: 2)
1212
│ ├── @ EmbeddedStatementsNode (location: (1,1)-(1,7))

snapshots/string_concatination_frozen_false.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
│ │ ├── closing_loc: (5,10)-(5,11) = "'"
4040
│ │ └── unescaped: "bar"
4141
│ └── @ InterpolatedStringNode (location: (5,12)-(5,23))
42-
│ ├── flags: mutable
42+
│ ├── flags:
4343
│ ├── opening_loc: (5,12)-(5,13) = "\""
4444
│ ├── parts: (length: 2)
4545
│ │ ├── @ StringNode (location: (5,13)-(5,16))

snapshots/string_concatination_frozen_true.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
│ │ ├── closing_loc: (5,10)-(5,11) = "'"
4040
│ │ └── unescaped: "bar"
4141
│ └── @ InterpolatedStringNode (location: (5,12)-(5,23))
42-
│ ├── flags: frozen
42+
│ ├── flags:
4343
│ ├── opening_loc: (5,12)-(5,13) = "\""
4444
│ ├── parts: (length: 2)
4545
│ │ ├── @ StringNode (location: (5,13)-(5,16))

src/prism.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5281,7 +5281,8 @@ pm_interpolated_string_node_append(pm_interpolated_string_node_t *node, pm_node_
52815281
switch (PM_NODE_TYPE(part)) {
52825282
case PM_STRING_NODE:
52835283
// If inner string is not frozen, it stops being a static literal. We should *not* clear other flags,
5284-
// because concatenating two frozen strings (`'foo' 'bar'`) is still frozen.
5284+
// because concatenating two frozen strings (`'foo' 'bar'`) is still frozen. This holds true for
5285+
// as long as this interpolation only consists of other string literals.
52855286
if (!PM_NODE_FLAG_P(part, PM_STRING_FLAGS_FROZEN)) {
52865287
pm_node_flag_unset((pm_node_t *) node, PM_NODE_FLAG_STATIC_LITERAL);
52875288
}
@@ -5324,7 +5325,7 @@ pm_interpolated_string_node_append(pm_interpolated_string_node_t *node, pm_node_
53245325
} else {
53255326
// In all other cases, we lose the static literal flag here and
53265327
// become mutable.
5327-
pm_node_flag_unset((pm_node_t *) node, PM_NODE_FLAG_STATIC_LITERAL);
5328+
CLEAR_FLAGS(node);
53285329
}
53295330

53305331
break;

0 commit comments

Comments
 (0)