Class: BELParser::Language::Semantics::SemanticsArgumentLengthWarning

Inherits:
SemanticsWarning show all
Defined in:
lib/bel_parser/language/semantics_ast_warnings.rb

Instance Attribute Summary collapse

Attributes inherited from SemanticsResult

#expression_node, #specification

Instance Method Summary collapse

Methods inherited from SemanticsWarning

#failure?, #success?

Methods inherited from SemanticsResult

#failure?, #msg, #success?

Constructor Details

#initialize(expression_node, spec, expected, actual) ⇒ SemanticsArgumentLengthWarning

Returns a new instance of SemanticsArgumentLengthWarning.



50
51
52
53
54
# File 'lib/bel_parser/language/semantics_ast_warnings.rb', line 50

def initialize(expression_node, spec, expected, actual)
  super(expression_node, spec)
  @expected_length = expected.arguments.length
  @actual_length   = actual.arguments.length
end

Instance Attribute Details

#actual_typeObject (readonly)

Returns the value of attribute actual_type.



48
49
50
# File 'lib/bel_parser/language/semantics_ast_warnings.rb', line 48

def actual_type
  @actual_type
end

#expected_typeObject (readonly)

Returns the value of attribute expected_type.



48
49
50
# File 'lib/bel_parser/language/semantics_ast_warnings.rb', line 48

def expected_type
  @expected_type
end

Instance Method Details

#to_sObject



56
57
58
# File 'lib/bel_parser/language/semantics_ast_warnings.rb', line 56

def to_s
  %(Expected #@expected_length arguments, but saw #@actual_length arguments.)
end