vendored/puppet/lib/puppet/functions/new.rb in bolt-0.7.0 vs vendored/puppet/lib/puppet/functions/new.rb in bolt-0.8.0
- old
+ new
@@ -12,13 +12,10 @@
optional_block_param
end
def new_instance(scope, t, *args)
return args[0] if args.size == 1 && !t.is_a?(Puppet::Pops::Types::PInitType) && t.instance?(args[0])
- result = catch :undefined_value do
- new_function_for_type(t, scope).call(scope, *args)
- end
- assert_type(t, result)
+ result = assert_type(t, new_function_for_type(t, scope).call(scope, *args))
return block_given? ? yield(result) : result
end
def new_function_for_type(t, scope)
@new_function_cache ||= Hash.new() {|hsh, key| hsh[key] = key.new_function.new(scope, loader) }