Skip to content

Commit ed7a20d

Browse files
committed
Refactor xxpipeassign to use checkTooManyPlaceholders helper
1 parent bc8418d commit ed7a20d

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

src/main/gram.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3697,11 +3697,9 @@ static SEXP xxpipeassign(SEXP lhs, SEXP rhs, YYLTYPE *lloc_lhs, YYLTYPE *lloc_rh
36973697
raiseParseError("placeholderNotNamed", rhs,
36983698
NO_VALUE, NULL, lloc_rhs,
36993699
_("pipe placeholder can only be used as a named argument (%s:%d:%d)"));
3700-
if (placeholder_found != NULL)
3701-
raiseParseError("tooManyPlaceholders", rhs,
3702-
NO_VALUE, NULL, lloc_rhs,
3703-
_("pipe placeholder may only appear once (%s:%d:%d)"));
3700+
checkTooManyPlaceholders(rhs, CDR(a), lloc_rhs);
37043701
placeholder_found = a;
3702+
break;
37053703
}
37063704
}
37073705

src/main/gram.y

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1368,11 +1368,9 @@ static SEXP xxpipeassign(SEXP lhs, SEXP rhs, YYLTYPE *lloc_lhs, YYLTYPE *lloc_rh
13681368
raiseParseError("placeholderNotNamed", rhs,
13691369
NO_VALUE, NULL, lloc_rhs,
13701370
_("pipe placeholder can only be used as a named argument (%s:%d:%d)"));
1371-
if (placeholder_found != NULL)
1372-
raiseParseError("tooManyPlaceholders", rhs,
1373-
NO_VALUE, NULL, lloc_rhs,
1374-
_("pipe placeholder may only appear once (%s:%d:%d)"));
1371+
checkTooManyPlaceholders(rhs, CDR(a), lloc_rhs);
13751372
placeholder_found = a;
1373+
break;
13761374
}
13771375
}
13781376

0 commit comments

Comments
 (0)