class BELParser::Language::Semantics::SemanticReturnTypeOf

AST node for ReturnTypeOf is a semantic AST.

Public Class Methods

new(return_types, **properties) click to toggle source
# File lib/bel_parser/language/semantics_ast.rb, line 660
def initialize(return_types, **properties)
  super(:return_type_of, return_types, properties)
end

Public Instance Methods

match(identifier, spec, will_match_partial = false) click to toggle source
# File lib/bel_parser/language/semantics_ast.rb, line 668
def match(identifier, spec, will_match_partial = false)
  return success(identifier, spec) if return_types.include?(:*)

  function = spec.function(identifier.string_literal.to_sym)
  return invalid_return_type_warning(
    identifier,
    spec,
    return_types) unless function

  if return_types.any? { |rt| function.return_type <= rt }
    success(identifier, spec)
  else
    invalid_return_type_warning(identifier, spec, return_types)
  end
end
return_types() click to toggle source
# File lib/bel_parser/language/semantics_ast.rb, line 664
def return_types
  children
end