Fix evaluating the typeof an arrow function. Using evaluate on used to cause a crash.
This commit is contained in:
@@ -738,6 +738,9 @@ merge(Compressor.prototype, {
|
||||
// places too. :-( Wish JS had multiple inheritance.
|
||||
throw def;
|
||||
});
|
||||
def(AST_Arrow, function() {
|
||||
throw def;
|
||||
});
|
||||
function ev(node, compressor) {
|
||||
if (!compressor) throw new Error("Compressor must be passed");
|
||||
|
||||
@@ -756,7 +759,8 @@ merge(Compressor.prototype, {
|
||||
case "typeof":
|
||||
// Function would be evaluated to an array and so typeof would
|
||||
// incorrectly return 'object'. Hence making is a special case.
|
||||
if (e instanceof AST_Function) return typeof function(){};
|
||||
if (e instanceof AST_Function ||
|
||||
e instanceof AST_Arrow) return typeof function(){};
|
||||
|
||||
e = ev(e, compressor);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user