summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser/ast/astarray.rb
diff options
context:
space:
mode:
authorJesse Wolfe <jes5199@gmail.com>2010-09-09 16:29:26 -0700
committerJesse Wolfe <jes5199@gmail.com>2010-09-09 16:29:26 -0700
commit1d93c4dd86181eb2663dd8df2e84719c2e1ffcdf (patch)
treefc0e6feee2558d0a59e70c3f7e3b16dee72f0235 /lib/puppet/parser/ast/astarray.rb
parent6860594c4d95855d5106fbf664a473e1ac4d3935 (diff)
parentce9bf1edcaac4901de6e0a7da413d1742d216eb0 (diff)
downloadpuppet-1d93c4dd86181eb2663dd8df2e84719c2e1ffcdf.tar.gz
puppet-1d93c4dd86181eb2663dd8df2e84719c2e1ffcdf.tar.xz
puppet-1d93c4dd86181eb2663dd8df2e84719c2e1ffcdf.zip
Merge remote branch 'paul/ticket/next/4685' into next
Conflicts resolved manually, by Paul Berry: lib/puppet/parser/ast/astarray.rb lib/puppet/parser/grammar.ra lib/puppet/parser/parser.rb (by rebuilding from grammar.ra)
Diffstat (limited to 'lib/puppet/parser/ast/astarray.rb')
-rw-r--r--lib/puppet/parser/ast/astarray.rb20
1 files changed, 4 insertions, 16 deletions
diff --git a/lib/puppet/parser/ast/astarray.rb b/lib/puppet/parser/ast/astarray.rb
index b62c820ca..7283a1f6c 100644
--- a/lib/puppet/parser/ast/astarray.rb
+++ b/lib/puppet/parser/ast/astarray.rb
@@ -9,11 +9,6 @@ class Puppet::Parser::AST
class ASTArray < Branch
include Enumerable
- # True if this ASTArray represents a list of statements in a
- # context that defines a namespace. Classes and definitions may
- # only appear in such a context.
- attr_accessor :is_a_namespace
-
# Return a child by index. Probably never used.
def [](index)
@children[index]
@@ -23,17 +18,10 @@ class Puppet::Parser::AST
def evaluate(scope)
result = []
@children.each do |child|
- if child.respond_to? :instantiate
- if is_a_namespace
- # no problem, just don't evaluate it.
- else
- msg = "Classes, definitions, and nodes may only appear at toplevel or inside other classes"
- error = Puppet::Error.new(msg)
- error.line = child.line
- error.file = child.file
- raise error
- end
- else
+ # 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.