From eda9d955b3fb2bbe5d7ca2cc3f7802d5fb9395ef Mon Sep 17 00:00:00 2001 From: luke Date: Mon, 27 Feb 2006 23:22:09 +0000 Subject: Fixing #64; multiple class definitions in the same scope is now an error, although using the same class name in different scopes is not an error. git-svn-id: https://reductivelabs.com/svn/puppet/trunk@956 980ebf18-57e1-0310-9a29-db15c13687c0 --- lib/puppet/parser/scope.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lib/puppet/parser') diff --git a/lib/puppet/parser/scope.rb b/lib/puppet/parser/scope.rb index e81664219..b441fd4bc 100644 --- a/lib/puppet/parser/scope.rb +++ b/lib/puppet/parser/scope.rb @@ -639,7 +639,13 @@ module Puppet # Define our type. def settype(name,ltype) - @typetable[name] = ltype + # Don't let them redefine the class in this scope. + if @typetable.include?(name) + raise Puppet::ParseError, + "%s is already defined" % name + else + @typetable[name] = ltype + end end # Return an interpolated string. -- cgit