Class: BELParser::Language::Semantics::SemanticReturnTypeOf
- Inherits:
-
SemanticASTNode
- Object
- AST::Node
- SemanticASTNode
- BELParser::Language::Semantics::SemanticReturnTypeOf
- Defined in:
- lib/bel_parser/language/semantics_ast.rb
Overview
AST node for ReturnTypeOf is a semantic AST.
Instance Attribute Summary
Attributes inherited from AST::Node
Instance Method Summary collapse
-
#initialize(return_types, **properties) ⇒ SemanticReturnTypeOf
constructor
A new instance of SemanticReturnTypeOf.
- #match(identifier, spec, will_match_partial = false) ⇒ Object
- #return_types ⇒ Object
Methods inherited from SemanticASTNode
Methods inherited from AST::Node
#==, #append, #concat, #dup, #eql?, #inspect, #to_a, #to_ast, #to_bel, #to_s, #to_sexp, #updated
Methods included from Parsers
Constructor Details
#initialize(return_types, **properties) ⇒ SemanticReturnTypeOf
Returns a new instance of SemanticReturnTypeOf.
660 661 662 |
# File 'lib/bel_parser/language/semantics_ast.rb', line 660 def initialize(return_types, **properties) super(:return_type_of, return_types, properties) end |
Instance Method Details
#match(identifier, spec, will_match_partial = false) ⇒ Object
668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 |
# 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 ⇒ Object
664 665 666 |
# File 'lib/bel_parser/language/semantics_ast.rb', line 664 def return_types children end |