mirror of
https://github.com/NixOS/nix.git
synced 2025-11-20 01:09:37 +01:00
libexpr: move ExprConcatStrings data to Exprs::alloc
ExprConcatStrings no longer consumes the vector argument Co-authored-by: John Ericson <git@JohnEricson.me>
This commit is contained in:
parent
2d83bc6b83
commit
631fb6c9ad
3 changed files with 15 additions and 7 deletions
|
|
@ -253,7 +253,7 @@ expr_op
|
|||
| expr_op UPDATE expr_op { $$ = new ExprOpUpdate(state->at(@2), $1, $3); }
|
||||
| expr_op '?' attrpath { $$ = new ExprOpHasAttr(state->alloc, $1, std::move($3)); }
|
||||
| expr_op '+' expr_op
|
||||
{ $$ = new ExprConcatStrings(state->at(@2), false, {{state->at(@1), $1}, {state->at(@3), $3}}); }
|
||||
{ $$ = new ExprConcatStrings(state->alloc, state->at(@2), false, {{state->at(@1), $1}, {state->at(@3), $3}}); }
|
||||
| expr_op '-' expr_op { $$ = new ExprCall(state->at(@2), new ExprVar(state->s.sub), {$1, $3}); }
|
||||
| expr_op '*' expr_op { $$ = new ExprCall(state->at(@2), new ExprVar(state->s.mul), {$1, $3}); }
|
||||
| expr_op '/' expr_op { $$ = new ExprCall(state->at(@2), new ExprVar(state->s.div), {$1, $3}); }
|
||||
|
|
@ -309,7 +309,7 @@ expr_simple
|
|||
| path_start PATH_END
|
||||
| path_start string_parts_interpolated PATH_END {
|
||||
$2.insert($2.begin(), {state->at(@1), $1});
|
||||
$$ = new ExprConcatStrings(CUR_POS, false, std::move($2));
|
||||
$$ = new ExprConcatStrings(state->alloc, CUR_POS, false, std::move($2));
|
||||
}
|
||||
| SPATH {
|
||||
std::string_view path($1.p + 1, $1.l - 2);
|
||||
|
|
@ -343,7 +343,7 @@ expr_simple
|
|||
|
||||
string_parts
|
||||
: STR { $$ = $1; }
|
||||
| string_parts_interpolated { $$ = new ExprConcatStrings(CUR_POS, true, std::move($1)); }
|
||||
| string_parts_interpolated { $$ = new ExprConcatStrings(state->alloc, CUR_POS, true, std::move($1)); }
|
||||
| { $$ = std::string_view(); }
|
||||
;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue