mirror of
https://github.com/NixOS/nix.git
synced 2025-11-19 08:49:35 +01:00
libexpr: switch ExprAttrs to std::pmr::{vector,map}
This commit is contained in:
parent
77982c55b2
commit
614e143a20
3 changed files with 5 additions and 5 deletions
|
|
@ -395,9 +395,9 @@ struct ExprAttrs : Expr
|
|||
}
|
||||
};
|
||||
|
||||
typedef std::map<Symbol, AttrDef> AttrDefs;
|
||||
typedef std::pmr::map<Symbol, AttrDef> AttrDefs;
|
||||
AttrDefs attrs;
|
||||
std::unique_ptr<std::vector<Expr *>> inheritFromExprs;
|
||||
std::unique_ptr<std::pmr::vector<Expr *>> inheritFromExprs;
|
||||
|
||||
struct DynamicAttrDef
|
||||
{
|
||||
|
|
@ -409,7 +409,7 @@ struct ExprAttrs : Expr
|
|||
, pos(pos) {};
|
||||
};
|
||||
|
||||
typedef std::vector<DynamicAttrDef> DynamicAttrDefs;
|
||||
typedef std::pmr::vector<DynamicAttrDef> DynamicAttrDefs;
|
||||
DynamicAttrDefs dynamicAttrs;
|
||||
ExprAttrs(const PosIdx & pos)
|
||||
: recursive(false)
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ ParserState::addAttr(ExprAttrs * attrs, AttrPath & attrPath, const Symbol & symb
|
|||
// See https://github.com/NixOS/nix/issues/9020.
|
||||
if (jAttrs && ae) {
|
||||
if (ae->inheritFromExprs && !jAttrs->inheritFromExprs)
|
||||
jAttrs->inheritFromExprs = std::make_unique<std::vector<Expr *>>();
|
||||
jAttrs->inheritFromExprs = std::make_unique<std::pmr::vector<Expr *>>();
|
||||
for (auto & ad : ae->attrs) {
|
||||
if (ad.second.kind == ExprAttrs::AttrDef::Kind::InheritedFrom) {
|
||||
auto & sel = dynamic_cast<ExprSelect &>(*ad.second.e);
|
||||
|
|
|
|||
|
|
@ -423,7 +423,7 @@ binds1
|
|||
| binds[accum] INHERIT '(' expr ')' attrs ';'
|
||||
{ $$ = $accum;
|
||||
if (!$accum->inheritFromExprs)
|
||||
$accum->inheritFromExprs = std::make_unique<std::vector<Expr *>>();
|
||||
$accum->inheritFromExprs = std::make_unique<std::pmr::vector<Expr *>>();
|
||||
$accum->inheritFromExprs->push_back($expr);
|
||||
auto from = state->exprs.add<ExprInheritFrom>(state->at(@expr), $accum->inheritFromExprs->size() - 1);
|
||||
for (auto & [i, iPos] : $attrs) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue