class BELParser::Language::Semantics::FunctionDeprecation

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

Public Class Methods

map(node, spec, _namespaces, will_match_partial = false) click to toggle source
# 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