lib/dentaku/ast/case/case_conditional.rb in dentaku-3.3.0 vs lib/dentaku/ast/case/case_conditional.rb in dentaku-3.3.1
- old
+ new
@@ -1,18 +1,21 @@
+require 'dentaku/exceptions'
+
module Dentaku
module AST
class CaseConditional < Node
attr_reader :when,
:then
def initialize(when_statement, then_statement)
@when = when_statement
unless @when.is_a?(AST::CaseWhen)
- raise 'Expected first argument to be a CaseWhen'
+ raise ParseError.for(:node_invalid), 'Expected first argument to be a CaseWhen'
end
+
@then = then_statement
unless @then.is_a?(AST::CaseThen)
- raise 'Expected second argument to be a CaseThen'
+ raise ParseError.for(:node_invalid), 'Expected second argument to be a CaseThen'
end
end
def dependencies(context = {})
@when.dependencies(context) + @then.dependencies(context)