summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser/ast/astarray.rb
diff options
context:
space:
mode:
authorJesse Wolfe <jes5199@gmail.com>2010-11-03 19:58:38 -0700
committerJesse Wolfe <jes5199@gmail.com>2010-11-03 19:59:37 -0700
commit9e2a0e41dfb253a19180aeea6b66f65ca8d63133 (patch)
treef102b396669c074b59eab5c2e59c5145b5bae6ab /lib/puppet/parser/ast/astarray.rb
parentb1ef091d0209a59ac747568f83416e992db93ea8 (diff)
parent85543a41978924a42490d0c3f1f5437c95b7c869 (diff)
downloadpuppet-9e2a0e41dfb253a19180aeea6b66f65ca8d63133.tar.gz
puppet-9e2a0e41dfb253a19180aeea6b66f65ca8d63133.tar.xz
puppet-9e2a0e41dfb253a19180aeea6b66f65ca8d63133.zip
Merge commit '85543a4'
This updates `master` to the pre-agile-iteration state.
Diffstat (limited to 'lib/puppet/parser/ast/astarray.rb')
-rw-r--r--lib/puppet/parser/ast/astarray.rb35
1 files changed, 12 insertions, 23 deletions
diff --git a/lib/puppet/parser/ast/astarray.rb b/lib/puppet/parser/ast/astarray.rb
index 529998e3c..7283a1f6c 100644
--- a/lib/puppet/parser/ast/astarray.rb
+++ b/lib/puppet/parser/ast/astarray.rb
@@ -16,25 +16,20 @@ 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
+ result = []
+ @children.each do |child|
+ # Skip things that respond to :instantiate (classes, nodes,
+ # and definitions), because they have already been
+ # instantiated.
+ if !child.respond_to?(:instantiate)
+ item = child.safeevaluate(scope)
+ if !item.nil?
+ # nil values are implicitly removed.
+ result.push(item)
end
- else
- items << child
end
- }
-
- rets = items.flatten.collect { |child|
- child.safeevaluate(scope)
- }
- rets.reject { |o| o.nil? }
+ end
+ result
end
def push(*ary)
@@ -52,10 +47,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