@@ -485,17 +485,17 @@ def format(q)
485
485
end
486
486
487
487
# [DynaSymbol | GVar | SymbolLiteral] the new name of the method
488
- attr_reader :left
488
+ attr_reader :new_name
489
489
490
490
# [Backref | DynaSymbol | GVar | SymbolLiteral] the old name of the method
491
- attr_reader :right
491
+ attr_reader :old_name
492
492
493
493
# [Array[ Comment | EmbDoc ]] the comments attached to this node
494
494
attr_reader :comments
495
495
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
499
499
@location = location
500
500
@comments = [ ]
501
501
end
@@ -505,14 +505,14 @@ def accept(visitor)
505
505
end
506
506
507
507
def child_nodes
508
- [ left , right ]
508
+ [ new_name , old_name ]
509
509
end
510
510
511
- def copy ( left : nil , right : nil , location : nil )
511
+ def copy ( new_name : nil , old_name : nil , location : nil )
512
512
node =
513
513
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 ,
516
516
location : location || self . location
517
517
)
518
518
@@ -523,31 +523,41 @@ def copy(left: nil, right: nil, location: nil)
523
523
alias deconstruct child_nodes
524
524
525
525
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
+ }
527
532
end
528
533
529
534
def format ( q )
530
535
keyword = "alias "
531
- left_argument = AliasArgumentFormatter . new ( left )
536
+ new_name_argument = AliasArgumentFormatter . new ( new_name )
532
537
533
538
q . group do
534
539
q . text ( keyword )
535
- q . format ( left_argument , stackable : false )
540
+ q . format ( new_name_argument , stackable : false )
536
541
q . group do
537
542
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 )
540
549
end
541
550
end
542
551
end
543
552
end
544
553
545
554
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
547
557
end
548
558
549
559
def var_alias?
550
- left . is_a? ( GVar )
560
+ new_name . is_a? ( GVar )
551
561
end
552
562
end
553
563
0 commit comments