Class: BELParser::Language::Semantics::FunctionDeprecation

Inherits:
Object
  • Object
show all
Includes:
SemanticsFunction
Defined in:
lib/bel_parser/language/semantics/function_deprecation.rb

Overview

FunctionDeprecation implements a SemanticsFunction that maps a Parsers::AST::Function to a SemanticsWarning if the referenced function is deprecated for the BELParser::Language::Specification.

Class Method Summary collapse

Class Method Details

.map(node, spec, _namespaces, will_match_partial = false) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/bel_parser/language/semantics/function_deprecation.rb', line 15

def self.map(node, spec, _namespaces, will_match_partial = false)
  return nil unless node.is_a?(BELParser::Parsers::AST::Function)
  return nil unless node.identifier

  function_name = node.identifier.string_literal
  func          = spec.function(function_name.to_sym)
  return nil unless func

  FunctionDeprecationWarning.new(node, spec, func) if func.deprecated?
end