Call TreeBuilder#override on TreeNode objects instead of hashes #6220
+41
−78
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There's a controversial
TreeBuilder#override
method that is intended to change nodes after they are being built. This method has been called fromTreeBuilder#x_build_single_node
on individual hashes that come out fromTreeNode::Node#to_h
.The final result of the
x_build_single_node
has been not changed, so the method still produces the same output. However, theoverride
method is now being called on theTreeNode::Node
object directly and it is being converted to a hash AFTER this. This allows us to have a cleaner dataflow and eventually the hash conversion can be pushed up to the highest level, leaving us with a pure object tree.As the
override
happened after the conversion, the resulted node had to comply with the JSON specification of the tree. This forced us to reimplement features from theTreeNode::Node#to_h
, such as lazy-initializing thestate
hash appending the extrano-cursor
class to non-selectable nodes. These safeguards are no longer necessary and they have been removed.@miq-bot add_label refactoring, trees, ivanchuk/no
@miq-bot add_reviewer @martinpovolny
@miq-bot add_reviewer @romanblanco
@miq-bot add_reviewer @mzazrivec
@miq-bot add_reviewer @ZitaNemeckova