Class: TypeScript::Merge::FileAnalysis
- Inherits:
-
Object
- Object
- TypeScript::Merge::FileAnalysis
- Defined in:
- lib/typescript/merge/file_analysis.rb,
sig/typescript/merge.rbs
Overview
Native TreeHaver analysis of safely attributable top-level TypeScript source. rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity -- one AST pass establishes ordered ownership and comment attachment
Instance Attribute Summary collapse
-
#backend ⇒ Symbol
readonly
Returns the value of attribute backend.
-
#declarations ⇒ Array[NodeWrapper]
readonly
Returns the value of attribute declarations.
-
#dialect ⇒ Symbol
readonly
Returns the value of attribute dialect.
-
#errors ⇒ Array[StandardError]
readonly
Returns the value of attribute errors.
-
#root_node ⇒ Object
readonly
Returns the value of attribute root_node.
-
#source ⇒ String
readonly
Returns the value of attribute source.
Instance Method Summary collapse
-
#initialize(source, dialect: :typescript) ⇒ FileAnalysis
constructor
A new instance of FileAnalysis.
Constructor Details
#initialize(source, dialect: :typescript) ⇒ FileAnalysis
Returns a new instance of FileAnalysis.
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/typescript/merge/file_analysis.rb', line 10 def initialize(source, dialect: :typescript) @source = source @dialect = dialect.to_sym @backend = TREE_SITTER_BACKEND.id.to_sym @errors = [] parse! rescue StandardError => e @root_node = nil @declarations = [].freeze @errors = [e].freeze end |
Instance Attribute Details
#backend ⇒ Symbol (readonly)
Returns the value of attribute backend.
8 9 10 |
# File 'lib/typescript/merge/file_analysis.rb', line 8 def backend @backend end |
#declarations ⇒ Array[NodeWrapper] (readonly)
Returns the value of attribute declarations.
8 9 10 |
# File 'lib/typescript/merge/file_analysis.rb', line 8 def declarations @declarations end |
#dialect ⇒ Symbol (readonly)
Returns the value of attribute dialect.
8 9 10 |
# File 'lib/typescript/merge/file_analysis.rb', line 8 def dialect @dialect end |
#errors ⇒ Array[StandardError] (readonly)
Returns the value of attribute errors.
8 9 10 |
# File 'lib/typescript/merge/file_analysis.rb', line 8 def errors @errors end |
#root_node ⇒ Object (readonly)
Returns the value of attribute root_node.
8 9 10 |
# File 'lib/typescript/merge/file_analysis.rb', line 8 def root_node @root_node end |
#source ⇒ String (readonly)
Returns the value of attribute source.
8 9 10 |
# File 'lib/typescript/merge/file_analysis.rb', line 8 def source @source end |