~ubuntu-branches/ubuntu/wily/puppet/wily

« back to all changes in this revision

Viewing changes to lib/puppet/parser/ast/leaf.rb

  • Committer: Package Import Robot
  • Author(s): Stig Sandbeck Mathisen
  • Date: 2014-04-17 14:50:28 UTC
  • mfrom: (3.1.59 sid)
  • Revision ID: package-import@ubuntu.com-20140417145028-j3p3dwvp8ggpzvaf
Tags: 3.5.1-1
ImportedĀ upstreamĀ releaseĀ 3.5.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
169
169
        raise Puppet::ParseError, "Assigning to the hash '#{variable}' with an existing key '#{accesskey}' is forbidden"
170
170
      end
171
171
 
 
172
      mutation_deprecation()
 
173
 
172
174
      # assign to hash or array
173
175
      object[array_index_or_key(object, accesskey)] = value
174
176
    end
176
178
    def to_s
177
179
      "\$#{variable.to_s}[#{key.to_s}]"
178
180
    end
 
181
 
 
182
    def mutation_deprecation
 
183
      deprecation_location_text =
 
184
      if file && line
 
185
        " at #{file}:#{line}"
 
186
      elsif file
 
187
        " in file #{file}"
 
188
      elsif line
 
189
        " at #{line}"
 
190
      end
 
191
      Puppet.warning(["The use of mutating operations on Array/Hash is deprecated#{deprecation_location_text}.",
 
192
         " See http://links.puppetlabs.com/puppet-mutation-deprecation"].join(''))
 
193
    end
179
194
  end
180
195
 
181
196
  class Regex < AST::Leaf