-
Notifications
You must be signed in to change notification settings - Fork 139
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
Add default location to parameters node #959
Conversation
This is currently breaking on 32 bit machines because in the case where we only have errors in the parameters, we never set the location, and then have underflow if the file is sufficiently large
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm approving this, but I think we shouldn't be creating parameters nodes in the case that they're entirely empty. Could you find out in where in the tree we're creating these extra nodes?
@@ -2458,7 +2458,7 @@ yp_parameters_node_create(yp_parser_t *parser) { | |||
*node = (yp_parameters_node_t) { | |||
{ | |||
.type = YP_NODE_PARAMETERS_NODE, | |||
.location = { .start = NULL, .end = NULL }, | |||
.location = { .start = parser->current.start, .end = parser->current.start }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it be YP_LOCATION_NULL_VALUE
maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think in this case we want it to be where the current token is, because that's where the parameters node is too!
Not sure I'm following this question. We create the parameters nodes here before we've actually parsed the parameters. We then go through and parse parameters, and if they're all invalid / errors, we'll still have the parameters node. This is a snippet from our errors test which triggered the code path where we create a parameters node with an invalid location:
|
Yeah I'm saying we shouldn't be calling |
Okay, merging now, but created #961 to fix this. |
This is currently breaking on 32 bit machines because in the case where we only have errors in the parameters, we never set the location, and then have underflow if the file is sufficiently large