Show function names in error messages
Functions in Nix are anonymous, but if they're assigned to a variable/attribute, we can use the variable/attribute name in error messages, e.g. while evaluating `concatMapStrings' at `/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/pkgs/lib/strings.nix:18:25': ...
This commit is contained in:
		
							parent
							
								
									1b3a03f161
								
							
						
					
					
						commit
						18a48d80a0
					
				
					 5 changed files with 43 additions and 8 deletions
				
			
		|  | @ -63,6 +63,7 @@ struct Expr | |||
|     virtual void bindVars(const StaticEnv & env); | ||||
|     virtual void eval(EvalState & state, Env & env, Value & v); | ||||
|     virtual Value * maybeThunk(EvalState & state, Env & env); | ||||
|     virtual void setName(Symbol & name); | ||||
| }; | ||||
| 
 | ||||
| std::ostream & operator << (std::ostream & str, Expr & e); | ||||
|  | @ -197,6 +198,7 @@ struct Formals | |||
| struct ExprLambda : Expr | ||||
| { | ||||
|     Pos pos; | ||||
|     Symbol name; | ||||
|     Symbol arg; | ||||
|     bool matchAttrs; | ||||
|     Formals * formals; | ||||
|  | @ -208,6 +210,8 @@ struct ExprLambda : Expr | |||
|             throw ParseError(format("duplicate formal function argument `%1%' at %2%") | ||||
|                 % arg % pos); | ||||
|     }; | ||||
|     void setName(Symbol & name); | ||||
|     string showNamePos(); | ||||
|     COMMON_METHODS | ||||
| }; | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue