Method: Puppet::Parser::Scope#initialize
- Defined in:
- lib/puppet/parser/scope.rb
#initialize(compiler, source: nil, resource: nil) ⇒ Scope
Initialize our new scope. Defaults to having no parent.
373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 |
# File 'lib/puppet/parser/scope.rb', line 373 def initialize(compiler, source: nil, resource: nil) if compiler.is_a? Puppet::Parser::AbstractCompiler @compiler = compiler else raise Puppet::DevError, _("you must pass a compiler instance to a new scope object") end @source = source @resource = resource extend_with_functions_module # The symbol table for this scope. This is where we store variables. # @symtable = Ephemeral.new(nil, true) @symtable = LocalScope.new(nil) @ephemeral = [MatchScope.new(@symtable, nil)] # All of the defaults set for types. It's a hash of hashes, # with the first key being the type, then the second key being # the parameter. @defaults = Hash.new { |dhash, type| dhash[type] = {} } # The table for storing class singletons. This will only actually # be used by top scopes and node scopes. @class_scopes = {} end |