diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-08-28 04:50:59 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-08-28 04:50:59 +0000 |
commit | ad32b716d82576c98e708e6dbbcec60f0372e54c (patch) | |
tree | 1509e5afdd1e174816b8e0f2f14aba019c627b6c /lib/puppet/parser/ast | |
parent | db0be8e38044b8aaaf9469c5c461c84295b55732 (diff) | |
download | puppet-ad32b716d82576c98e708e6dbbcec60f0372e54c.tar.gz puppet-ad32b716d82576c98e708e6dbbcec60f0372e54c.tar.xz puppet-ad32b716d82576c98e708e6dbbcec60f0372e54c.zip |
Tracking down some weird bugs that managed to creep into the parser. I expect that the main ones were a result of the If support.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1494 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/parser/ast')
-rw-r--r-- | lib/puppet/parser/ast/classdef.rb | 8 | ||||
-rw-r--r-- | lib/puppet/parser/ast/compdef.rb | 22 | ||||
-rw-r--r-- | lib/puppet/parser/ast/component.rb | 5 | ||||
-rw-r--r-- | lib/puppet/parser/ast/objectdef.rb | 12 |
4 files changed, 29 insertions, 18 deletions
diff --git a/lib/puppet/parser/ast/classdef.rb b/lib/puppet/parser/ast/classdef.rb index cb66b3a8a..336cf0189 100644 --- a/lib/puppet/parser/ast/classdef.rb +++ b/lib/puppet/parser/ast/classdef.rb @@ -5,6 +5,8 @@ class Puppet::Parser::AST # but classes are always singletons -- only one can exist on a given # host. class ClassDef < AST::CompDef + @keyword = "class" + def self.genclass AST::HostClass end @@ -55,12 +57,6 @@ class Puppet::Parser::AST end end - def initialize(hash) - @parentclass = nil - @keyword = "class" - super - end - def tree(indent = 0) #@args.tree(indent + 1), return [ diff --git a/lib/puppet/parser/ast/compdef.rb b/lib/puppet/parser/ast/compdef.rb index 696e178e1..b6cd6491f 100644 --- a/lib/puppet/parser/ast/compdef.rb +++ b/lib/puppet/parser/ast/compdef.rb @@ -9,7 +9,15 @@ class Puppet::Parser::AST # encounter an error if the component is instantiated more than # once. class CompDef < AST::Branch - attr_accessor :type, :args, :code, :keyword, :scope, :parentclass + attr_accessor :type, :args, :code, :scope, :parentclass + attr_writer :keyword + + @keyword = "define" + + class << self + attr_reader :keyword + end + def self.genclass AST::Component @@ -33,6 +41,7 @@ class Puppet::Parser::AST arghash[:parentclass] = @parentclass.safeevaluate(:scope => scope) end + begin comp = self.class.genclass.new(arghash) comp.keyword = self.keyword @@ -53,9 +62,6 @@ class Puppet::Parser::AST def initialize(hash) @parentclass = nil @args = nil - - # Set a default keyword - @keyword = "define" super #if @parentclass @@ -66,6 +72,14 @@ class Puppet::Parser::AST #Puppet.debug "Defining type %s" % @type.value end + def keyword + if defined? @keyword + @keyword + else + self.class.keyword + end + end + def tree(indent = 0) return [ @type.tree(indent + 1), diff --git a/lib/puppet/parser/ast/component.rb b/lib/puppet/parser/ast/component.rb index 4d930f6a5..2621c76ad 100644 --- a/lib/puppet/parser/ast/component.rb +++ b/lib/puppet/parser/ast/component.rb @@ -16,7 +16,6 @@ class Puppet::Parser::AST # These are retrieved when looking up the superclass attr_accessor :name, :arguments - #def evaluate(scope,hash,objtype,objname) def evaluate(hash) origscope = hash[:scope] objtype = hash[:type] @@ -108,9 +107,9 @@ class Puppet::Parser::AST end # Now just evaluate the code with our new bindings. - scope.inside(self) do + #scope.inside(self) do # part of definition inheritance self.code.safeevaluate(:scope => scope) - end + #end # 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 diff --git a/lib/puppet/parser/ast/objectdef.rb b/lib/puppet/parser/ast/objectdef.rb index 63577b60d..cdcbd1aca 100644 --- a/lib/puppet/parser/ast/objectdef.rb +++ b/lib/puppet/parser/ast/objectdef.rb @@ -33,12 +33,13 @@ class Puppet::Parser::AST # Get our type and name. objtype = @type.safeevaluate(:scope => scope) - if objtype == "super" - objtype = supertype() - @subtype = true - else + # Disable definition inheritance, for now. 8/27/06, luke + #if objtype == "super" + # objtype = supertype() + # @subtype = true + #else @subtype = false - end + #end # If the type was a variable, we wouldn't have typechecked yet. # Do it now, if so. @@ -70,6 +71,7 @@ class Puppet::Parser::AST } # Now collect info from our parent. + parentname = nil if @subtype parentname = supersetup(hash) end |