Repository: ruby/prism
Pull request #2934 (2024-07-15 18:02:32)

Fix up implicit flags


Patch:
diff --git a/src/prism.c b/src/prism.c
index d46c06c5..2e1d90ad 100644
--- a/src/prism.c
+++ b/src/prism.c
@@ -2575,10 +2575,10 @@ pm_break_node_create(pm_parser_t *parser, const pm_token_t *keyword, pm_argument
 // There are certain flags that we want to use internally but don't want to
 // expose because they are not relevant beyond parsing. Therefore we'll define
 // them here and not define them in config.yml/a header file.
-static const pm_node_flags_t PM_WRITE_NODE_FLAGS_IMPLICIT_ARRAY = 0x1;
-static const pm_node_flags_t PM_CALL_NODE_FLAGS_IMPLICIT_ARRAY = 0x10;
-static const pm_node_flags_t PM_CALL_NODE_FLAGS_COMPARISON = 0x20;
-static const pm_node_flags_t PM_CALL_NODE_FLAGS_INDEX = 0x40;
+static const pm_node_flags_t PM_WRITE_NODE_FLAGS_IMPLICIT_ARRAY = 0x4;
+static const pm_node_flags_t PM_CALL_NODE_FLAGS_IMPLICIT_ARRAY = 0x40;
+static const pm_node_flags_t PM_CALL_NODE_FLAGS_COMPARISON = 0x80;
+static const pm_node_flags_t PM_CALL_NODE_FLAGS_INDEX = 0x100;
 
 /**
  * Allocate and initialize a new CallNode node. This sets everything to NULL or


Test patch:
diff --git a/test/prism/snapshots/integer_operations.txt b/test/prism/snapshots/integer_operations.txt
index 39a2d8ee..9962ccf2 100644
--- a/test/prism/snapshots/integer_operations.txt
+++ b/test/prism/snapshots/integer_operations.txt
@@ -238,7 +238,7 @@
         │   ├── closing_loc: ∅
         │   └── block: ∅
         ├── @ CallNode (location: (25,0)-(25,5))
-        │   ├── flags: newline, ignore_visibility
+        │   ├── flags: newline
         │   ├── receiver:
         │   │   @ IntegerNode (location: (25,0)-(25,1))
         │   │   ├── flags: static_literal, decimal
@@ -276,7 +276,7 @@
         │   ├── closing_loc: ∅
         │   └── block: ∅
         ├── @ CallNode (location: (29,0)-(29,6))
-        │   ├── flags: newline, ignore_visibility
+        │   ├── flags: newline
         │   ├── receiver:
         │   │   @ IntegerNode (location: (29,0)-(29,1))
         │   │   ├── flags: static_literal, decimal
@@ -371,7 +371,7 @@
         │   ├── closing_loc: ∅
         │   └── block: ∅
         ├── @ CallNode (location: (39,0)-(39,5))
-        │   ├── flags: newline, ignore_visibility
+        │   ├── flags: newline
         │   ├── receiver:
         │   │   @ IntegerNode (location: (39,0)-(39,1))
         │   │   ├── flags: static_literal, decimal
@@ -390,7 +390,7 @@
         │   ├── closing_loc: ∅
         │   └── block: ∅
         ├── @ CallNode (location: (41,0)-(41,6))
-        │   ├── flags: newline, ignore_visibility
+        │   ├── flags: newline
         │   ├── receiver:
         │   │   @ IntegerNode (location: (41,0)-(41,1))
         │   │   ├── flags: static_literal, decimal
diff --git a/test/prism/snapshots/multi_write.txt b/test/prism/snapshots/multi_write.txt
index 68fa62cf..fa36f504 100644
--- a/test/prism/snapshots/multi_write.txt
+++ b/test/prism/snapshots/multi_write.txt
@@ -53,7 +53,7 @@
         │   ├── flags: newline
         │   ├── expression:
         │   │   @ LocalVariableWriteNode (location: (3,0)-(3,10))
-        │   │   ├── flags: newline
+        │   │   ├── flags: ∅
         │   │   ├── name: :foo
         │   │   ├── depth: 0
         │   │   ├── name_loc: (3,0)-(3,3) = "foo"
diff --git a/test/prism/snapshots/ranges.txt b/test/prism/snapshots/ranges.txt
index 7c217579..81dbe3d9 100644
--- a/test/prism/snapshots/ranges.txt
+++ b/test/prism/snapshots/ranges.txt
@@ -361,7 +361,7 @@
         │   ├── closing_loc: ∅
         │   └── block: ∅
         ├── @ CallNode (location: (35,0)-(35,7))
-        │   ├── flags: newline, ignore_visibility
+        │   ├── flags: newline
         │   ├── receiver:
         │   │   @ RangeNode (location: (35,0)-(35,3))
         │   │   ├── flags: static_literal
@@ -385,7 +385,7 @@
         │   ├── closing_loc: ∅
         │   └── block: ∅
         ├── @ CallNode (location: (37,0)-(37,7))
-        │   ├── flags: newline, ignore_visibility
+        │   ├── flags: newline
         │   ├── receiver:
         │   │   @ RangeNode (location: (37,0)-(37,3))
         │   │   ├── flags: static_literal
@@ -409,7 +409,7 @@
         │   ├── closing_loc: ∅
         │   └── block: ∅
         ├── @ CallNode (location: (39,0)-(39,8))
-        │   ├── flags: newline, ignore_visibility
+        │   ├── flags: newline
         │   ├── receiver:
         │   │   @ RangeNode (location: (39,0)-(39,3))
         │   │   ├── flags: static_literal
@@ -433,7 +433,7 @@
         │   ├── closing_loc: ∅
         │   └── block: ∅
         ├── @ CallNode (location: (41,0)-(41,8))
-        │   ├── flags: newline, ignore_visibility
+        │   ├── flags: newline
         │   ├── receiver:
         │   │   @ RangeNode (location: (41,0)-(41,3))
         │   │   ├── flags: static_literal
diff --git a/test/prism/snapshots/seattlerb/call_gt.txt b/test/prism/snapshots/seattlerb/call_gt.txt
index b1ee64e5..22371dd8 100644
--- a/test/prism/snapshots/seattlerb/call_gt.txt
+++ b/test/prism/snapshots/seattlerb/call_gt.txt
@@ -6,7 +6,7 @@
     ├── flags: ∅
     └── body: (length: 1)
         └── @ CallNode (location: (1,0)-(1,5))
-            ├── flags: newline, ignore_visibility
+            ├── flags: newline
             ├── receiver:
             │   @ IntegerNode (location: (1,0)-(1,1))
             │   ├── flags: static_literal, decimal
diff --git a/test/prism/snapshots/seattlerb/call_lt.txt b/test/prism/snapshots/seattlerb/call_lt.txt
index 6c5b5f22..bec3dedd 100644
--- a/test/prism/snapshots/seattlerb/call_lt.txt
+++ b/test/prism/snapshots/seattlerb/call_lt.txt
@@ -6,7 +6,7 @@
     ├── flags: ∅
     └── body: (length: 1)
         └── @ CallNode (location: (1,0)-(1,5))
-            ├── flags: newline, ignore_visibility
+            ├── flags: newline
             ├── receiver:
             │   @ IntegerNode (location: (1,0)-(1,1))
             │   ├── flags: static_literal, decimal
diff --git a/test/prism/snapshots/seattlerb/call_lte.txt b/test/prism/snapshots/seattlerb/call_lte.txt
index 9fadb1f9..a71e03ee 100644
--- a/test/prism/snapshots/seattlerb/call_lte.txt
+++ b/test/prism/snapshots/seattlerb/call_lte.txt
@@ -6,7 +6,7 @@
     ├── flags: ∅
     └── body: (length: 1)
         └── @ CallNode (location: (1,0)-(1,6))
-            ├── flags: newline, ignore_visibility
+            ├── flags: newline
             ├── receiver:
             │   @ IntegerNode (location: (1,0)-(1,1))
             │   ├── flags: static_literal, decimal
diff --git a/test/prism/snapshots/whitequark/send_binary_op.txt b/test/prism/snapshots/whitequark/send_binary_op.txt
index a020262b..49a2cffa 100644
--- a/test/prism/snapshots/whitequark/send_binary_op.txt
+++ b/test/prism/snapshots/whitequark/send_binary_op.txt
@@ -240,7 +240,7 @@
         │   ├── closing_loc: ∅
         │   └── block: ∅
         ├── @ CallNode (location: (19,0)-(19,7))
-        │   ├── flags: newline, ignore_visibility
+        │   ├── flags: newline
         │   ├── receiver:
         │   │   @ CallNode (location: (19,0)-(19,3))
         │   │   ├── flags: variable_call, ignore_visibility
@@ -292,7 +292,7 @@
         │   ├── closing_loc: ∅
         │   └── block: ∅
         ├── @ CallNode (location: (23,0)-(23,8))
-        │   ├── flags: newline, ignore_visibility
+        │   ├── flags: newline
         │   ├── receiver:
         │   │   @ CallNode (location: (23,0)-(23,3))
         │   │   ├── flags: variable_call, ignore_visibility
@@ -422,7 +422,7 @@
         │   ├── closing_loc: ∅
         │   └── block: ∅
         ├── @ CallNode (location: (33,0)-(33,7))
-        │   ├── flags: newline, ignore_visibility
+        │   ├── flags: newline
         │   ├── receiver:
         │   │   @ CallNode (location: (33,0)-(33,3))
         │   │   ├── flags: variable_call, ignore_visibility
@@ -448,7 +448,7 @@
         │   ├── closing_loc: ∅
         │   └── block: ∅
         ├── @ CallNode (location: (35,0)-(35,8))
-        │   ├── flags: newline, ignore_visibility
+        │   ├── flags: newline
         │   ├── receiver:
         │   │   @ CallNode (location: (35,0)-(35,3))
         │   │   ├── flags: variable_call, ignore_visibility