summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-05-12 22:22:45 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-05-12 22:22:45 +0000
commit678e14286f441524955c76fcfca6abace7106774 (patch)
tree06d37afc1841edcefeae23d5ad9f245df5ebdfa8 /lib/puppet/parser
parent578cf7e575c4bb3a297506c75035aed2b2ef607b (diff)
downloadpuppet-678e14286f441524955c76fcfca6abace7106774.tar.gz
puppet-678e14286f441524955c76fcfca6abace7106774.tar.xz
puppet-678e14286f441524955c76fcfca6abace7106774.zip
Fixing #141. It was a problem related to the recent parser changes I made.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1185 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/parser')
-rw-r--r--lib/puppet/parser/ast/hostclass.rb32
-rw-r--r--lib/puppet/parser/scope.rb1
2 files changed, 22 insertions, 11 deletions
diff --git a/lib/puppet/parser/ast/hostclass.rb b/lib/puppet/parser/ast/hostclass.rb
index a69d185e0..85beecfe7 100644
--- a/lib/puppet/parser/ast/hostclass.rb
+++ b/lib/puppet/parser/ast/hostclass.rb
@@ -9,7 +9,6 @@ class Puppet::Parser::AST
#def evaluate(scope,hash,objtype,objname)
def evaluate(hash)
scope = hash[:scope]
- objtype = hash[:type]
objname = hash[:name]
args = hash[:arguments]
# Verify that we haven't already been evaluated
@@ -24,22 +23,25 @@ class Puppet::Parser::AST
# during the evaluation and can be inspected.
scope.setclass(self.object_id, @type)
+ origscope = scope
+
# Default to creating a new context
newcontext = true
- transscope = nil
- if parentscope = self.evalparent(
+
+ # If we've got a parent, then we pass it the original scope we
+ # received. It will get passed all the way up to the top class,
+ # which will create a subscope and pass that subscope to its
+ # subclass.
+ if @parentscope = self.evalparent(
:scope => scope, :arguments => args, :name => objname
)
- # Override our scope binding with the parent scope
- # binding. This is quite hackish, but I can't think
- # of another way to make sure our scopes end up under
- # our parent scopes.
- if parentscope.is_a? Puppet::TransBucket
+ if @parentscope.is_a? Puppet::TransBucket
raise Puppet::DevError, "Got a bucket instead of a scope"
end
- scope = parentscope
- transscope = parentscope
+ # Override our scope binding with the parent scope
+ # binding.
+ scope = @parentscope
# But don't create a new context if our parent created one
newcontext = false
@@ -67,6 +69,16 @@ class Puppet::Parser::AST
# If we're a parent class, then return the scope object itself.
return result
else
+ transscope = nil
+ if @parentscope
+ transscope = @parentscope
+ until transscope.parent.object_id == origscope.object_id
+ transscope = transscope.parent
+ end
+ else
+ transscope = result
+ end
+
# But if we're the final subclass, translate the whole scope tree
# into TransObjects and TransBuckets.
return transscope.to_trans
diff --git a/lib/puppet/parser/scope.rb b/lib/puppet/parser/scope.rb
index 98ebe593a..03370558d 100644
--- a/lib/puppet/parser/scope.rb
+++ b/lib/puppet/parser/scope.rb
@@ -810,7 +810,6 @@ module Puppet::Parser
results = []
@children.dup.each do |child|
-
if @@done.include?(child)
raise Puppet::DevError, "Already translated %s" % child.object_id
else