@@ -342,14 +342,14 @@ def evaluate_call_write(node, scope, operator, write_name)
342342 Types ::UnionType [ left , right ]
343343 else
344344 right = evaluate node . value , scope
345- method_call left , node . operator , [ right ] , nil , nil , scope , name_match : false
345+ method_call left , node . binary_operator , [ right ] , nil , nil , scope , name_match : false
346346 end
347347 end
348348
349349 def evaluate_variable_operator_write ( node , scope )
350350 left = scope [ node . name . to_s ] || Types ::OBJECT
351351 right = evaluate node . value , scope
352- scope [ node . name . to_s ] = method_call left , node . operator , [ right ] , nil , nil , scope , name_match : false
352+ scope [ node . name . to_s ] = method_call left , node . binary_operator , [ right ] , nil , nil , scope , name_match : false
353353 end
354354 alias evaluate_global_variable_operator_write_node evaluate_variable_operator_write
355355 alias evaluate_local_variable_operator_write_node evaluate_variable_operator_write
@@ -378,7 +378,7 @@ def evaluate_variable_or_write(node, scope)
378378 def evaluate_constant_operator_write_node ( node , scope )
379379 left = scope [ node . name . to_s ] || Types ::OBJECT
380380 right = evaluate node . value , scope
381- scope [ node . name . to_s ] = method_call left , node . operator , [ right ] , nil , nil , scope , name_match : false
381+ scope [ node . name . to_s ] = method_call left , node . binary_operator , [ right ] , nil , nil , scope , name_match : false
382382 end
383383
384384 def evaluate_constant_and_write_node ( node , scope )
@@ -395,7 +395,7 @@ def evaluate_constant_or_write_node(node, scope)
395395 def evaluate_constant_path_operator_write_node ( node , scope )
396396 left , receiver , _parent_module , name = evaluate_constant_node_info node . target , scope
397397 right = evaluate node . value , scope
398- value = method_call left , node . operator , [ right ] , nil , nil , scope , name_match : false
398+ value = method_call left , node . binary_operator , [ right ] , nil , nil , scope , name_match : false
399399 const_path_write receiver , name , value , scope
400400 value
401401 end
@@ -419,8 +419,7 @@ def evaluate_constant_path_or_write_node(node, scope)
419419 def evaluate_constant_path_write_node ( node , scope )
420420 receiver = evaluate node . target . parent , scope if node . target . parent
421421 value = evaluate node . value , scope
422- name = const_path_name ( node . target )
423- const_path_write receiver , name , value , scope
422+ const_path_write receiver , node . target . name . to_s , value , scope
424423 value
425424 end
426425
@@ -839,16 +838,6 @@ def evaluate_call_node_arguments(call_node, scope)
839838 [ args_types , kwargs_types , block_sym_node , !!block_arg ]
840839 end
841840
842- def const_path_name ( node )
843- if node . respond_to? ( :name )
844- # ConstantPathNode#name ConstantPathTargetNode#name is added in Prism 0.28.0
845- node . name . to_s
846- else
847- # ConstantPathNode#child ConstantPathTargetNode#child is deprecated in Prism 0.28.0
848- node . child . name . to_s
849- end
850- end
851-
852841 def const_path_write ( receiver , name , value , scope )
853842 if receiver # receiver::A = value
854843 singleton_type = receiver . types . find { _1 . is_a? Types ::SingletonType }
@@ -875,9 +864,9 @@ def assign_required_parameter(node, value, scope)
875864 end
876865
877866 def evaluate_constant_node_info ( node , scope )
867+ name = node . name . to_s
878868 case node
879869 when Prism ::ConstantPathNode
880- name = const_path_name ( node )
881870 if node . parent
882871 receiver = evaluate node . parent , scope
883872 if receiver . is_a? Types ::SingletonType
@@ -893,7 +882,6 @@ def evaluate_constant_node_info(node, scope)
893882 type = Types ::NIL
894883 end
895884 when Prism ::ConstantReadNode
896- name = node . name . to_s
897885 type = scope [ name ]
898886 end
899887 @dig_targets . resolve type , scope if @dig_targets . target? node
@@ -1048,8 +1036,7 @@ def evaluate_write(node, value, scope, evaluated_receivers)
10481036 scope [ node . name . to_s ] = value
10491037 when Prism ::ConstantPathTargetNode
10501038 receiver = evaluated_receivers &.[]( node . parent ) || evaluate ( node . parent , scope ) if node . parent
1051- name = const_path_name ( node )
1052- const_path_write receiver , name , value , scope
1039+ const_path_write receiver , node . name . to_s , value , scope
10531040 end
10541041 end
10551042
0 commit comments