Class: Dentaku::AST::CaseConditional
- Defined in:
- lib/dentaku/ast/case/case_conditional.rb
Instance Attribute Summary collapse
-
#then ⇒ Object
readonly
Returns the value of attribute then.
-
#when ⇒ Object
readonly
Returns the value of attribute when.
Class Method Summary collapse
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #dependencies(context = {}) ⇒ Object
-
#initialize(when_statement, then_statement) ⇒ CaseConditional
constructor
A new instance of CaseConditional.
Methods inherited from Node
arity, #name, precedence, resolve_class, #type
Constructor Details
#initialize(when_statement, then_statement) ⇒ CaseConditional
Returns a new instance of CaseConditional.
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/dentaku/ast/case/case_conditional.rb', line 17 def initialize(when_statement, then_statement) @when = when_statement unless @when.is_a?(AST::CaseWhen) raise ParseError.for(:node_invalid), 'Expected first argument to be a CaseWhen' end @then = then_statement unless @then.is_a?(AST::CaseThen) raise ParseError.for(:node_invalid), 'Expected second argument to be a CaseThen' end end |
Instance Attribute Details
#then ⇒ Object (readonly)
Returns the value of attribute then.
6 7 8 |
# File 'lib/dentaku/ast/case/case_conditional.rb', line 6 def then @then end |
#when ⇒ Object (readonly)
Returns the value of attribute when.
6 7 8 |
# File 'lib/dentaku/ast/case/case_conditional.rb', line 6 def when @when end |
Class Method Details
.max_param_count ⇒ Object
13 14 15 |
# File 'lib/dentaku/ast/case/case_conditional.rb', line 13 def self.max_param_count 2 end |
.min_param_count ⇒ Object
9 10 11 |
# File 'lib/dentaku/ast/case/case_conditional.rb', line 9 def self.min_param_count 2 end |
Instance Method Details
#accept(visitor) ⇒ Object
33 34 35 |
# File 'lib/dentaku/ast/case/case_conditional.rb', line 33 def accept(visitor) visitor.visit_case_conditional(self) end |
#dependencies(context = {}) ⇒ Object
29 30 31 |
# File 'lib/dentaku/ast/case/case_conditional.rb', line 29 def dependencies(context = {}) @when.dependencies(context) + @then.dependencies(context) end |