faster util.pushMutatorMap aliases
This commit is contained in:
parent
6f0ca947a7
commit
a04513a3c7
@ -58,7 +58,16 @@ exports.sourceMapToComment = function (map) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
exports.pushMutatorMap = function (mutatorMap, key, kind, method) {
|
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;
|
var map;
|
||||||
if (_.has(mutatorMap, alias)) {
|
if (_.has(mutatorMap, alias)) {
|
||||||
@ -174,7 +183,7 @@ exports.parse = function (opts, code, callback) {
|
|||||||
ecmaVersion: Infinity,
|
ecmaVersion: Infinity,
|
||||||
strictMode: true,
|
strictMode: true,
|
||||||
onComment: comments,
|
onComment: comments,
|
||||||
locations: opts.sourceMap,
|
locations: true,
|
||||||
onToken: tokens,
|
onToken: tokens,
|
||||||
ranges: true
|
ranges: true
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user