diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2006-08-29 15:29:38 +0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2006-08-29 15:29:38 +0000 |
commit | 2132d9ddeba14ea2ddcbb16fa51ddb16c45c3c6a (patch) | |
tree | d77c3bd42f0a13c9fc78e58e6558c5deab8d99d2 /src/libexpr/eval.cc | |
parent | 1f6616dabff48028b2b08fc50889707928201ea6 (diff) |
* Fix the ~ operator.
Diffstat (limited to 'src/libexpr/eval.cc')
-rw-r--r-- | src/libexpr/eval.cc | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index 6b53f60a8..90edbecb5 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -321,7 +321,6 @@ Expr evalExpr2(EvalState & state, Expr e) /* Normal forms. */ if (sym == symStr || sym == symPath || - sym == symSubPath || /* !!! evaluate */ sym == symUri || sym == symNull || sym == symInt || @@ -503,7 +502,7 @@ Expr evalExpr2(EvalState & state, Expr e) } /* String or path concatenation. */ - ATermList es; + ATermList es = ATempty; if (matchOpPlus(e, e1, e2) || matchConcatStrings(e, es)) { ATermVector args; if (matchOpPlus(e, e1, e2)) { @@ -520,6 +519,17 @@ Expr evalExpr2(EvalState & state, Expr e) } } + /* Backwards compatability: subpath operator (~). */ + if (matchSubPath(e, e1, e2)) { + static bool haveWarned; + warnOnce(haveWarned, "the subpath operator (~) is deprecated, use string concatenation (+) instead"); + ATermList context = ATempty; + bool dummy; + string s1 = coerceToStringWithContext(state, context, e1, dummy); + string s2 = coerceToStringWithContext(state, context, e2, dummy); + return wrapInContext(context, makePath(toATerm(canonPath(s1 + "/" + s2)))); + } + /* List concatenation. */ if (matchOpConcat(e, e1, e2)) { try { |