Skip to content

Fix typo in AST predicates #1462

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

Merged
merged 1 commit into from
Aug 12, 2018
Merged

Fix typo in AST predicates #1462

merged 1 commit into from
Aug 12, 2018

Conversation

mjmahone
Copy link
Contributor

This was an easy mistake to make: the ordering in the Kind object made it seem like Variable belonged with VariableDefinition, when in fact it belongs with the values (as a variable definition defines that a value can be used).

Additionally, ObjectField is not itself a value: it's more of a key-value pair that itself contains a value.

@@ -29,6 +28,7 @@ export const Kind = Object.freeze({
FRAGMENT_DEFINITION: 'FragmentDefinition',

// Values
VARIABLE: 'Variable',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved this to prevent future confusion

node.kind === Kind.INT ||
node.kind === Kind.FLOAT ||
node.kind === Kind.STRING ||
node.kind === Kind.BOOLEAN ||
node.kind === Kind.NULL ||
node.kind === Kind.ENUM ||
node.kind === Kind.LIST ||
node.kind === Kind.OBJECT ||
node.kind === Kind.OBJECT_FIELD
Copy link
Contributor Author

Choose a reason for hiding this comment

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

OBJECT_FIELD is lumped with Values in kinds.js, but that's because it doesn't really belong anywhere else. However, if I give an ObjectFieldNode to a function expecting a ValueNode, we've messed something up.

@mjmahone mjmahone merged commit 7cfd686 into master Aug 12, 2018
@IvanGoncharov IvanGoncharov deleted the value-node-typo branch August 17, 2018 19:01
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.

3 participants