# File lib/puppet/parser/ast/function.rb, line 13
13:     def evaluate(scope)
14:       # Make sure it's a defined function
15:       raise Puppet::ParseError, "Unknown function #{@name}" unless Puppet::Parser::Functions.function(@name)
16: 
17:       # Now check that it's been used correctly
18:       case @ftype
19:       when :rvalue
20:         raise Puppet::ParseError, "Function '#{@name}' does not return a value" unless Puppet::Parser::Functions.rvalue?(@name)
21:       when :statement
22:         if Puppet::Parser::Functions.rvalue?(@name)
23:           raise Puppet::ParseError,
24:             "Function '#{@name}' must be the value of a statement"
25:         end
26:       else
27:         raise Puppet::DevError, "Invalid function type #{@ftype.inspect}"
28:       end
29: 
30:       # We don't need to evaluate the name, because it's plaintext
31:       args = @arguments.safeevaluate(scope).map { |x| x == :undef ? '' : x }
32: 
33:       scope.send("function_#{@name}", args)
34:     end