summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/prism/translation/ripper.rb36
-rw-r--r--test/prism/ripper_test.rb6
2 files changed, 34 insertions, 8 deletions
diff --git a/lib/prism/translation/ripper.rb b/lib/prism/translation/ripper.rb
index d92ff83ed3..8ab7b4a6aa 100644
--- a/lib/prism/translation/ripper.rb
+++ b/lib/prism/translation/ripper.rb
@@ -498,13 +498,43 @@ module Prism
# foo.bar &&= baz
# ^^^^^^^^^^^^^^^
def visit_call_and_write_node(node)
- raise NoMethodError, __method__
+ receiver = visit(node.receiver)
+
+ bounds(node.call_operator_loc)
+ call_operator = visit_token(node.call_operator)
+
+ bounds(node.message_loc)
+ message = visit_token(node.message)
+
+ bounds(node.location)
+ target = on_field(receiver, call_operator, message)
+
+ bounds(node.operator_loc)
+ operator = on_op("&&=")
+
+ value = visit(node.value)
+ on_opassign(target, operator, value)
end
# foo.bar ||= baz
# ^^^^^^^^^^^^^^^
def visit_call_or_write_node(node)
- raise NoMethodError, __method__
+ receiver = visit(node.receiver)
+
+ bounds(node.call_operator_loc)
+ call_operator = visit_token(node.call_operator)
+
+ bounds(node.message_loc)
+ message = visit_token(node.message)
+
+ bounds(node.location)
+ target = on_field(receiver, call_operator, message)
+
+ bounds(node.operator_loc)
+ operator = on_op("||=")
+
+ value = visit(node.value)
+ on_opassign(target, operator, value)
end
# foo.bar, = 1
@@ -2250,6 +2280,8 @@ module Prism
# split into the various token types.
def visit_token(token)
case token
+ when "."
+ on_period(token)
when *RUBY_KEYWORDS
on_kw(token)
when /^[[:upper:]]/
diff --git a/test/prism/ripper_test.rb b/test/prism/ripper_test.rb
index 38ffbad761..f1749efb8e 100644
--- a/test/prism/ripper_test.rb
+++ b/test/prism/ripper_test.rb
@@ -183,10 +183,8 @@ module Prism
seattlerb/non_interpolated_symbol_array_line_breaks.txt
seattlerb/non_interpolated_word_array_line_breaks.txt
seattlerb/op_asgn_command_call.txt
- seattlerb/op_asgn_dot_ident_command_call.txt
seattlerb/op_asgn_primary_colon_identifier1.txt
seattlerb/op_asgn_primary_colon_identifier_command_call.txt
- seattlerb/op_asgn_val_dot_ident_command_call.txt
seattlerb/parse_if_not_canonical.txt
seattlerb/parse_if_not_noncanonical.txt
seattlerb/parse_line_defn_complex.txt
@@ -237,7 +235,6 @@ module Prism
seattlerb/safe_call_operator.txt
seattlerb/safe_calls.txt
seattlerb/safe_op_asgn.txt
- seattlerb/safe_op_asgn2.txt
seattlerb/slashy_newlines_within_string.txt
seattlerb/stabby_arg_no_paren.txt
seattlerb/stabby_block_iter_call.txt
@@ -305,7 +302,6 @@ module Prism
variables.txt
while.txt
whitequark/ambiuous_quoted_label_in_ternary_operator.txt
- whitequark/and_asgn.txt
whitequark/anonymous_blockarg.txt
whitequark/arg_scope.txt
whitequark/args.txt
@@ -387,7 +383,6 @@ module Prism
whitequark/numparam_outside_block.txt
whitequark/op_asgn.txt
whitequark/op_asgn_cmd.txt
- whitequark/or_asgn.txt
whitequark/parser_bug_272.txt
whitequark/parser_bug_507.txt
whitequark/parser_bug_525.txt
@@ -430,7 +425,6 @@ module Prism
whitequark/send_lambda.txt
whitequark/send_lambda_args_noparen.txt
whitequark/send_lambda_legacy.txt
- whitequark/send_op_asgn_conditional.txt
whitequark/send_plain.txt
whitequark/send_plain_cmd.txt
whitequark/send_self.txt