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

internal/wire: use set to determine which argument to use in zero-call injectors #223

Merged
merged 1 commit into from Nov 27, 2019

Conversation

zombiezen
Copy link
Collaborator

Fixes #222

@googlebot googlebot added the cla: yes Google CLA has been signed! label Nov 24, 2019
Copy link
Contributor

@shantuo shantuo left a comment

Choose a reason for hiding this comment

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

LGTM with one small question.

break
}
}
ig.p("\treturn %s", ig.paramNames[set.For(injectSig.out).Arg().Index])
Copy link
Contributor

Choose a reason for hiding this comment

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

Could Arg panic here due to some user error? If so, it might be worth to add a better error message.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Any error here should be due to a bug: the only reason that the zero-call case should be able to occur is when the injector function result should be coming directly from an argument.

@zombiezen zombiezen merged commit b730ad0 into google:master Nov 27, 2019
@zombiezen zombiezen deleted the fix-222 branch November 27, 2019 23:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Google CLA has been signed!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missed return statement in generated code
3 participants