diff options
author | Jesse Wolfe <jes5199@gmail.com> | 2010-09-09 16:20:26 -0700 |
---|---|---|
committer | Jesse Wolfe <jes5199@gmail.com> | 2010-09-09 16:20:26 -0700 |
commit | 6860594c4d95855d5106fbf664a473e1ac4d3935 (patch) | |
tree | 89ccd167744440199647c924be6ffa28eb7fb41a /lib/puppet/parser/ast/astarray.rb | |
parent | f62095749a14fd67987df5cf2e3e9138b71efd19 (diff) | |
parent | df088c9ba16dce50c17a79920c1ac186db67b9e9 (diff) | |
download | puppet-6860594c4d95855d5106fbf664a473e1ac4d3935.tar.gz puppet-6860594c4d95855d5106fbf664a473e1ac4d3935.tar.xz puppet-6860594c4d95855d5106fbf664a473e1ac4d3935.zip |
Merge remote branch 'paul/ticket/next/4638' into next
Diffstat (limited to 'lib/puppet/parser/ast/astarray.rb')
-rw-r--r-- | lib/puppet/parser/ast/astarray.rb | 34 |
1 files changed, 9 insertions, 25 deletions
diff --git a/lib/puppet/parser/ast/astarray.rb b/lib/puppet/parser/ast/astarray.rb index 432300c7a..b62c820ca 100644 --- a/lib/puppet/parser/ast/astarray.rb +++ b/lib/puppet/parser/ast/astarray.rb @@ -21,22 +21,8 @@ class Puppet::Parser::AST # Evaluate our children. def evaluate(scope) - # Make a new array, so we don't have to deal with the details of - # flattening and such - items = [] - - # First clean out any AST::ASTArrays - @children.each { |child| - if child.instance_of?(AST::ASTArray) - child.each do |ac| - items << ac - end - else - items << child - end - } - - rets = items.flatten.collect { |child| + result = [] + @children.each do |child| if child.respond_to? :instantiate if is_a_namespace # no problem, just don't evaluate it. @@ -48,10 +34,14 @@ class Puppet::Parser::AST raise error end else - child.safeevaluate(scope) + item = child.safeevaluate(scope) + if !item.nil? + # nil values are implicitly removed. + result.push(item) + end end - } - rets.reject { |o| o.nil? } + end + result end def push(*ary) @@ -69,10 +59,4 @@ class Puppet::Parser::AST "[" + @children.collect { |c| c.to_s }.join(', ') + "]" end end - - # A simple container class, containing the parameters for an object. - # Used for abstracting the grammar declarations. Basically unnecessary - # except that I kept finding bugs because I had too many arrays that - # meant completely different things. - class ResourceInstance < ASTArray; end end |