Bumpssyntax_tree from 4.3.0 to 5.0.0.
Changelog
Sourced fromsyntax_tree's changelog.
[5.0.0] - 2022-11-09
Added
- Every node now implements the
#copy(**)
method, which provides a copy of the node with the given attributes replaced. - Every node now implements the
#===(other)
method, which checks if the given node matches the current node for all attributes except for comments and location. - There is a new
SyntaxTree::Visitor::MutationVisitor
and its convenience methodSyntaxTree.mutation
which can be used to mutate a syntax tree. For details on how to use this visitor, check the README.
Changed
- Nodes no longer have a
comments:
keyword on their initializers. By default, they initialize to an empty array. If you were previously passing comments into the initializer, you should now create the node first, then callnode.comments.concat
to add your comments. - A lot of nodes have been folded into other nodes to make it easier to interact with the AST. This means that a lot of visit methods have been removed from the visitor and a lot of class definitions are no longer present. This also means that the nodes that received more function now have additional methods or fields to be able to differentiate them. Note that none of these changes have resulted in different formatting. The changes are listed below:
IfMod
,UnlessMod
,WhileMod
,UntilMod
have been folded intoIfNode
,UnlessNode
,WhileNode
, andUntilNode
. Each of the nodes now have amodifier?
method to tell if it was originally in the modifier form. Consequently, thevisit_if_mod
,visit_unless_mod
,visit_while_mod
, andvisit_until_mod
methods have been removed from the visitor.VarAlias
is no longer a node, and theAlias
node has been renamed. They have been folded into theAliasNode
node. TheAliasNode
node now has avar_alias?
method to tell you if it is aliasing a global variable. Consequently, thevisit_var_alias
method has been removed from the visitor interface. If you were previously using this method, you should now usevisit_alias
instead.Yield0
is no longer a node, and theYield
node has been renamed. They has been folded into theYieldNode
node. TheYieldNode
node can now have itsarguments
field benil
. Consequently, thevisit_yield0
method has been removed from the visitor interface. If you were previously using this method, you should now usevisit_yield
instead.FCall
is no longer a node, and theCall
node has been renamed. They have been folded into theCallNode
node. TheCallNode
node can now have itsreceiver
andoperator
fields benil
. Consequently, thevisit_fcall
method has been removed from the visitor interface. If you were previously using this method, you should now usevisit_call
instead.Dot2
andDot3
are no longer nodes. Instead they have become a single newRangeNode
node. This node looks the same asDot2
andDot3
, except that it additionally has anoperator
field that contains the operator that created the node. Consequently, thevisit_dot2
andvisit_dot3
methods have been removed from the visitor interface. If you were previously using these methods, you should now usevisit_range
instead.Def
,DefEndless
, andDefs
have been folded into theDefNode
node. TheDefNode
node now has thetarget
andoperator
fields which originally came fromDefs
which can both benil
. It also now has anendless?
method on it to tell if the original node was found in the endless form. Finally thebodystmt
field can now either be aBodyStmt
as it was or any other kind of node since that was the body of theDefEndless
node. Thevisit_defs
andvisit_def_endless
methods on the visitor have therefore been removed.DoBlock
andBraceBlock
have now been folded into aBlockNode
node. TheBlockNode
node now has akeywords?
method on it that returns true if the block was constructed with thedo
..end
keywords. Thevisit_do_block
andvisit_brace_block
methods on the visitor have therefore been removed and replaced with thevisit_block
method.Return0
is no longer a node, and theReturn
node has been renamed. They have been folded into theReturnNode
node. TheReturnNode
node can now have itsarguments
field benil
. Consequently, thevisit_return0
method has been removed from the visitor interface. If you were previously using this method, you should now usevisit_return
instead.
- The
ArgsForward
,Redo
,Retry
, andZSuper
nodes no longer havevalue
fields associated with them (which were always string literals corresponding to the keyword being used). - The
Command
andCommandCall
nodes now hasblock
attributes on them. These attributes are used in the place where you would previously have had aMethodAddBlock
structure. Where before theMethodAddBlock
would have the command and block as its two children, you now just have one command node with theblock
attribute set to theBlock
node. - Previously the formatting options were defined on an unfrozen hash called
SyntaxTree::Formatter::OPTIONS
. It was globally mutable, which made it impossible to reference from within a Ractor. As such, it has now been replaced withSyntaxTree::Formatter::Options.new
which creates a new options object instance that can be modified without impacting global state. As a part of this change, formatting can now be performed from within a non-main Ractor. In order to check if theplugin/single_quotes
plugin has been loaded, check ifSyntaxTree::Formatter::SINGLE_QUOTES
is defined. In order to check if theplugin/trailing_comma
plugin has been loaded, check ifSyntaxTree::Formatter::TRAILING_COMMA
is defined.
Commits

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting@dependabot rebase
.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Bumpssyntax_tree from 4.3.0 to 5.0.0.
Changelog
Sourced fromsyntax_tree's changelog.
Commits
64f045b
Bump to v5.0.06677001
Merge pull request#195 from ruby-syntax-tree/typosa651a4e
Fix typos in READMee5298c9
Merge pull request#194 from ruby-syntax-tree/documentationcdede9b
Update documentation in the README43afc03
Merge pull request#193 from ruby-syntax-tree/silent-testsa1981d7
Document ignoring code8faf11e
Make the test suite silent09c816c
Merge pull request#192 from ruby-syntax-tree/more-naming8e31ca9
More naming changesDependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)