(PDOC-19) Parse type information for defined types
I forgot to include the code which extracts the type information for the code object in the defined types handler. Without this we do not extract type information from defined types so warnings cannot be emitted and types in the documentation are listed as Unknown.
This commit is contained in:
parent
abf3b786c5
commit
2d2c03bc33
|
@ -8,6 +8,23 @@ class PuppetX::PuppetLabs::Strings::YARD::Handlers::DefinedTypeHandler < PuppetX
|
||||||
param_tuple << ( a[1].nil? ? nil : a[1].source )
|
param_tuple << ( a[1].nil? ? nil : a[1].source )
|
||||||
end
|
end
|
||||||
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
|
register obj
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue