diff options
Diffstat (limited to 'lib/puppet/parser/ast/component.rb')
-rw-r--r-- | lib/puppet/parser/ast/component.rb | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/puppet/parser/ast/component.rb b/lib/puppet/parser/ast/component.rb index 00677e1ea..50e8df5a8 100644 --- a/lib/puppet/parser/ast/component.rb +++ b/lib/puppet/parser/ast/component.rb @@ -14,12 +14,12 @@ class Puppet::Parser::AST #def evaluate(scope,hash,objtype,objname) def evaluate(hash) - scope = hash[:scope] + origscope = hash[:scope] objtype = hash[:type] objname = hash[:name] arguments = hash[:arguments] || {} - scope = scope.newscope( + scope = origscope.newscope( :type => @type, :name => objname, :keyword => self.keyword @@ -95,9 +95,14 @@ class Puppet::Parser::AST # Now just evaluate the code with our new bindings. self.code.safeevaluate(:scope => scope) - # We return the scope, so that our children can make their scopes - # under ours. This allows them to find our definitions. - return scope + # If we're being evaluated as a parent class, we want to return the + # scope, so it can be overridden and such, but if not, we want to + # return a TransBucket of our objects. + if hash.include?(:asparent) + return scope + else + return scope.to_trans + end end # Check whether a given argument is valid. Searches up through |