diff options
author | Ben Burdette <bburdette@protonmail.com> | 2022-04-29 10:02:17 -0600 |
---|---|---|
committer | Ben Burdette <bburdette@protonmail.com> | 2022-04-29 10:02:17 -0600 |
commit | 2a5632c70dcb686a7764c23a5f330fcb9a33c8a1 (patch) | |
tree | 95f4d9390881356c12270f6b23a8853e6ef585f7 /src/libexpr/eval.hh | |
parent | 6e19947993119dec3c9fb9581150d1184948bae9 (diff) |
incorporate PosIdx changes, symbol changes.
Diffstat (limited to 'src/libexpr/eval.hh')
-rw-r--r-- | src/libexpr/eval.hh | 67 |
1 files changed, 49 insertions, 18 deletions
diff --git a/src/libexpr/eval.hh b/src/libexpr/eval.hh index 76bd63ca6..2e7df13fc 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 Expr &expr, const Env &env); -void printEnvBindings(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 StaticEnv &se, const Env &env); +valmap * mapStaticEnvBindings(const SymbolTable &st, const StaticEnv &se, const Env &env); void copyContext(const Value & v, PathSet & context); @@ -123,7 +123,7 @@ public: bool debugStop; bool debugQuit; std::list<DebugTrace> debugTraces; - void debugLastTrace(Error & e); + void debugLastTrace(Error & e) const; private: SrcToStore srcToStore; @@ -273,35 +273,66 @@ public: [[gnu::noinline, gnu::noreturn]] void throwEvalError(const PosIdx pos, const char * s) const; [[gnu::noinline, gnu::noreturn]] - void throwTypeError(const PosIdx pos, const char * s, const Value & v) const; + void throwEvalError(const PosIdx pos, const char * s, + Env & env, Expr & expr) const; [[gnu::noinline, gnu::noreturn]] void throwEvalError(const char * s, const std::string & s2) const; [[gnu::noinline, gnu::noreturn]] - void throwEvalError(const PosIdx pos, const Suggestions & suggestions, const char * s, - const std::string & s2) const; - [[gnu::noinline, gnu::noreturn]] void throwEvalError(const PosIdx pos, const char * s, const std::string & s2) const; [[gnu::noinline, gnu::noreturn]] - void throwEvalError(const char * s, const std::string & s2, const std::string & s3) const; + void throwEvalError(const char * s, const std::string & s2, + Env & env, Expr & expr) const; + [[gnu::noinline, gnu::noreturn]] + void throwEvalError(const PosIdx pos, const char * s, const std::string & s2, + Env & env, Expr & expr) const; + [[gnu::noinline, gnu::noreturn]] + void throwEvalError(const char * s, const std::string & s2, const std::string & s3, + Env & env, Expr & expr) const; + [[gnu::noinline, gnu::noreturn]] + void throwEvalError(const PosIdx pos, const char * s, const std::string & s2, const std::string & s3, + Env & env, Expr & expr) const; [[gnu::noinline, gnu::noreturn]] void throwEvalError(const PosIdx pos, const char * s, const std::string & s2, const std::string & s3) const; [[gnu::noinline, gnu::noreturn]] - void throwEvalError(const PosIdx p1, const char * s, const Symbol sym, const PosIdx p2) const; + 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; + [[gnu::noinline, gnu::noreturn]] + void throwEvalError(const PosIdx p1, const char * s, const Symbol sym, const PosIdx p2, + Env & env, Expr & expr) const; + + [[gnu::noinline, gnu::noreturn]] + void throwTypeError(const PosIdx pos, const char * s, const Value & v) const; + [[gnu::noinline, gnu::noreturn]] + void throwTypeError(const PosIdx pos, const char * s, const Value & v, + Env & env, Expr & expr) const; [[gnu::noinline, gnu::noreturn]] void throwTypeError(const PosIdx pos, const char * s) const; [[gnu::noinline, gnu::noreturn]] - void throwTypeError(const PosIdx pos, const char * s, const ExprLambda & fun, const Symbol s2) const; + void throwTypeError(const PosIdx pos, const char * s, + Env & env, Expr & expr) const; [[gnu::noinline, gnu::noreturn]] - void throwTypeError(const PosIdx pos, const Suggestions & suggestions, const char * s, - const ExprLambda & fun, const Symbol s2) const; + void throwTypeError(const PosIdx pos, const char * s, const ExprLambda & fun, const Symbol s2, + Env & env, Expr & expr) const; [[gnu::noinline, gnu::noreturn]] - void throwTypeError(const char * s, const Value & v) const; + void throwTypeError(const PosIdx pos, const Suggestions & suggestions, const char * s, const ExprLambda & fun, const Symbol s2, + Env & env, Expr & expr) const; [[gnu::noinline, gnu::noreturn]] - void throwAssertionError(const PosIdx pos, const char * s, const std::string & s1) const; + void throwTypeError(const char * s, const Value & v, + Env & env, Expr & expr) const; + + [[gnu::noinline, gnu::noreturn]] + void throwAssertionError(const PosIdx pos, const char * s, const std::string & s1, + Env & env, Expr & expr) const; + [[gnu::noinline, gnu::noreturn]] - void throwUndefinedVarError(const PosIdx pos, const char * s, const std::string & s1) const; + void throwUndefinedVarError(const PosIdx pos, const char * s, const std::string & s1, + Env & env, Expr & expr) const; + [[gnu::noinline, gnu::noreturn]] - void throwMissingArgumentError(const PosIdx pos, const char * s, const std::string & s1) const; + void throwMissingArgumentError(const PosIdx pos, const char * s, const std::string & s1, + Env & env, Expr & expr) const; [[gnu::noinline]] void addErrorTrace(Error & e, const char * s, const std::string & s2) const; @@ -480,7 +511,7 @@ private: class DebugTraceStacker { public: DebugTraceStacker(EvalState &evalState, DebugTrace t); - ~DebugTraceStacker() + ~DebugTraceStacker() { // assert(evalState.debugTraces.front() == trace); evalState.debugTraces.pop_front(); |