aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/compress.js7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/compress.js b/lib/compress.js
index 35646cf1..abf2001d 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -655,6 +655,8 @@ merge(Compressor.prototype, {
throw def;
});
function ev(node, compressor) {
+ if (!compressor) throw new Error("Compressor must be passed");
+
return node._eval(compressor);
};
def(AST_Node, function(){
@@ -700,9 +702,6 @@ merge(Compressor.prototype, {
case "+" :
// handle concatenating strings even if the left part cannot
// be evaluated, e.g. (variable + "str") + "str"
- if (!(c instanceof Compressor)) {
- throw new Error("Compressor must be passed!!");
- }
if (left instanceof AST_Binary && left.operator == "+" && left.is_string(c)) {
return make_node(AST_Binary, this, {
operator: "+",
@@ -754,7 +753,7 @@ merge(Compressor.prototype, {
var x = this.expression.expression.elements.map(function(el){
return ev(el, compressor);
});
- return x.join(ev(this.args[0]));
+ return x.join(ev(this.args[0], compressor));
}
}
throw def;