Probably fixed __exprToString

This commit is contained in:
Michael Raskin 2008-01-20 20:44:03 +00:00
parent 5eb5c23447
commit 5b5a3af983
1 changed files with 4 additions and 1 deletions

View File

@ -6,6 +6,7 @@
#include "archive.hh" #include "archive.hh"
#include "expr-to-xml.hh" #include "expr-to-xml.hh"
#include "nixexpr-ast.hh" #include "nixexpr-ast.hh"
#include "parser.hh"
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
@ -949,6 +950,8 @@ static Expr prim_unsafeDiscardStringContext(EvalState & state, const ATermVector
return makeStr(s, PathSet()); return makeStr(s, PathSet());
} }
/* Expression serialization/deserialization */
static Expr prim_ExprToString ( EvalState & state, const ATermVector & args) static Expr prim_ExprToString ( EvalState & state, const ATermVector & args)
{ {
return makeStr ( atPrint ( evalExpr ( state, args [ 0 ] ) ) ); return makeStr ( atPrint ( evalExpr ( state, args [ 0 ] ) ) );
@ -961,7 +964,7 @@ static Expr prim_StringToExpr ( EvalState & state, const ATermVector & args)
if (! matchStr ( evalExpr ( state, args[0] ), s, l )) { if (! matchStr ( evalExpr ( state, args[0] ), s, l )) {
throw EvalError("__stringToExpr needs string argument!"); throw EvalError("__stringToExpr needs string argument!");
} }
return toATerm ( s ); return ATreadFromString(s.c_str());
} }
/************************************************************* /*************************************************************