lib/prism/translation/ripper.rb in prism-0.30.0 vs lib/prism/translation/ripper.rb in prism-1.0.0
- old
+ new
@@ -1271,12 +1271,12 @@
# case foo; when bar; end
# ^^^^^^^^^^^^^^^^^^^^^^^
def visit_case_node(node)
predicate = visit(node.predicate)
clauses =
- node.conditions.reverse_each.inject(visit(node.consequent)) do |consequent, condition|
- on_when(*visit(condition), consequent)
+ node.conditions.reverse_each.inject(visit(node.else_clause)) do |current, condition|
+ on_when(*visit(condition), current)
end
bounds(node.location)
on_case(predicate, clauses)
end
@@ -1284,12 +1284,12 @@
# case foo; in bar; end
# ^^^^^^^^^^^^^^^^^^^^^
def visit_case_match_node(node)
predicate = visit(node.predicate)
clauses =
- node.conditions.reverse_each.inject(visit(node.consequent)) do |consequent, condition|
- on_in(*visit(condition), consequent)
+ node.conditions.reverse_each.inject(visit(node.else_clause)) do |current, condition|
+ on_in(*visit(condition), current)
end
bounds(node.location)
on_case(predicate, clauses)
end
@@ -1906,11 +1906,11 @@
# ^^^^^^^^^^^^^^^
def visit_if_node(node)
if node.then_keyword == "?"
predicate = visit(node.predicate)
truthy = visit(node.statements.body.first)
- falsy = visit(node.consequent.statements.body.first)
+ falsy = visit(node.subsequent.statements.body.first)
bounds(node.location)
on_ifop(predicate, truthy, falsy)
elsif node.statements.nil? || (node.predicate.location.start_offset < node.statements.location.start_offset)
predicate = visit(node.predicate)
@@ -1919,17 +1919,17 @@
bounds(node.location)
on_stmts_add(on_stmts_new, on_void_stmt)
else
visit(node.statements)
end
- consequent = visit(node.consequent)
+ subsequent = visit(node.subsequent)
bounds(node.location)
if node.if_keyword == "if"
- on_if(predicate, statements, consequent)
+ on_if(predicate, statements, subsequent)
else
- on_elsif(predicate, statements, consequent)
+ on_elsif(predicate, statements, subsequent)
end
else
statements = visit(node.statements.body.first)
predicate = visit(node.predicate)
@@ -1958,11 +1958,11 @@
# case foo; in bar; end
# ^^^^^^^^^^^^^^^^^^^^^
def visit_in_node(node)
# This is a special case where we're not going to call on_in directly
- # because we don't have access to the consequent. Instead, we'll return
+ # because we don't have access to the subsequent. Instead, we'll return
# the component parts and let the parent node handle it.
pattern = visit_pattern_node(node.pattern)
statements =
if node.statements.nil?
bounds(node.location)
@@ -2806,14 +2806,14 @@
on_stmts_add(on_stmts_new, on_void_stmt)
else
visit(node.statements)
end
- consequent = visit(node.consequent)
+ subsequent = visit(node.subsequent)
bounds(node.location)
- on_rescue(exceptions, reference, statements, consequent)
+ on_rescue(exceptions, reference, statements, subsequent)
end
# def foo(*bar); end
# ^^^^
#
@@ -3130,14 +3130,14 @@
bounds(node.location)
on_stmts_add(on_stmts_new, on_void_stmt)
else
visit(node.statements)
end
- consequent = visit(node.consequent)
+ else_clause = visit(node.else_clause)
bounds(node.location)
- on_unless(predicate, statements, consequent)
+ on_unless(predicate, statements, else_clause)
else
statements = visit(node.statements.body.first)
predicate = visit(node.predicate)
bounds(node.location)
@@ -3174,10 +3174,10 @@
# case foo; when bar; end
# ^^^^^^^^^^^^^
def visit_when_node(node)
# This is a special case where we're not going to call on_when directly
- # because we don't have access to the consequent. Instead, we'll return
+ # because we don't have access to the subsequent. Instead, we'll return
# the component parts and let the parent node handle it.
conditions = visit_arguments(node.conditions)
statements =
if node.statements.nil?
bounds(node.location)