diff options
author | Shea Levy <shea@shealevy.com> | 2013-09-13T20·55-0400 |
---|---|---|
committer | Shea Levy <shea@shealevy.com> | 2013-12-31T17·45+0000 |
commit | 136f2f7046dfed18fde0b5f9933ddfafc1518ef5 (patch) | |
tree | 203804716694587a810096af3d75ea3a41c9bbe1 /src/libexpr/nixexpr.hh | |
parent | 5ba5993470a6ad532fc8e842084a574a88876b0a (diff) |
Add the ExprBuiltin Expr type to the AST
Certain desugaring schemes may require the parser to use some builtin function to do some of the work (e.g. currently `throw` is used to lazily cause an error if a `<>`-style path is not in the search path) Unfortunately, these names are not reserved keywords, so an expression that uses such a syntactic sugar will not see the expected behavior (see tests/lang/eval-okay-redefine-builtin.nix for an example). This adds the ExprBuiltin AST type, which when evaluated uses the value from the rootmost variable scope (which of course is initialized internally and can't shadow any of the builtins). Signed-off-by: Shea Levy <shea@shealevy.com>
Diffstat (limited to 'src/libexpr/nixexpr.hh')
-rw-r--r-- | src/libexpr/nixexpr.hh | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/libexpr/nixexpr.hh b/src/libexpr/nixexpr.hh index 61eb81fab138..2ae2e2e96fcf 100644 --- a/src/libexpr/nixexpr.hh +++ b/src/libexpr/nixexpr.hh @@ -248,6 +248,13 @@ struct ExprOpNot : Expr COMMON_METHODS }; +struct ExprBuiltin : Expr +{ + Symbol name; + ExprBuiltin(Symbol name) : name(name) { }; + COMMON_METHODS +}; + #define MakeBinOp(name, s) \ struct Expr##name : Expr \ { \ |