@@ -485,17 +485,17 @@ def format(q)
485485 end
486486
487487 # [DynaSymbol | GVar | SymbolLiteral] the new name of the method
488- attr_reader :left
488+ attr_reader :new_name
489489
490490 # [Backref | DynaSymbol | GVar | SymbolLiteral] the old name of the method
491- attr_reader :right
491+ attr_reader :old_name
492492
493493 # [Array[ Comment | EmbDoc ]] the comments attached to this node
494494 attr_reader :comments
495495
496- def initialize ( left :, right :, location :)
497- @left = left
498- @right = right
496+ def initialize ( new_name :, old_name :, location :)
497+ @new_name = new_name
498+ @old_name = old_name
499499 @location = location
500500 @comments = [ ]
501501 end
@@ -505,14 +505,14 @@ def accept(visitor)
505505 end
506506
507507 def child_nodes
508- [ left , right ]
508+ [ new_name , old_name ]
509509 end
510510
511- def copy ( left : nil , right : nil , location : nil )
511+ def copy ( new_name : nil , old_name : nil , location : nil )
512512 node =
513513 AliasNode . new (
514- left : left || self . left ,
515- right : right || self . right ,
514+ new_name : new_name || self . new_name ,
515+ old_name : old_name || self . old_name ,
516516 location : location || self . location
517517 )
518518
@@ -523,31 +523,41 @@ def copy(left: nil, right: nil, location: nil)
523523 alias deconstruct child_nodes
524524
525525 def deconstruct_keys ( _keys )
526- { left : left , right : right , location : location , comments : comments }
526+ {
527+ new_name : new_name ,
528+ old_name : old_name ,
529+ location : location ,
530+ comments : comments
531+ }
527532 end
528533
529534 def format ( q )
530535 keyword = "alias "
531- left_argument = AliasArgumentFormatter . new ( left )
536+ new_name_argument = AliasArgumentFormatter . new ( new_name )
532537
533538 q . group do
534539 q . text ( keyword )
535- q . format ( left_argument , stackable : false )
540+ q . format ( new_name_argument , stackable : false )
536541 q . group do
537542 q . nest ( keyword . length ) do
538- left_argument . comments . any? ? q . breakable_force : q . breakable_space
539- q . format ( AliasArgumentFormatter . new ( right ) , stackable : false )
543+ if new_name_argument . comments . any?
544+ q . breakable_force
545+ else
546+ q . breakable_space
547+ end
548+ q . format ( AliasArgumentFormatter . new ( old_name ) , stackable : false )
540549 end
541550 end
542551 end
543552 end
544553
545554 def ===( other )
546- other . is_a? ( AliasNode ) && left === other . left && right === other . right
555+ other . is_a? ( AliasNode ) && new_name === other . new_name &&
556+ old_name === other . old_name
547557 end
548558
549559 def var_alias?
550- left . is_a? ( GVar )
560+ new_name . is_a? ( GVar )
551561 end
552562 end
553563
0 commit comments