File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -1492,6 +1492,22 @@ def visit_if(node)
1492
1492
end
1493
1493
end
1494
1494
1495
+ def visit_if_op ( node )
1496
+ visit_if (
1497
+ IfNode . new (
1498
+ predicate : node . predicate ,
1499
+ statements : node . truthy ,
1500
+ consequent :
1501
+ Else . new (
1502
+ keyword : Kw . new ( value : "else" , location : Location . default ) ,
1503
+ statements : node . falsy ,
1504
+ location : Location . default
1505
+ ) ,
1506
+ location : Location . default
1507
+ )
1508
+ )
1509
+ end
1510
+
1495
1511
def visit_imaginary ( node )
1496
1512
builder . putobject ( node . accept ( RubyVisitor . new ) )
1497
1513
end
@@ -1874,9 +1890,9 @@ def visit_unary(node)
1874
1890
CallNode . new (
1875
1891
receiver : node . statement ,
1876
1892
operator : nil ,
1877
- message : Ident . new ( value : method_id , location : node . location ) ,
1893
+ message : Ident . new ( value : method_id , location : Location . default ) ,
1878
1894
arguments : nil ,
1879
- location : node . location
1895
+ location : Location . default
1880
1896
)
1881
1897
)
1882
1898
end
Original file line number Diff line number Diff line change @@ -260,6 +260,7 @@ class CompilerTest < Minitest::Test
260
260
"foo if bar" ,
261
261
"foo while bar" ,
262
262
"for i in [1, 2, 3] do i end" ,
263
+ "foo ? bar : baz" ,
263
264
# Constructed values
264
265
"foo..bar" ,
265
266
"foo...bar" ,
You can’t perform that action at this time.
0 commit comments