Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(PDOC-135) Detect return_type calls in 4.x function dispatches #125

Merged
merged 1 commit into from
Nov 14, 2016

Conversation

whopper
Copy link
Contributor

@whopper whopper commented Nov 10, 2016

Previously, Strings ignored calls to return_type in Puppet 4.x API
function dispatches, preventing the return types of overloads from
being automatically determined. This commit adds a check for a node
with a return_type call and handles it properly.

log.warn "A duplicate block parameter was found for Puppet function '#{object.name}' at #{child.file}:#{child.line}."
if method_name == 'return_type'
overload_tag.tag(:return).types = [node_as_string(child.parameters[0])]
else
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could just do a next to get out of this conditional. Then there is no need to nest the rest of the logic under this conditional's else (right now there is a construct else if``which should really be anelseif- but since all other cases usenext` this case ('return_type') could use that as well as it is easier to read without the nesting.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hlindberg updated.

Previously, Strings ignored calls to `return_type` in Puppet 4.x API
function dispatches, preventing the return types of overloads from
being automatically determined. This commit adds a check for a node
with a `return_type` call and handles it properly.
@whopper whopper force-pushed the PDOC-135/4x_dispatch_return_type branch from e988b81 to 36bc0dd Compare November 14, 2016 19:04
@scotje scotje merged commit df8e58b into puppetlabs:master Nov 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants