mirror of https://github.com/webpack/webpack.git
parent
bf4ec9c26e
commit
8e4c8423b5
|
|
@ -55,6 +55,14 @@ class BasicEvaluatedExpression {
|
|||
return Object.prototype.hasOwnProperty.call(this, "quasis");
|
||||
}
|
||||
|
||||
isTruthy() {
|
||||
return this.truthy;
|
||||
}
|
||||
|
||||
isFalsy() {
|
||||
return this.falsy;
|
||||
}
|
||||
|
||||
asBool() {
|
||||
if(this.truthy) return true;
|
||||
else if(this.falsy) return false;
|
||||
|
|
|
|||
|
|
@ -242,6 +242,10 @@ class Parser extends Tapable {
|
|||
if(!argument) return;
|
||||
if(argument.isBoolean()) {
|
||||
return new BasicEvaluatedExpression().setBoolean(!argument.bool).setRange(expr.range);
|
||||
} else if(argument.isTruthy()) {
|
||||
return new BasicEvaluatedExpression().setBoolean(false).setRange(expr.range);
|
||||
} else if(argument.isFalsy()) {
|
||||
return new BasicEvaluatedExpression().setBoolean(true).setRange(expr.range);
|
||||
} else if(argument.isString()) {
|
||||
return new BasicEvaluatedExpression().setBoolean(!argument.string).setRange(expr.range);
|
||||
} else if(argument.isNumber()) {
|
||||
|
|
|
|||
|
|
@ -98,3 +98,11 @@ it("should not explode on recursive statements", function() {
|
|||
wurst; // <- is recursivly defined in config
|
||||
}).should.throw("suppe is not defined");
|
||||
});
|
||||
|
||||
it("should evaluate composed expressions (issue 5100)", function() {
|
||||
if(!module.hot && process.env.DEFINED_NESTED_KEY_STRING === "string") {
|
||||
// ok
|
||||
} else {
|
||||
require("fail");
|
||||
}
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue