From a04513a3c7da70adb6790722c3ba9066548f3ed2 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Fri, 7 Nov 2014 12:28:52 +1100 Subject: [PATCH] faster util.pushMutatorMap aliases --- lib/6to5/util.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/6to5/util.js b/lib/6to5/util.js index 04ced6f323..36ca58e3d3 100644 --- a/lib/6to5/util.js +++ b/lib/6to5/util.js @@ -58,7 +58,16 @@ exports.sourceMapToComment = function (map) { }; exports.pushMutatorMap = function (mutatorMap, key, kind, method) { - var alias = JSON.stringify(traverse.removeProperties(_.cloneDeep(key))); + var alias; + + if (t.isIdentifier(key)) { + alias = key.name; + if (method.computed) alias = "computed:" + alias; + } else if (t.isLiteral(key)) { + alias = String(key.value); + } else { + alias = JSON.stringify(traverse.removeProperties(_.cloneDeep(key))); + } var map; if (_.has(mutatorMap, alias)) { @@ -174,7 +183,7 @@ exports.parse = function (opts, code, callback) { ecmaVersion: Infinity, strictMode: true, onComment: comments, - locations: opts.sourceMap, + locations: true, onToken: tokens, ranges: true });