diff options
Diffstat (limited to 'third_party/nix/src/libexpr/nixexpr.hh')
-rw-r--r-- | third_party/nix/src/libexpr/nixexpr.hh | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/third_party/nix/src/libexpr/nixexpr.hh b/third_party/nix/src/libexpr/nixexpr.hh index 3bf9e4a1a77a..4b2bd86ef966 100644 --- a/third_party/nix/src/libexpr/nixexpr.hh +++ b/third_party/nix/src/libexpr/nixexpr.hh @@ -3,6 +3,7 @@ #include <map> #include <optional> #include <variant> +#include <absl/container/flat_hash_map.h> #include "libexpr/symbol-table.hh" #include "libexpr/value.hh" @@ -183,6 +184,7 @@ struct ExprOpHasAttr : Expr { struct ExprAttrs : Expr { bool recursive; + struct AttrDef { bool inherited; Expr* e; @@ -192,16 +194,20 @@ struct ExprAttrs : Expr { : inherited(inherited), e(e), pos(pos){}; AttrDef(){}; }; - typedef std::map<Symbol, AttrDef> AttrDefs; + + typedef absl::flat_hash_map<Symbol, AttrDef> AttrDefs; AttrDefs attrs; + struct DynamicAttrDef { Expr *nameExpr, *valueExpr; Pos pos; DynamicAttrDef(Expr* nameExpr, Expr* valueExpr, const Pos& pos) : nameExpr(nameExpr), valueExpr(valueExpr), pos(pos){}; }; + typedef std::vector<DynamicAttrDef> DynamicAttrDefs; DynamicAttrDefs dynamicAttrs; + ExprAttrs() : recursive(false){}; COMMON_METHODS }; @@ -336,7 +342,7 @@ struct ExprPos : Expr { struct StaticEnv { bool isWith; const StaticEnv* up; - typedef std::map<Symbol, unsigned int> Vars; + typedef absl::flat_hash_map<Symbol, unsigned int> Vars; Vars vars; StaticEnv(bool isWith, const StaticEnv* up) : isWith(isWith), up(up){}; }; |