summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser/ast
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-02-28 03:32:51 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-02-28 03:32:51 +0000
commit8b5f70911d7486a5cab69377c1988f1e35d88d2e (patch)
treea8db890dbe5a28e679c86ca15e775eb77f6a0a59 /lib/puppet/parser/ast
parenteda9d955b3fb2bbe5d7ca2cc3f7802d5fb9395ef (diff)
downloadpuppet-8b5f70911d7486a5cab69377c1988f1e35d88d2e.tar.gz
puppet-8b5f70911d7486a5cab69377c1988f1e35d88d2e.tar.xz
puppet-8b5f70911d7486a5cab69377c1988f1e35d88d2e.zip
Fixing bug #60. Converting nodes to use types everywhere instead of names, and adding a localobjectable to keep track of what parameters have been defined locally.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@957 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/parser/ast')
-rw-r--r--lib/puppet/parser/ast/node.rb4
-rw-r--r--lib/puppet/parser/ast/objectdef.rb82
2 files changed, 38 insertions, 48 deletions
diff --git a/lib/puppet/parser/ast/node.rb b/lib/puppet/parser/ast/node.rb
index 97e8de06e..32bed7a2b 100644
--- a/lib/puppet/parser/ast/node.rb
+++ b/lib/puppet/parser/ast/node.rb
@@ -75,10 +75,6 @@ class Puppet::Parser::AST
scope.tag(node.type)
end
- if name = node.name
- scope.tag(node.name) unless name == type
- end
-
begin
code = node.code
code.safeevaluate(:scope => scope)
diff --git a/lib/puppet/parser/ast/objectdef.rb b/lib/puppet/parser/ast/objectdef.rb
index abd709a84..0b8d50e6d 100644
--- a/lib/puppet/parser/ast/objectdef.rb
+++ b/lib/puppet/parser/ast/objectdef.rb
@@ -80,53 +80,47 @@ class Puppet::Parser::AST
objnames.collect { |objname|
# If the object is a class, that means it's a builtin type, so
# we just store it in the scope
- unless object
- unless objname
- raise Puppet::ParseError,
- "Object of type %s created with no name" % objtype
- end
-
- begin
- #Puppet.debug(
- # ("Setting object '%s' " +
- # "in scope %s " +
- # "with arguments %s") %
- # [objname, scope.object_id, hash.inspect]
- #)
- obj = scope.setobject(
- :type => objtype,
- :name => objname,
- :arguments => hash,
- :file => @file,
- :line => @line
- )
- rescue Puppet::ParseError => except
- except.line = self.line
- except.file = self.file
- raise except
- rescue => detail
- error = Puppet::ParseError.new(detail)
- error.line = self.line
- error.file = self.file
- error.backtrace = detail.backtrace
- raise error
- end
- else
- # but things like components create a new type; if we find
- # one of those, evaluate that with our arguments
- #Puppet.debug("Calling object '%s' with arguments %s" %
- # [object.name, hash.inspect])
- #obj = object.safeevaluate(scope,hash,objtype,objname)
- obj = object.safeevaluate(
- :scope => scope,
- :arguments => hash,
+ begin
+ #Puppet.debug(
+ # ("Setting object '%s' " +
+ # "in scope %s " +
+ # "with arguments %s") %
+ # [objname, scope.object_id, hash.inspect]
+ #)
+ obj = scope.setobject(
:type => objtype,
- :name => objname
+ :name => objname,
+ :arguments => hash,
+ :file => @file,
+ :line => @line
)
-
- # and pass the result on
- obj
+ rescue Puppet::ParseError => except
+ except.line = self.line
+ except.file = self.file
+ raise except
+ rescue => detail
+ error = Puppet::ParseError.new(detail)
+ error.line = self.line
+ error.file = self.file
+ error.backtrace = detail.backtrace
+ raise error
end
+# else
+# # but things like components create a new type; if we find
+# # one of those, evaluate that with our arguments
+# #Puppet.debug("Calling object '%s' with arguments %s" %
+# # [object.name, hash.inspect])
+# #obj = object.safeevaluate(scope,hash,objtype,objname)
+# obj = object.safeevaluate(
+# :scope => scope,
+# :arguments => hash,
+# :type => objtype,
+# :name => objname
+# )
+#
+# # and pass the result on
+# obj
+# end
}.reject { |obj| obj.nil? }
end