diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2022-05-05 12:29:14 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2022-05-05 17:17:03 +0200 |
commit | dd8b91eebc0d31c9f8016609b36d89f58d8c4d19 (patch) | |
tree | 485741fbee955ba1e7137c6a6e627d003e5964d7 /src/libexpr/eval.hh | |
parent | c98648bef06fa749da156f11c61c97a8b066b271 (diff) |
Style fixes
In particular, use std::make_shared and enumerate(). Also renamed some
fields to fit naming conventions.
Diffstat (limited to 'src/libexpr/eval.hh')
-rw-r--r-- | src/libexpr/eval.hh | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/src/libexpr/eval.hh b/src/libexpr/eval.hh index 2e7df13fc..f3852e248 100644 --- a/src/libexpr/eval.hh +++ b/src/libexpr/eval.hh @@ -25,8 +25,8 @@ enum RepairFlag : bool; typedef void (* PrimOpFun) (EvalState & state, const PosIdx pos, Value * * args, Value & v); -void printEnvBindings(const SymbolTable &st, const Expr &expr, const Env &env); -void printEnvBindings(const SymbolTable &st, const StaticEnv &se, const Env &env, int lvl = 0); +void printEnvBindings(const SymbolTable & st, const Expr & expr, const Env & env); +void printEnvBindings(const SymbolTable & st, const StaticEnv & se, const Env & env, int lvl = 0); struct PrimOp { @@ -47,7 +47,7 @@ struct Env Value * values[0]; }; -valmap * mapStaticEnvBindings(const SymbolTable &st, const StaticEnv &se, const Env &env); +std::unique_ptr<valmap> mapStaticEnvBindings(const SymbolTable & st, const StaticEnv & se, const Env & env); void copyContext(const Value & v, PathSet & context); @@ -75,10 +75,10 @@ std::shared_ptr<RegexCache> makeRegexCache(); struct DebugTrace { std::optional<ErrPos> pos; - const Expr &expr; - const Env &env; + const Expr & expr; + const Env & env; hintformat hint; - bool is_error; + bool isError; }; class EvalState @@ -297,7 +297,7 @@ public: void throwEvalError(const char * s, const std::string & s2, const std::string & s3) const; [[gnu::noinline, gnu::noreturn]] void throwEvalError(const PosIdx pos, const Suggestions & suggestions, const char * s, const std::string & s2, - Env & env, Expr &expr) const; + Env & env, Expr & expr) const; [[gnu::noinline, gnu::noreturn]] void throwEvalError(const PosIdx p1, const char * s, const Symbol sym, const PosIdx p2, Env & env, Expr & expr) const; @@ -508,16 +508,15 @@ private: friend struct Value; }; -class DebugTraceStacker { - public: - DebugTraceStacker(EvalState &evalState, DebugTrace t); - ~DebugTraceStacker() - { - // assert(evalState.debugTraces.front() == trace); - evalState.debugTraces.pop_front(); - } - EvalState &evalState; - DebugTrace trace; +struct DebugTraceStacker { + DebugTraceStacker(EvalState & evalState, DebugTrace t); + ~DebugTraceStacker() + { + // assert(evalState.debugTraces.front() == trace); + evalState.debugTraces.pop_front(); + } + EvalState & evalState; + DebugTrace trace; }; /* Return a string representing the type of the value `v'. */ |