Class: Rbs::Merge::Backends::RbsBackend::Tree Private
- Inherits:
-
TreeHaver::Base::Tree
- Object
- TreeHaver::Base::Tree
- Rbs::Merge::Backends::RbsBackend::Tree
- Defined in:
- lib/rbs/merge/backends/rbs_backend.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
RBS tree wrapper
Wraps RBS parse results to provide tree-sitter-compatible API.
Instance Attribute Summary collapse
-
#declarations ⇒ Array<::RBS::AST::Declarations::Base>
readonly
private
The declarations.
-
#directives ⇒ Array<::RBS::AST::Directives::Base>
readonly
private
The directives.
-
#errors ⇒ Array
readonly
private
Parse errors.
Instance Method Summary collapse
-
#has_errors? ⇒ Boolean
private
Check if the parse had errors.
-
#initialize(declarations, source: nil, directives: [], errors: []) ⇒ Tree
constructor
private
A new instance of Tree.
-
#inner_tree ⇒ Array<::RBS::AST::Declarations::Base>
private
Access the underlying declarations (passthrough) Overrides inner_tree to return declarations.
-
#root_node ⇒ Node
private
Get the root node of the parse tree.
Constructor Details
#initialize(declarations, source: nil, directives: [], errors: []) ⇒ Tree
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Tree.
222 223 224 225 226 227 |
# File 'lib/rbs/merge/backends/rbs_backend.rb', line 222 def initialize(declarations, source: nil, directives: [], errors: []) super(declarations, source: source) @declarations = declarations @directives = directives @errors = errors end |
Instance Attribute Details
#declarations ⇒ Array<::RBS::AST::Declarations::Base> (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the declarations.
214 215 216 |
# File 'lib/rbs/merge/backends/rbs_backend.rb', line 214 def declarations @declarations end |
#directives ⇒ Array<::RBS::AST::Directives::Base> (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the directives.
217 218 219 |
# File 'lib/rbs/merge/backends/rbs_backend.rb', line 217 def directives @directives end |
#errors ⇒ Array (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns parse errors.
220 221 222 |
# File 'lib/rbs/merge/backends/rbs_backend.rb', line 220 def errors @errors end |
Instance Method Details
#has_errors? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Check if the parse had errors
241 242 243 |
# File 'lib/rbs/merge/backends/rbs_backend.rb', line 241 def has_errors? @errors.any? end |
#inner_tree ⇒ Array<::RBS::AST::Declarations::Base>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Access the underlying declarations (passthrough)
Overrides inner_tree to return declarations
249 250 251 |
# File 'lib/rbs/merge/backends/rbs_backend.rb', line 249 def inner_tree @declarations end |
#root_node ⇒ Node
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Get the root node of the parse tree
Returns a synthetic “program” node that contains all declarations.
234 235 236 |
# File 'lib/rbs/merge/backends/rbs_backend.rb', line 234 def root_node Node.new_root(@declarations, source: source, lines: lines) end |