Class: RBI::ConflictTree
- Inherits:
-
Tree
- Object
- Node
- NodeWithComments
- Tree
- RBI::ConflictTree
- Extended by:
- T::Sig
- Defined in:
- lib/rbi/rewriters/merge_trees.rb
Overview
A tree showing incompatibles nodes
Is rendered as a merge conflict between ‘left` and` right`: ~~~rb class Foo
<<<<<<< left
def m1; end
def m2(a); end
=======
def m1(a); end
def m2; end
>>>>>>> right
end ~~~
Instance Attribute Summary collapse
-
#left ⇒ Object
readonly
Returns the value of attribute left.
-
#right ⇒ Object
readonly
Returns the value of attribute right.
Attributes inherited from Tree
Attributes inherited from NodeWithComments
Attributes inherited from Node
Instance Method Summary collapse
- #accept_printer(v) ⇒ Object
-
#initialize(left_name: "left", right_name: "right") ⇒ ConflictTree
constructor
A new instance of ConflictTree.
Methods inherited from Tree
#<<, #empty?, #group_nodes!, #index, #merge, #nest_non_public_methods!, #nest_singleton_methods!, #oneline?, #sort_nodes!
Methods inherited from NodeWithComments
Methods inherited from Node
#compatible_with?, #detach, #group_kind, #merge_with, #oneline?, #parent_conflict_tree, #parent_scope, #print, #replace, #string
Constructor Details
#initialize(left_name: "left", right_name: "right") ⇒ ConflictTree
Returns a new instance of ConflictTree.
512 513 514 515 516 517 518 519 520 |
# File 'lib/rbi/rewriters/merge_trees.rb', line 512 def initialize(left_name: "left", right_name: "right") super() @left_name = left_name @right_name = right_name @left = T.let(Tree.new, Tree) @left.parent_tree = self @right = T.let(Tree.new, Tree) @right.parent_tree = self end |
Instance Attribute Details
#left ⇒ Object (readonly)
Returns the value of attribute left.
509 510 511 |
# File 'lib/rbi/rewriters/merge_trees.rb', line 509 def left @left end |
#right ⇒ Object (readonly)
Returns the value of attribute right.
509 510 511 |
# File 'lib/rbi/rewriters/merge_trees.rb', line 509 def right @right end |
Instance Method Details
#accept_printer(v) ⇒ Object
523 524 525 526 527 528 529 |
# File 'lib/rbi/rewriters/merge_trees.rb', line 523 def accept_printer(v) v.printl("<<<<<<< #{@left_name}") v.visit(left) v.printl("=======") v.visit(right) v.printl(">>>>>>> #{@right_name}") end |