From 64e7a00399a1bcdc9679f97db885e0bd00ed957f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20Santos?= Date: Mon, 26 Oct 2015 23:24:04 +0000 Subject: [PATCH] Accept keyword names as concise method names --- lib/parse.js | 2 +- test/compress/harmony.js | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/parse.js b/lib/parse.js index b44cc468..4ed32863 100644 --- a/lib/parse.js +++ b/lib/parse.js @@ -1445,7 +1445,7 @@ function parse($TEXT, options) { var start = S.token; var type = start.type; var name = as_property_name(); - if (type == "name" && !is("punc", ":")) { + if (type != "string" && type != "num" && !is("punc", ":")) { if (is("punc", "(")) { a.push(new AST_ConciseMethod({ start : start, diff --git a/test/compress/harmony.js b/test/compress/harmony.js index 2525d252..731976f3 100644 --- a/test/compress/harmony.js +++ b/test/compress/harmony.js @@ -169,6 +169,18 @@ concise_methods_and_mangle_props: { } } +concise_methods_and_keyword_names: { + input: { + x = { + catch() {}, + throw() {} + } + } + expect: { + x={catch(){},throw(){}}; + } +} + number_literals: { input: { 0b1001;