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

Param names in ast v2 #17

Merged
merged 13 commits into from
Jun 9, 2016
Merged

Param names in ast v2 #17

merged 13 commits into from
Jun 9, 2016

Conversation

fran-worley
Copy link
Contributor

This updates the AST to include predicate argument names and is a much cleaner solution than #13.

@solnic your thoughts please?

This changes the AST to include param names even when predicates are
curried.

Currently failing as we need to capture call args somehow to enable
correct AST generation for results.
inject input into rule and predicate ast
(fixes failures in dry-validation with each & schema)
curry_args = predicate.respond_to?(:arity) && predicate.arity != 0 ? args : []
if predicate.is_a?(Proc)
predicate.curry[*curry_args]
elsif predicate != nil
Copy link
Member

Choose a reason for hiding this comment

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

this looks suspicious, a rule with a nil predicate means there's a bug in our code, we shouldn't have a guard like that

@fran-worley
Copy link
Contributor Author

We've got to add specs to the rule compiler & update it to work with the new ast
https://github.com/dry-rb/dry-logic/blob/master/lib/dry/logic/rule_compiler.rb#L54

@solnic solnic merged commit 2f26dfd into master Jun 9, 2016
@solnic solnic deleted the param_names_in_ast_v2 branch June 9, 2016 11:19
@solnic
Copy link
Member

solnic commented Jun 9, 2016

We made it 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants