Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions src/prism.c
Original file line number Diff line number Diff line change
Expand Up @@ -1359,16 +1359,14 @@ pm_check_value_expression(pm_parser_t *parser, pm_node_t *node) {
node = UP(cast->statements);
break;
}
case PM_AND_NODE: {
pm_and_node_t *cast = (pm_and_node_t *) node;
node = cast->left;
break;
}
case PM_OR_NODE: {
pm_or_node_t *cast = (pm_or_node_t *) node;
node = cast->left;
break;
}
case PM_AND_NODE:
case PM_OR_NODE:
// The left operand of an and/or node was already checked for a
// value when the node was created, so descending into it again
// would re-report the same void value and, in a chain such as
// `a && a && ...`, walk the whole left branch on every operator,
// which is quadratic in the length of the chain.
return NULL;
case PM_LOCAL_VARIABLE_WRITE_NODE: {
pm_local_variable_write_node_t *cast = (pm_local_variable_write_node_t *) node;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
t next&&do end&=
^~ unexpected 'do'; expected an expression after the operator
^~~~ unexpected void value expression

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

parse.y still reports this duplicated warning, but it is redundant; I'll open a pull request to fix it for parse.y too.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

^~~~ unexpected void value expression
^~ unexpected '&=', expecting end-of-input
^~ unexpected '&=', ignoring it
Expand Down
Loading