aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/parser.y
diff options
context:
space:
mode:
Diffstat (limited to 'src/libexpr/parser.y')
-rw-r--r--src/libexpr/parser.y14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/libexpr/parser.y b/src/libexpr/parser.y
index 60ad3f079..623ac641c 100644
--- a/src/libexpr/parser.y
+++ b/src/libexpr/parser.y
@@ -481,7 +481,7 @@ namespace nix {
Expr * EvalState::parse(const char * text,
- const Path & path, const Path & basePath)
+ const Path & path, const Path & basePath, StaticEnv & staticEnv)
{
yyscan_t scanner;
ParseData data(*this);
@@ -496,7 +496,7 @@ Expr * EvalState::parse(const char * text,
if (res) throw ParseError(data.error);
try {
- data.result->bindVars(staticBaseEnv);
+ data.result->bindVars(staticEnv);
} catch (Error & e) {
throw ParseError(format("%1%, in `%2%'") % e.msg() % path);
}
@@ -527,7 +527,7 @@ Expr * EvalState::parseExprFromFile(Path path)
tree cache. */
Expr * e = parseTrees[path];
if (!e) {
- e = parse(readFile(path).c_str(), path, dirOf(path));
+ e = parse(readFile(path).c_str(), path, dirOf(path), staticBaseEnv);
parseTrees[path] = e;
}
@@ -535,9 +535,15 @@ Expr * EvalState::parseExprFromFile(Path path)
}
+Expr * EvalState::parseExprFromString(const string & s, const Path & basePath, StaticEnv & staticEnv)
+{
+ return parse(s.c_str(), "(string)", basePath, staticEnv);
+}
+
+
Expr * EvalState::parseExprFromString(const string & s, const Path & basePath)
{
- return parse(s.c_str(), "(string)", basePath);
+ return parseExprFromString(s, basePath, staticBaseEnv);
}