From 44ecbdf5f0f84de343d86359b4456b38945d89bf 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 fe160a63..c9fb3a50 100644 --- a/lib/parse.js +++ b/lib/parse.js @@ -1452,7 +1452,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;