From 58a73b5c68485dc5d41a46936c31e5fad5f037b5 Mon Sep 17 00:00:00 2001 From: Brice Figureau Date: Tue, 28 Jul 2009 19:42:24 +0200 Subject: Make sure node are referenced by their names This patch uses the unused AST::HostName as the only way to reference a node in the AST nodes array. The AST::HostName respect the hash properties of the underlying string, to keep the O(1) hash properties. Signed-off-by: Brice Figureau --- lib/puppet/parser/parser_support.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/puppet/parser/parser_support.rb') diff --git a/lib/puppet/parser/parser_support.rb b/lib/puppet/parser/parser_support.rb index e1af2fe82..b13fbb47f 100644 --- a/lib/puppet/parser/parser_support.rb +++ b/lib/puppet/parser/parser_support.rb @@ -354,7 +354,7 @@ class Puppet::Parser::Parser names = [names] unless names.instance_of?(Array) doc = lexer.getcomment names.collect do |name| - name = name.to_s.downcase + name = AST::HostName.new :value => name unless name.is_a?(AST::HostName) if other = @loaded_code.node(name) error("Node %s is already defined at %s:%s; cannot redefine" % [other.name, other.file, other.line]) end @@ -372,7 +372,7 @@ class Puppet::Parser::Parser args[:parentclass] = options[:parent] end node = ast(AST::Node, args) - node.classname = name + node.classname = name.to_classname @loaded_code.add_node(name, node) node end -- cgit