lib/contrast/agent/assess/policy/preshift.rb in contrast-agent-4.10.0 vs lib/contrast/agent/assess/policy/preshift.rb in contrast-agent-4.11.0
- old
+ new
@@ -81,22 +81,23 @@
Contrast::Agent::Assess::Tracker.copy(object, preshift.object)
end
def append_arg_details preshift, args
- preshift.args = args.dup
+ args_length = args.length
+ preshift.args = Array.new(args_length)
+ preshift.arg_lengths = Array.new(args_length)
idx = 0
- while idx < preshift.args.size
+ while idx < args_length
original_arg = args[idx]
- p_arg = preshift.args[idx]
+ p_arg = can_dup?(false, original_arg) ? original_arg.dup : original_arg
+ preshift.args[idx] = p_arg
+ preshift.arg_lengths[idx] = Contrast::Utils::DuckUtils.quacks_to?(p_arg, :length) ? p_arg.length : 0
idx += 1
next if p_arg.__id__ == original_arg.__id__
next unless Contrast::Agent::Assess::Tracker.tracked?(original_arg)
Contrast::Agent::Assess::Tracker.copy(original_arg, p_arg)
- end
- preshift.arg_lengths = preshift.args.map do |preshift_arg|
- Contrast::Utils::DuckUtils.quacks_to?(preshift_arg, :length) ? preshift_arg.length : 0
end
end
end
end
end