summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2012-08-13 15:10:29 -0400
committerEelco Dolstra <eelco.dolstra@logicblox.com>2012-08-13 15:10:29 -0400
commit767101824af1fe41b6e50791b21112c6a8d7457f (patch)
tree3e0c53a6512eead8a697c4cbb7972474cc65d80f
parente5c589d271c62f57cd2e7eb7d9841f67d8845ff4 (diff)
downloadguix-767101824af1fe41b6e50791b21112c6a8d7457f.tar.gz
Avoid concatenating lists of one string
-rw-r--r--src/libexpr/eval.cc2
-rw-r--r--src/libexpr/parser.y2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc
index cb7c22e291..fadfb3b530 100644
--- a/src/libexpr/eval.cc
+++ b/src/libexpr/eval.cc
@@ -965,7 +965,7 @@ void ExprConcatStrings::eval(EvalState & state, Env & env, Value & v)
             isPath = vStr.type == tPath;
             first = false;
         }
-            
+
         s << state.coerceToString(vStr, context, false, !isPath);
     }
         
diff --git a/src/libexpr/parser.y b/src/libexpr/parser.y
index 095e288430..1819da5e1c 100644
--- a/src/libexpr/parser.y
+++ b/src/libexpr/parser.y
@@ -203,7 +203,7 @@ static Expr * stripIndentation(SymbolTable & symbols, vector<Expr *> & es)
         es2->push_back(new ExprString(symbols.create(s2)));
     }
 
-    return new ExprConcatStrings(es2);
+    return es2->size() == 1 ? (*es2)[0] : new ExprConcatStrings(es2);
 }