Skip to content

Commit

Permalink
Merge pull request #42 from iankronquist/forgot-defined-types
Browse files Browse the repository at this point in the history
Forgot defined types
  • Loading branch information
HAIL9000 committed Jul 28, 2015
2 parents abf3b78 + 9083023 commit e9167b1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,23 @@ class PuppetX::PuppetLabs::Strings::YARD::Handlers::DefinedTypeHandler < PuppetX
param_tuple << ( a[1].nil? ? nil : a[1].source )
end
end
tp = Puppet::Pops::Types::TypeParser.new
param_type_info = {}
statement.pops_obj.parameters.each do |pop_param|
# If the parameter's type expression is nil, default to Any
if pop_param.type_expr == nil
param_type_info[pop_param.name] = Puppet::Pops::Types::TypeFactory.any()
else
begin
param_type_info[pop_param.name] = tp.interpret_any(pop_param.type_expr)
rescue Puppet::ParseError => e
# If the type could not be interpreted insert a prominent warning
param_type_info[pop_param.name] = "Type Error: #{e.message}"
end
end
end
obj.type_info = [param_type_info]


register obj
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def generate_parameters(params, object)
end
# Give up. It can probably be anything.
elsif !param[:puppet_3_func]
result << "(<tt>Unkown</tt>)"
result << "(<tt>Unknown</tt>)"
end

result << "</span>"
Expand Down

0 comments on commit e9167b1

Please sign in to comment.