summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorKevin Newton <[email protected]>2024-07-02 15:43:01 -0400
committerKevin Newton <[email protected]>2024-07-11 14:25:54 -0400
commit687be43c79a6fb119e52b09ea561cf958a9aabf2 (patch)
treedffa61a0172886f091571c73340926a70fe69340 /test
parentca48fb76fb0669ca0666a7aa129e1f5d2b7468da (diff)
[ruby/prism] Expose flags on every node type
https://github.com/ruby/prism/commit/9f12a56fd6
Diffstat (limited to 'test')
-rw-r--r--test/prism/newline_test.rb2
-rw-r--r--test/prism/result/integer_base_flags_test.rb4
-rw-r--r--test/prism/snapshots/integer_operations.txt8
-rw-r--r--test/prism/snapshots/ranges.txt8
-rw-r--r--test/prism/snapshots/seattlerb/call_gt.txt2
-rw-r--r--test/prism/snapshots/seattlerb/call_lt.txt2
-rw-r--r--test/prism/snapshots/seattlerb/call_lte.txt2
-rw-r--r--test/prism/snapshots/whitequark/send_binary_op.txt8
8 files changed, 18 insertions, 18 deletions
diff --git a/test/prism/newline_test.rb b/test/prism/newline_test.rb
index 03d7df4c97..a244b5428a 100644
--- a/test/prism/newline_test.rb
+++ b/test/prism/newline_test.rb
@@ -88,7 +88,7 @@ module Prism
while node = queue.shift
queue.concat(node.compact_child_nodes)
- newlines << result.source.line(node.location.start_offset) if node&.newline?
+ newlines << result.source.line(node.location.start_offset) if node&.newline_flag?
end
newlines.sort
diff --git a/test/prism/result/integer_base_flags_test.rb b/test/prism/result/integer_base_flags_test.rb
index ef15fb437c..e3ab8c6910 100644
--- a/test/prism/result/integer_base_flags_test.rb
+++ b/test/prism/result/integer_base_flags_test.rb
@@ -11,7 +11,7 @@ module Prism
#
# In C, this would look something like:
#
- # ((flags & ~DECIMAL) << 1) || 10
+ # ((flags & ~DECIMAL) >> 1) || 10
#
# We have to do some other work in Ruby because 0 is truthy and ~ on an
# integer doesn't have a fixed width.
@@ -26,7 +26,7 @@ module Prism
def base(source)
node = Prism.parse_statement(source)
- value = (node.send(:flags) & (0b1111 - IntegerBaseFlags::DECIMAL)) << 1
+ value = (node.send(:flags) & (0b111100 - IntegerBaseFlags::DECIMAL)) >> 1
value == 0 ? 10 : value
end
end
diff --git a/test/prism/snapshots/integer_operations.txt b/test/prism/snapshots/integer_operations.txt
index 4660928ad2..4dda43e38c 100644
--- a/test/prism/snapshots/integer_operations.txt
+++ b/test/prism/snapshots/integer_operations.txt
@@ -236,7 +236,7 @@
│ ├── closing_loc: ∅
│ └── block: ∅
├── @ CallNode (location: (25,0)-(25,5))
- │ ├── flags: ∅
+ │ ├── flags: ignore_visibility
│ ├── receiver:
│ │ @ IntegerNode (location: (25,0)-(25,1))
│ │ ├── flags: decimal
@@ -274,7 +274,7 @@
│ ├── closing_loc: ∅
│ └── block: ∅
├── @ CallNode (location: (29,0)-(29,6))
- │ ├── flags: ∅
+ │ ├── flags: ignore_visibility
│ ├── receiver:
│ │ @ IntegerNode (location: (29,0)-(29,1))
│ │ ├── flags: decimal
@@ -369,7 +369,7 @@
│ ├── closing_loc: ∅
│ └── block: ∅
├── @ CallNode (location: (39,0)-(39,5))
- │ ├── flags: ∅
+ │ ├── flags: ignore_visibility
│ ├── receiver:
│ │ @ IntegerNode (location: (39,0)-(39,1))
│ │ ├── flags: decimal
@@ -388,7 +388,7 @@
│ ├── closing_loc: ∅
│ └── block: ∅
├── @ CallNode (location: (41,0)-(41,6))
- │ ├── flags: ∅
+ │ ├── flags: ignore_visibility
│ ├── receiver:
│ │ @ IntegerNode (location: (41,0)-(41,1))
│ │ ├── flags: decimal
diff --git a/test/prism/snapshots/ranges.txt b/test/prism/snapshots/ranges.txt
index 2fffe80537..a9688baf30 100644
--- a/test/prism/snapshots/ranges.txt
+++ b/test/prism/snapshots/ranges.txt
@@ -346,7 +346,7 @@
│ ├── closing_loc: ∅
│ └── block: ∅
├── @ CallNode (location: (35,0)-(35,7))
- │ ├── flags: ∅
+ │ ├── flags: ignore_visibility
│ ├── receiver:
│ │ @ RangeNode (location: (35,0)-(35,3))
│ │ ├── flags: ∅
@@ -370,7 +370,7 @@
│ ├── closing_loc: ∅
│ └── block: ∅
├── @ CallNode (location: (37,0)-(37,7))
- │ ├── flags: ∅
+ │ ├── flags: ignore_visibility
│ ├── receiver:
│ │ @ RangeNode (location: (37,0)-(37,3))
│ │ ├── flags: ∅
@@ -394,7 +394,7 @@
│ ├── closing_loc: ∅
│ └── block: ∅
├── @ CallNode (location: (39,0)-(39,8))
- │ ├── flags: ∅
+ │ ├── flags: ignore_visibility
│ ├── receiver:
│ │ @ RangeNode (location: (39,0)-(39,3))
│ │ ├── flags: ∅
@@ -418,7 +418,7 @@
│ ├── closing_loc: ∅
│ └── block: ∅
├── @ CallNode (location: (41,0)-(41,8))
- │ ├── flags: ∅
+ │ ├── flags: ignore_visibility
│ ├── receiver:
│ │ @ RangeNode (location: (41,0)-(41,3))
│ │ ├── flags: ∅
diff --git a/test/prism/snapshots/seattlerb/call_gt.txt b/test/prism/snapshots/seattlerb/call_gt.txt
index a6f19e5adf..90f419a412 100644
--- a/test/prism/snapshots/seattlerb/call_gt.txt
+++ b/test/prism/snapshots/seattlerb/call_gt.txt
@@ -4,7 +4,7 @@
@ StatementsNode (location: (1,0)-(1,5))
└── body: (length: 1)
└── @ CallNode (location: (1,0)-(1,5))
- ├── flags: ∅
+ ├── flags: ignore_visibility
├── receiver:
│ @ IntegerNode (location: (1,0)-(1,1))
│ ├── flags: decimal
diff --git a/test/prism/snapshots/seattlerb/call_lt.txt b/test/prism/snapshots/seattlerb/call_lt.txt
index 14f50585d9..0020494e57 100644
--- a/test/prism/snapshots/seattlerb/call_lt.txt
+++ b/test/prism/snapshots/seattlerb/call_lt.txt
@@ -4,7 +4,7 @@
@ StatementsNode (location: (1,0)-(1,5))
└── body: (length: 1)
└── @ CallNode (location: (1,0)-(1,5))
- ├── flags: ∅
+ ├── flags: ignore_visibility
├── receiver:
│ @ IntegerNode (location: (1,0)-(1,1))
│ ├── flags: decimal
diff --git a/test/prism/snapshots/seattlerb/call_lte.txt b/test/prism/snapshots/seattlerb/call_lte.txt
index 665a99d60a..e6630a7f28 100644
--- a/test/prism/snapshots/seattlerb/call_lte.txt
+++ b/test/prism/snapshots/seattlerb/call_lte.txt
@@ -4,7 +4,7 @@
@ StatementsNode (location: (1,0)-(1,6))
└── body: (length: 1)
└── @ CallNode (location: (1,0)-(1,6))
- ├── flags: ∅
+ ├── flags: ignore_visibility
├── receiver:
│ @ IntegerNode (location: (1,0)-(1,1))
│ ├── flags: decimal
diff --git a/test/prism/snapshots/whitequark/send_binary_op.txt b/test/prism/snapshots/whitequark/send_binary_op.txt
index 540a7681dc..09991c5679 100644
--- a/test/prism/snapshots/whitequark/send_binary_op.txt
+++ b/test/prism/snapshots/whitequark/send_binary_op.txt
@@ -238,7 +238,7 @@
│ ├── closing_loc: ∅
│ └── block: ∅
├── @ CallNode (location: (19,0)-(19,7))
- │ ├── flags: ∅
+ │ ├── flags: ignore_visibility
│ ├── receiver:
│ │ @ CallNode (location: (19,0)-(19,3))
│ │ ├── flags: variable_call, ignore_visibility
@@ -290,7 +290,7 @@
│ ├── closing_loc: ∅
│ └── block: ∅
├── @ CallNode (location: (23,0)-(23,8))
- │ ├── flags: ∅
+ │ ├── flags: ignore_visibility
│ ├── receiver:
│ │ @ CallNode (location: (23,0)-(23,3))
│ │ ├── flags: variable_call, ignore_visibility
@@ -420,7 +420,7 @@
│ ├── closing_loc: ∅
│ └── block: ∅
├── @ CallNode (location: (33,0)-(33,7))
- │ ├── flags: ∅
+ │ ├── flags: ignore_visibility
│ ├── receiver:
│ │ @ CallNode (location: (33,0)-(33,3))
│ │ ├── flags: variable_call, ignore_visibility
@@ -446,7 +446,7 @@
│ ├── closing_loc: ∅
│ └── block: ∅
├── @ CallNode (location: (35,0)-(35,8))
- │ ├── flags: ∅
+ │ ├── flags: ignore_visibility
│ ├── receiver:
│ │ @ CallNode (location: (35,0)-(35,3))
│ │ ├── flags: variable_call, ignore_visibility