File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
src/main/java/org/truffleruby/parser Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -579,9 +579,9 @@ public RubyNode visitCallNode(Nodes.CallNode node) {
579
579
// If the receiver is explicit or implicit 'self' then we can call private methods
580
580
final boolean ignoreVisibility = node .receiver == null || node .receiver instanceof Nodes .SelfNode ;
581
581
final boolean isVariableCall = node .isVariableCall ();
582
- // this check isn't accurate and doesn't handle cases like #===, #!=, a.foo=(42)
582
+ // This isn't fully accurate and doesn't handle cases like #===, #!=, a.foo=(42)
583
583
// the issue is tracked in https://github.com/ruby/prism/issues/1715
584
- final boolean isAttrAssign = methodName . endsWith ( "=" );
584
+ final boolean isAttrAssign = isAttrAssign ( node . name );
585
585
final boolean isSafeNavigation = node .isSafeNavigation ();
586
586
587
587
// No need to copy the array for call(*splat), the elements will be copied to the frame arguments
@@ -733,6 +733,14 @@ private ArgumentsDescriptor getKeywordArgumentsDescriptor(Nodes.Node[] arguments
733
733
}
734
734
}
735
735
736
+ private boolean isAttrAssign (String methodName ) {
737
+ if (!methodName .endsWith ("=" ) || methodName .length () < 2 ) {
738
+ return false ;
739
+ }
740
+ char before = methodName .charAt (methodName .length () - 2 );
741
+ return before != '=' && before != '!' && before != '<' && before != '>' ;
742
+ }
743
+
736
744
@ Override
737
745
public RubyNode visitCallOperatorWriteNode (Nodes .CallOperatorWriteNode node ) {
738
746
return defaultVisit (node );
You can’t perform that action at this time.
0 commit comments