Class: Ibex::Frontend::ParseResult
- Inherits:
-
Object
- Object
- Ibex::Frontend::ParseResult
- Defined in:
- lib/ibex/frontend/diagnostic.rb,
sig/ibex/frontend/diagnostic.rbs
Overview
Immutable output from a diagnostic parse.
Instance Attribute Summary collapse
- #ast ⇒ AST::Root? readonly
- #diagnostics ⇒ Array[Diagnostic] readonly
- #document ⇒ SourceDocument? readonly
Instance Method Summary collapse
-
#initialize(diagnostics:, ast:, document:) ⇒ ParseResult
constructor
A new instance of ParseResult.
- #partial? ⇒ Boolean
- #success? ⇒ Boolean
Constructor Details
#initialize(diagnostics:, ast:, document:) ⇒ ParseResult
Returns a new instance of ParseResult.
63 64 65 66 67 68 |
# File 'lib/ibex/frontend/diagnostic.rb', line 63 def initialize(diagnostics:, ast:, document:) @diagnostics = diagnostics.dup.freeze @ast = ast @document = document freeze end |
Instance Attribute Details
#ast ⇒ AST::Root? (readonly)
59 60 61 |
# File 'lib/ibex/frontend/diagnostic.rb', line 59 def ast @ast end |
#diagnostics ⇒ Array[Diagnostic] (readonly)
58 59 60 |
# File 'lib/ibex/frontend/diagnostic.rb', line 58 def diagnostics @diagnostics end |
#document ⇒ SourceDocument? (readonly)
60 61 62 |
# File 'lib/ibex/frontend/diagnostic.rb', line 60 def document @document end |
Instance Method Details
#partial? ⇒ Boolean
76 77 78 |
# File 'lib/ibex/frontend/diagnostic.rb', line 76 def partial? diagnostics.any? && !ast.nil? end |
#success? ⇒ Boolean
71 72 73 |
# File 'lib/ibex/frontend/diagnostic.rb', line 71 def success? diagnostics.empty? && !ast.nil? end |