@@ -4751,7 +4751,7 @@ pm_interpolated_node_append(pm_node_t *node, pm_node_list_t *parts, pm_node_t *p
47514751 pm_node_flag_unset(UP(node), PM_NODE_FLAG_STATIC_LITERAL);
47524752 break;
47534753 default:
4754- assert(false && "unexpected node type" );
4754+ pm_node_flag_unset( node, PM_NODE_FLAG_STATIC_LITERAL );
47554755 break;
47564756 }
47574757
@@ -4888,16 +4888,8 @@ pm_interpolated_string_node_append(pm_interpolated_string_node_t *node, pm_node_
48884888 // should clear the mutability flags.
48894889 CLEAR_FLAGS(node);
48904890 break;
4891- case PM_X_STRING_NODE:
4892- case PM_INTERPOLATED_X_STRING_NODE:
4893- case PM_SYMBOL_NODE:
4894- case PM_INTERPOLATED_SYMBOL_NODE:
4895- // These will only happen in error cases. But we want to handle it
4896- // here so that we don't fail the assertion.
4897- CLEAR_FLAGS(node);
4898- break;
48994891 default:
4900- assert(false && "unexpected node type" );
4892+ CLEAR_FLAGS( node);
49014893 break;
49024894 }
49034895
@@ -16172,14 +16164,16 @@ parse_strings(pm_parser_t *parser, pm_node_t *current, bool accepts_label, uint1
1617216164 // Otherwise we need to check the type of the node we just parsed.
1617316165 // If it cannot be concatenated with the previous node, then we'll
1617416166 // need to add a syntax error.
16175- if (!PM_NODE_TYPE_P(node, PM_STRING_NODE) && !PM_NODE_TYPE_P(node, PM_INTERPOLATED_STRING_NODE)) {
16167+ PM_VALIDATE_NODE_TYPE(parser, node, PM_STRING_NODE, PM_INTERPOLATED_STRING_NODE);
16168+ if (PM_NODE_TYPE_P(node, PM_ERROR_RECOVERY_NODE)) {
1617616169 pm_parser_err_node(parser, node, PM_ERR_STRING_CONCATENATION);
1617716170 }
1617816171
1617916172 // If we haven't already created our container for concatenation,
1618016173 // we'll do that now.
1618116174 if (!concating) {
16182- if (!PM_NODE_TYPE_P(current, PM_STRING_NODE) && !PM_NODE_TYPE_P(current, PM_INTERPOLATED_STRING_NODE)) {
16175+ PM_VALIDATE_NODE_TYPE(parser, current, PM_STRING_NODE, PM_INTERPOLATED_STRING_NODE);
16176+ if (PM_NODE_TYPE_P(current, PM_ERROR_RECOVERY_NODE)) {
1618316177 pm_parser_err_node(parser, current, PM_ERR_STRING_CONCATENATION);
1618416178 }
1618516179
0 commit comments