Method: Puppet::Pal::CatalogCompiler#evaluate

Defined in:
lib/puppet/pal/catalog_compiler.rb

#evaluate(ast) ⇒ Object

Evaluates an AST obtained from parse_string or parse_file in topscope. If the ast is a Puppet::Pops::Model::Program (what is returned from the parse methods, any definitions in the program (that is, any function, plan, etc. that is defined will be made available for use).

Parameters:



55
56
57
58
59
60
61
62
63
64
# File 'lib/puppet/pal/catalog_compiler.rb', line 55

def evaluate(ast)
  if ast.is_a?(Puppet::Pops::Model::Program)
    bridged = Puppet::Parser::AST::PopsBridge::Program.new(ast)
    # define all catalog types
    internal_compiler.environment.known_resource_types.import_ast(bridged, "")
    bridged.evaluate(internal_compiler.topscope)
  else
    internal_evaluator.evaluate(topscope, ast)
  end
end