1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2024-09-20 23:28:26 -04:00

plain env pointer

This commit is contained in:
Ben Burdette 2021-05-12 11:33:31 -06:00
parent 0c2265da85
commit 459bccc750

View file

@ -619,18 +619,18 @@ std::optional<EvalState::Doc> EvalState::getDoc(Value & v)
// typedef std::optional<const std::map<std::string, Value *>> valmap; // typedef std::optional<const std::map<std::string, Value *>> valmap;
typedef const std::map<std::string, Value *> valmap; typedef const std::map<std::string, Value *> valmap;
static std::unique_ptr<valmap> map1(const char *name, Value *v) __attribute__((noinline)); static valmap* map1(const char *name, Value *v) __attribute__((noinline));
std::unique_ptr<valmap> map1(const char *name, Value *v) valmap* map1(const char *name, Value *v)
{ {
// return new valmap({{name, v}}); // return new valmap({{name, v}});
return std::unique_ptr<valmap>(new valmap({{name, v}})); return new valmap({{name, v}});
} }
static std::unique_ptr<valmap> map2(const char *name1, Value *v1, const char *name2, Value *v2) __attribute__((noinline)); static valmap* map2(const char *name1, Value *v1, const char *name2, Value *v2) __attribute__((noinline));
std::unique_ptr<valmap> map2(const char *name1, Value *v1, const char *name2, Value *v2) valmap* map2(const char *name1, Value *v1, const char *name2, Value *v2)
{ {
return std::unique_ptr<valmap>(new valmap({{name1, v1}, {name2, v2}})); return new valmap({{name1, v1}, {name2, v2}});
} }
/* Every "format" object (even temporary) takes up a few hundred bytes /* Every "format" object (even temporary) takes up a few hundred bytes
@ -673,8 +673,9 @@ LocalNoInlineNoReturn(void throwEvalError(const Pos & p1, const char * s, const
}); });
} }
LocalNoInlineNoReturn(void throwTypeError(const Pos & pos, const char * s, std::unique_ptr<valmap> env)) LocalNoInlineNoReturn(void throwTypeError(const Pos & pos, const char * s, valmap* env))
{ {
auto delenv = std::unique_ptr<valmap>(env);
auto error = TypeError({ auto error = TypeError({
.msg = hintfmt(s), .msg = hintfmt(s),
.errPos = pos .errPos = pos
@ -685,8 +686,9 @@ LocalNoInlineNoReturn(void throwTypeError(const Pos & pos, const char * s, std::
throw error; throw error;
} }
LocalNoInlineNoReturn(void throwTypeError(const Pos & pos, const char * s, const Value & v, std::unique_ptr<valmap> env)) LocalNoInlineNoReturn(void throwTypeError(const Pos & pos, const char * s, const Value & v, valmap* env))
{ {
auto delenv = std::unique_ptr<valmap>(env);
auto error = TypeError({ auto error = TypeError({
.msg = hintfmt(s, v), .msg = hintfmt(s, v),
.errPos = pos .errPos = pos
@ -697,8 +699,9 @@ LocalNoInlineNoReturn(void throwTypeError(const Pos & pos, const char * s, const
throw error; throw error;
} }
LocalNoInlineNoReturn(void throwTypeError(const Pos & pos, const char * s, const ExprLambda & fun, const Symbol & s2, std::unique_ptr<valmap> env)) LocalNoInlineNoReturn(void throwTypeError(const Pos & pos, const char * s, const ExprLambda & fun, const Symbol & s2, valmap* env))
{ {
auto delenv = std::unique_ptr<valmap>(env);
auto error = TypeError({ auto error = TypeError({
.msg = hintfmt(s, fun.showNamePos(), s2), .msg = hintfmt(s, fun.showNamePos(), s2),
.errPos = pos .errPos = pos
@ -727,7 +730,7 @@ LocalNoInlineNoReturn(void throwUndefinedVarError(const Pos & pos, const char *
}); });
} }
LocalNoInlineNoReturn(void throwMissingArgumentError(const Pos & pos, const char * s, const string & s1, std::unique_ptr<valmap> env)) LocalNoInlineNoReturn(void throwMissingArgumentError(const Pos & pos, const char * s, const string & s1, valmap* env))
{ {
auto error = MissingArgumentError({ auto error = MissingArgumentError({
.msg = hintfmt(s, s1), .msg = hintfmt(s, s1),