From aae9b2aa90c2f1e12baeebe530a0cd8a69fac9c2 Mon Sep 17 00:00:00 2001 From: luke Date: Fri, 3 Mar 2006 18:23:53 +0000 Subject: Definitions now always create their own context, which means that they cannot override elements in the containing scopes. git-svn-id: https://reductivelabs.com/svn/puppet/trunk@972 980ebf18-57e1-0310-9a29-db15c13687c0 --- lib/puppet/parser/ast/component.rb | 16 +++------------- lib/puppet/parser/ast/objectdef.rb | 4 ++-- 2 files changed, 5 insertions(+), 15 deletions(-) (limited to 'lib') diff --git a/lib/puppet/parser/ast/component.rb b/lib/puppet/parser/ast/component.rb index 0ecdb1d02..00677e1ea 100644 --- a/lib/puppet/parser/ast/component.rb +++ b/lib/puppet/parser/ast/component.rb @@ -24,24 +24,14 @@ class Puppet::Parser::AST :name => objname, :keyword => self.keyword ) - if hash[:newcontext] + newcontext = hash[:newcontext] + + unless self.is_a? AST::HostClass and ! newcontext #scope.warning "Setting context to %s" % self.object_id scope.context = self.object_id end @scope = scope - # The type is the component or class name - #scope.type = objtype - - # The name is the name the user has chosen or that has - # been dynamically generated. This is almost never used - #scope.name = objname - - #scope.keyword = self.keyword - - #if self.is_a?(Node) - # scope.isnodescope - #end # Additionally, add a tag for whatever kind of class # we are diff --git a/lib/puppet/parser/ast/objectdef.rb b/lib/puppet/parser/ast/objectdef.rb index 0b8d50e6d..59758b982 100644 --- a/lib/puppet/parser/ast/objectdef.rb +++ b/lib/puppet/parser/ast/objectdef.rb @@ -285,7 +285,7 @@ class Puppet::Parser::AST return true unless defined? @scope and @scope # Unless we can look up the type, throw an error - unless objtype = @scope.lookuptype(objtype) + unless typeobj = @scope.lookuptype(objtype) error = Puppet::ParseError.new( "Unknown type '%s'" % objtype ) @@ -297,7 +297,7 @@ class Puppet::Parser::AST # Now that we have the type, verify all of the parameters. # Note that we're now passing an AST Class object or whatever # as the type, not a simple string. - self.paramcheck(builtin, objtype) + self.paramcheck(builtin, typeobj) end end -- cgit