diff --git a/lib/ast.js b/lib/ast.js index 8739e03c..598833f3 100644 --- a/lib/ast.js +++ b/lib/ast.js @@ -1042,7 +1042,7 @@ var AST_This = DEFNODE("This", null, { var AST_Super = DEFNODE("Super", null, { $documentation: "The `super` symbol", -}, AST_Symbol); +}, AST_This); var AST_Constant = DEFNODE("Constant", null, { $documentation: "Base class for all constants", diff --git a/lib/compress.js b/lib/compress.js index f0538434..c2f4f8db 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -610,7 +610,6 @@ merge(Compressor.prototype, { } function is_lhs_read_only(lhs) { - if (lhs instanceof AST_Super) return true; if (lhs instanceof AST_This) return true; if (lhs instanceof AST_SymbolRef) return lhs.definition().orig[0] instanceof AST_SymbolLambda; if (lhs instanceof AST_PropAccess) { @@ -2143,7 +2142,6 @@ merge(Compressor.prototype, { def(AST_EmptyStatement, return_false); def(AST_Constant, return_false); - def(AST_Super, return_false); def(AST_This, return_false); def(AST_Call, function(compressor){ @@ -2838,7 +2836,6 @@ merge(Compressor.prototype, { def(AST_Node, return_this); def(AST_Constant, return_null); - def(AST_Super, return_null); def(AST_This, return_null); def(AST_Call, function(compressor, first_in_statement){ if (!this.is_expr_pure(compressor)) { @@ -4832,7 +4829,7 @@ merge(Compressor.prototype, { var has_special_symbol = false; self.walk(new TreeWalker(function(node) { if (has_special_symbol) return true; - if (node instanceof AST_Super || node instanceof AST_This) { + if (node instanceof AST_This) { has_special_symbol = true; return true; } diff --git a/lib/output.js b/lib/output.js index e4aa01f8..74771b1f 100644 --- a/lib/output.js +++ b/lib/output.js @@ -1685,9 +1685,6 @@ function OutputStream(options) { DEFPRINT(AST_Symbol, function (self, output) { self._do_print(output); }); - DEFPRINT(AST_SymbolDeclaration, function(self, output){ - self._do_print(output); - }); DEFPRINT(AST_Hole, noop); DEFPRINT(AST_This, function(self, output){ output.print("this"); diff --git a/test/compress/arrow.js b/test/compress/arrow.js index 78ceec7d..6df86d49 100644 --- a/test/compress/arrow.js +++ b/test/compress/arrow.js @@ -631,3 +631,31 @@ issue_2271: { } expect_stdout: "PASS" } + +concise_method_with_super: { + options = { + arrows: true, + } + input: { + var o = { + f: "FAIL", + g() { + return super.f; + } + } + Object.setPrototypeOf(o, { f: "PASS" }); + console.log(o.g()); + } + expect: { + var o = { + f: "FAIL", + g() { + return super.f; + } + } + Object.setPrototypeOf(o, { f: "PASS" }); + console.log(o.g()); + } + expect_stdout: "PASS" + node_version: ">=4" +}