Bumpssyntax_tree from 5.3.0 to 6.0.0.
Changelog
Sourced fromsyntax_tree's changelog.
[6.0.0] - 2023-02-10
Added
SyntaxTree::BasicVisitor::visit_methods
has been added to allow you to check multiple visit methods inside of a block. Therewas a method calledvisit_methods
previously, but it was undocumented because it was meant as a private API. That method has been renamed tovalid_visit_methods
.rake sorbet:rbi
has been added as a task within the repository to generate an RBI file corresponding to the nodes in the tree. This can be used to help aid consumers of Syntax Tree that are using Sorbet.SyntaxTree::Reflection
has been added to allow you to get information about the nodes in the tree. It is not required by default, since it takes a small amount of time to parsenode.rb
and get all of the information.SyntaxTree::Node#to_mermaid
has been added to allow you to generate a Mermaid diagram of the node and its children. This is useful for debugging and understanding the structure of the tree.SyntaxTree::Translation
has been added as an experimental API to transform the Syntax Tree syntax tree into the syntax trees represented by the whitequark/parser and rubocop/rubocop-ast gems.SyntaxTree::Translation.to_parser(node, buffer)
will return aParser::AST::Node
object.SyntaxTree::Translation.to_rubocop_ast(node, buffer)
will return aRuboCop::AST::Node
object.
SyntaxTree::index
andSyntaxTree::index_file
have been added to allow you to get a list of all of the classes, modules, and methods defined in a given source string or file.- Various convenience methods have been added:
SyntaxTree::format_file
- which calls format with the result of reading the fileSyntaxTree::format_node
- which formats the node directlySyntaxTree::parse_file
- which calls parse with the result of reading the fileSyntaxTree::search_file
- which calls search with the result of reading the fileSyntaxTree::Node#start_char
- which is the same as callingnode.location.start_char
SyntaxTree::Node#end_char
- which is the same as callingnode.location.end_char
SyntaxTree::Assoc
nodes can now be formatted on their own without a parent hash node.SyntaxTree::BlockVar#arg0?
has been added to check if a single required block parameter is present and would potentially be expanded.- More experimental APIs have been added to the
SyntaxTree::YARV
module, including:SyntaxTree::YARV::ControlFlowGraph
SyntaxTree::YARV::DataFlowGraph
SyntaxTree::YARV::SeaOfNodes
Changed
Major changes
- BREAKING Updates to
WithEnvironment
:- The
WithEnvironment
module has been renamed toWithScope
. - The
current_environment
method has been renamed tocurrent_scope
. - The
with_current_environment
method has been removed. - Previously scopes were always able to look up the tree, as in:
a = 1; def foo; a = 2; end
would see only a singlea
variable. That has been corrected. - Previously accessing variables from inside of blocks that were not shadowed would mark them as being local to the block only. This has been correct.
- BREAKING Lots of constants moved out of
SyntaxTree::Visitor
to justSyntaxTree
:SyntaxTree::Visitor::FieldVisitor
is nowSyntaxTree::FieldVisitor
SyntaxTree::Visitor::JSONVisitor
is nowSyntaxTree::JSONVisitor
SyntaxTree::Visitor::MatchVisitor
is nowSyntaxTree::MatchVisitor
SyntaxTree::Visitor::MutationVisitor
is nowSyntaxTree::MutationVisitor
SyntaxTree::Visitor::PrettyPrintVisitor
is nowSyntaxTree::PrettyPrintVisitor
- BREAKING Lots of constants are now autoloaded instead of required by default. This is only particularly relevant if you are in a forking environment and want to preload constants before forking for better memory usage with copy-on-write.
- BREAKING The
SyntaxTree::Statements#initialize
method no longer accepts a parser as the first argument. It now mirrors the other nodes in that it accepts its children and location. As a result, Syntax Tree nodes are now marshalable (and therefore can be sent over DRb). Previously theStatements
node was not able to be marshaled because it held a reference to the parser.
Minor changes
- Many places where embedded documents (
=begin
to=end
) were being treated as real comments have been fixed for formatting. - Dynamic symbols in keyword pattern matching now have better formatting.
- Endless method definitions used to have a
SyntaxTree::BodyStmt
node that had any kind of node as itsstatements
field. That has been corrected to be more consistent such that now going fromdef_node.bodystmt.statements
always returns aSyntaxTree::Statements
node, which is more consistent.
... (truncated)
Commits
4dac90b
Bump to version 6.0.0cfc2979
Remove unused sections of rubocop config575ae3e
No submodules needed0068978
Pinned variables should be treated as usages, not definitions7419218
Merge pull request#309 from ruby-syntax-tree/updates4a6fc77
WithEnvironment -> WithScope174cc6b
Make environment break at boundaries1a20231
Use visit_methods {}0dd0276
More utility functions0cf3e85
Autoload a bunch of stuff- Additional commits viewable incompare view

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 5.3.0 to 6.0.0.
Changelog
Sourced fromsyntax_tree's changelog.
... (truncated)
Commits
4dac90b
Bump to version 6.0.0cfc2979
Remove unused sections of rubocop config575ae3e
No submodules needed0068978
Pinned variables should be treated as usages, not definitions7419218
Merge pull request#309 from ruby-syntax-tree/updates4a6fc77
WithEnvironment -> WithScope174cc6b
Make environment break at boundaries1a20231
Use visit_methods {}0dd0276
More utility functions0cf3e85
Autoload a bunch of stuffDependabot 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)