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

Handle not nodes when resolving conditions #226

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

sgulseth
Copy link
Member

No description provided.

@sgulseth sgulseth requested a review from a team April 30, 2024 13:25
@sgulseth sgulseth force-pushed the fix/resolve-not-conditions branch from 0c46cc8 to f350ba7 Compare May 2, 2024 09:14
@sgulseth sgulseth changed the title feat(typeEvaluator): handle not nodes when resolving conditions Handle not nodes when resolving conditions May 2, 2024
return value.value
}

return false
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure if this makes sense for AccessAttribute. E.g. if evaluating AccessAttribute returns unknown then we want to return undefined.

Also: Can't resolveCondition just be like this? 🤔

const value = walk({node: expr, scope})
if (value.type === 'boolean') return value.value
if (value.type === 'null') return false
return undefined

And then we depend on the regular walk function to handle the different operators?

Copy link
Member Author

@sgulseth sgulseth May 3, 2024

Choose a reason for hiding this comment

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

Agree on returning undefined on unknown!


We would need to refactor it a bit as handleOpCall depends on resolveCondition 🤔 - I can have a look outside this PR?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hm. This doesn't seem to have been addressed in the latest re-review? 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated it to default to undefined but also return false on array, object, null

@sgulseth sgulseth force-pushed the fix/resolve-not-conditions branch 6 times, most recently from ed9b958 to 184eb8a Compare May 3, 2024 08:53
@sgulseth sgulseth requested a review from judofyr May 3, 2024 13:19
@sgulseth sgulseth force-pushed the fix/resolve-not-conditions branch from 184eb8a to aee1e8d Compare May 8, 2024 11:29
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