Compare commits
27 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a813341433 | ||
|
|
4968de9803 | ||
|
|
0de2d33e8d | ||
|
|
6f81ddd0d5 | ||
|
|
6b83055b12 | ||
|
|
080c23d5ed | ||
|
|
293bec58d7 | ||
|
|
93ceafc732 | ||
|
|
b2bac04b72 | ||
|
|
e549c37ca1 | ||
|
|
02512da38d | ||
|
|
abe9c4fd30 | ||
|
|
af21c52cc6 | ||
|
|
706626f79a | ||
|
|
b8dd421073 | ||
|
|
5453c466d6 | ||
|
|
0cfb2e76b8 | ||
|
|
ba67f57c1e | ||
|
|
f1a178f8f9 | ||
|
|
b1d1909c64 | ||
|
|
9529f93690 | ||
|
|
925b1f7600 | ||
|
|
40f8bc0a65 | ||
|
|
3a0dbabf5a | ||
|
|
383912c11b | ||
|
|
470c8fced0 | ||
|
|
c7a02ca289 |
24
CHANGELOG.md
24
CHANGELOG.md
@@ -2,6 +2,30 @@
|
||||
|
||||
Gaps between patch versions are faulty/broken releases.
|
||||
|
||||
## 2.4.2
|
||||
|
||||
* Upgrade `acorn-6to5`.
|
||||
* Better uids generated for various transformers based on parent node.
|
||||
* Alias flat references in `coreAliasing` transformer.
|
||||
|
||||
## 2.4.1
|
||||
|
||||
* Better whitespace handling of parenthesized expressions due to trailing comments.
|
||||
* Fix `yield` inside of comprehensions.
|
||||
|
||||
## 2.4.0
|
||||
|
||||
* Use a closure always for classes with a super.
|
||||
* Always use native loops for array comprehensions.
|
||||
* Allow `yield` inside of comprehensions.
|
||||
* Add optional `bluebirdCoroutine` transformer.
|
||||
* Add optional `asyncToGenerator` transformer.
|
||||
* Move `useStrict` transformer to before `_moduleFormatter` causing `"use strict";` to always be placed the very top.
|
||||
|
||||
## 2.3.2
|
||||
|
||||
* Add parens on expressions with trailing comments.
|
||||
|
||||
## 2.3.1
|
||||
|
||||
* Add `undefinedToVoid` optional transformer.
|
||||
|
||||
2
LICENSE
2
LICENSE
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2014 Sebastian McKenzie
|
||||
Copyright (c) 2014-2015 Sebastian McKenzie
|
||||
|
||||
MIT License
|
||||
|
||||
|
||||
@@ -11,10 +11,6 @@
|
||||
<img alt="Travis Status" src="http://img.shields.io/travis/6to5/6to5/master.svg?style=flat&label=travis">
|
||||
</a>
|
||||
|
||||
<a href="https://ci.appveyor.com/project/sebmck/6to5">
|
||||
<img alt="Appveyor Status" src="http://img.shields.io/appveyor/ci/sebmck/6to5.svg?style=flat&label=appveyor">
|
||||
</a>
|
||||
|
||||
<a href="https://codeclimate.com/github/6to5/6to5">
|
||||
<img alt="Code Climate Score" src="http://img.shields.io/codeclimate/github/6to5/6to5.svg?style=flat">
|
||||
</a>
|
||||
|
||||
@@ -90,23 +90,27 @@ equivalent to
|
||||
```javascript
|
||||
var foo = {
|
||||
get bar() {
|
||||
if (this._barRan) return this._bar;
|
||||
this._barRan = true;
|
||||
return this._bar = complex();
|
||||
return Object.defineProperty(this, "bar", {
|
||||
value: complex(),
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true
|
||||
}).bar;
|
||||
}
|
||||
};
|
||||
|
||||
class Foo {
|
||||
get bar() {
|
||||
if (this._barRan) return this._bar;
|
||||
this._barRan = true;
|
||||
return this._bar = complex();
|
||||
return Object.defineProperty(this, "bar", {
|
||||
value: complex(),
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true
|
||||
}).bar;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**NOTE:** Memoised functions will return the result of the **first** execution, regardless of arguments.
|
||||
|
||||
### This shorthand
|
||||
|
||||
```javascript
|
||||
|
||||
@@ -27,7 +27,12 @@ File.declarations = [
|
||||
"object-without-properties",
|
||||
"has-own",
|
||||
"slice",
|
||||
"define-property"
|
||||
"define-property",
|
||||
"async-to-generator"
|
||||
];
|
||||
|
||||
File.excludeDeclarationsFromRuntime = [
|
||||
"async-to-generator"
|
||||
];
|
||||
|
||||
File.normaliseOptions = function (opts) {
|
||||
@@ -95,6 +100,10 @@ File.prototype.getTransformers = function () {
|
||||
_.each(transform.transformers, function (transformer) {
|
||||
if (transformer.canRun(file)) {
|
||||
transformers.push(transformer);
|
||||
|
||||
if (transformer.manipulateOptions) {
|
||||
transformer.manipulateOptions(file.opts, file);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -144,6 +153,12 @@ File.prototype.parseShebang = function (code) {
|
||||
return code;
|
||||
};
|
||||
|
||||
File.prototype.addImport = function (id, source) {
|
||||
var specifiers = [t.importSpecifier(t.identifier("default"), id)];
|
||||
var declar = t.importDeclaration(specifiers, t.literal(source));
|
||||
this.ast.program.body.unshift(declar);
|
||||
};
|
||||
|
||||
File.prototype.addDeclaration = function (name) {
|
||||
if (!_.contains(File.declarations, name)) {
|
||||
throw new ReferenceError("unknown declaration " + name);
|
||||
@@ -156,7 +171,7 @@ File.prototype.addDeclaration = function (name) {
|
||||
|
||||
var ref;
|
||||
var runtimeNamespace = this.opts.runtime;
|
||||
if (runtimeNamespace) {
|
||||
if (runtimeNamespace && !_.contains(File.excludeDeclarationsFromRuntime, name)) {
|
||||
name = t.identifier(t.toIdentifier(name));
|
||||
return t.memberExpression(t.identifier(runtimeNamespace), name);
|
||||
} else {
|
||||
|
||||
@@ -148,6 +148,12 @@ CodeGenerator.prototype.print = function (node, parent, opts) {
|
||||
};
|
||||
|
||||
if (this[node.type]) {
|
||||
var needsCommentParens = t.isExpression(node) && node.leadingComments && node.leadingComments.length;
|
||||
var needsParens = needsCommentParens || n.needsParens(node, parent);
|
||||
|
||||
if (needsParens) this.push("(");
|
||||
if (needsCommentParens) this.indent();
|
||||
|
||||
this.printLeadingComments(node, parent);
|
||||
|
||||
newline(true);
|
||||
@@ -155,13 +161,12 @@ CodeGenerator.prototype.print = function (node, parent, opts) {
|
||||
if (opts.before) opts.before();
|
||||
this.map.mark(node, "start");
|
||||
|
||||
// only compute if this node needs parens if our parent has been changed
|
||||
// since acorn would've wrapped us in a ParanthesizedExpression
|
||||
var needsParens = n.needsParens(node, parent);
|
||||
if (needsParens) this.push("(");
|
||||
|
||||
this[node.type](node, this.buildPrint(node), parent);
|
||||
|
||||
if (needsCommentParens) {
|
||||
this.newline();
|
||||
this.dedent();
|
||||
}
|
||||
if (needsParens) this.push(")");
|
||||
|
||||
this.map.mark(node, "end");
|
||||
|
||||
@@ -19,6 +19,10 @@ module.exports = function (namespace) {
|
||||
]));
|
||||
|
||||
_.each(File.declarations, function (name) {
|
||||
if (_.contains(File.excludeDeclarationsFromRuntime, name)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var key = t.identifier(t.toIdentifier(name));
|
||||
body.push(t.expressionStatement(
|
||||
t.assignmentExpression("=", t.memberExpression(namespace, key), util.template(name))
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
ARRAY.filter(function (KEY) {
|
||||
return FILTER;
|
||||
}).map(function (KEY) {
|
||||
return STATEMENT;
|
||||
});
|
||||
@@ -1,3 +0,0 @@
|
||||
ARRAY.map(function (KEY) {
|
||||
return STATEMENT;
|
||||
});
|
||||
37
lib/6to5/transformation/templates/async-to-generator.js
Normal file
37
lib/6to5/transformation/templates/async-to-generator.js
Normal file
@@ -0,0 +1,37 @@
|
||||
(function (fn) {
|
||||
return function () {
|
||||
var gen = fn.apply(this, arguments);
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
function step(getNext) {
|
||||
var next;
|
||||
|
||||
try {
|
||||
next = getNext();
|
||||
} catch(e) {
|
||||
reject(e);
|
||||
return;
|
||||
}
|
||||
|
||||
if (next.done) {
|
||||
resolve(next.value);
|
||||
return;
|
||||
}
|
||||
|
||||
Promise.resolve(next.value).then(function (v) {
|
||||
step(function () {
|
||||
return gen.next(v);
|
||||
});
|
||||
}, function (e) {
|
||||
step(function () {
|
||||
return gen["throw"](e);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
step(function () {
|
||||
return gen.next();
|
||||
});
|
||||
});
|
||||
}
|
||||
})
|
||||
@@ -49,6 +49,9 @@ _.each({
|
||||
memoizationOperator: require("./transformers/playground-memoization-operator"),
|
||||
objectGetterMemoization: require("./transformers/playground-object-getter-memoization"),
|
||||
|
||||
asyncToGenerator: require("./transformers/optional-async-to-generator"),
|
||||
bluebirdCoroutines: require("./transformers/optional-bluebird-coroutines"),
|
||||
|
||||
react: require("./transformers/react"),
|
||||
modules: require("./transformers/es6-modules"),
|
||||
propertyNameShorthand: require("./transformers/es6-property-name-shorthand"),
|
||||
@@ -85,8 +88,8 @@ _.each({
|
||||
|
||||
// wrap up
|
||||
_aliasFunctions: require("./transformers/_alias-functions"),
|
||||
useStrict: require("./transformers/use-strict"),
|
||||
_moduleFormatter: require("./transformers/_module-formatter"),
|
||||
useStrict: require("./transformers/use-strict"),
|
||||
|
||||
// spec
|
||||
specPropertyLiterals: require("./transformers/spec-property-literals"),
|
||||
|
||||
@@ -5,11 +5,12 @@ var t = require("../types");
|
||||
var _ = require("lodash");
|
||||
|
||||
function Transformer(key, transformer, opts) {
|
||||
this.experimental = !!transformer.experimental;
|
||||
this.transformer = Transformer.normalise(transformer);
|
||||
this.optional = !!transformer.optional;
|
||||
this.opts = opts || {};
|
||||
this.key = key;
|
||||
this.manipulateOptions = transformer.manipulateOptions;
|
||||
this.experimental = !!transformer.experimental;
|
||||
this.transformer = Transformer.normalise(transformer);
|
||||
this.optional = !!transformer.optional;
|
||||
this.opts = opts || {};
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
Transformer.normalise = function (transformer) {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
var util = require("../../util");
|
||||
var t = require("../../types");
|
||||
|
||||
exports.Property = function (node) {
|
||||
if (node.method) node.method = false;
|
||||
@@ -21,7 +22,7 @@ exports.ObjectExpression = function (node, parent, file) {
|
||||
if (!hasAny) return;
|
||||
|
||||
if (node.properties.length) {
|
||||
var objId = util.getUid(parent, file);
|
||||
var objId = t.getUid(parent, file);
|
||||
|
||||
return util.template("object-define-properties-closure", {
|
||||
KEY: objId,
|
||||
|
||||
@@ -21,7 +21,7 @@ exports.ClassDeclaration = function (node, parent, file, scope) {
|
||||
});
|
||||
return t.assignmentExpression("=", node.id, newNode);
|
||||
} else {
|
||||
// likely has a PrivateDeclaration etc
|
||||
// has a super class or PrivateDeclaration etc
|
||||
return t.variableDeclaration("let", [
|
||||
t.variableDeclarator(node.id, newNode)
|
||||
]);
|
||||
@@ -85,23 +85,17 @@ Class.prototype.run = function () {
|
||||
|
||||
//
|
||||
|
||||
if (superName && t.isDynamic(superName)) {
|
||||
// so we're only evaluating it once
|
||||
var superRefName = "super";
|
||||
if (className) superRefName = className.name + "Super";
|
||||
if (superName) {
|
||||
this.closure = true;
|
||||
|
||||
var superRef = file.generateUidIdentifier(superRefName, this.scope);
|
||||
// so we're only evaluating it once
|
||||
var superRef = t.getUid(superName, this.file);
|
||||
body.unshift(t.variableDeclaration("var", [
|
||||
t.variableDeclarator(superRef, superName)
|
||||
]));
|
||||
superName = superRef;
|
||||
}
|
||||
|
||||
this.superName = superName;
|
||||
|
||||
//
|
||||
|
||||
if (superName) {
|
||||
this.superName = superName;
|
||||
body.push(t.expressionStatement(t.callExpression(file.addDeclaration("inherits"), [className, superName])));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
var util = require("../../util");
|
||||
var t = require("../../types");
|
||||
var t = require("../../types");
|
||||
|
||||
exports.ObjectExpression = function (node, parent, file) {
|
||||
var hasComputed = false;
|
||||
@@ -14,7 +13,7 @@ exports.ObjectExpression = function (node, parent, file) {
|
||||
|
||||
if (!hasComputed) return;
|
||||
|
||||
var objId = util.getUid(parent, file);
|
||||
var objId = t.getUid(parent, file);
|
||||
|
||||
var body = [];
|
||||
var container = t.functionExpression(null, [], t.blockStatement(body));
|
||||
|
||||
@@ -75,7 +75,7 @@ var pushArrayPattern = function (opts, nodes, pattern, parentId) {
|
||||
|
||||
var toArray = opts.file.toArray(parentId, !hasSpreadElement && pattern.elements.length);
|
||||
|
||||
var _parentId = opts.file.generateUidIdentifier("ref", opts.scope);
|
||||
var _parentId = t.getUid(parentId, opts.file, opts.scope);
|
||||
nodes.push(t.variableDeclaration("var", [
|
||||
t.variableDeclarator(_parentId, toArray)
|
||||
]));
|
||||
@@ -113,7 +113,7 @@ var pushPattern = function (opts) {
|
||||
var scope = opts.scope;
|
||||
|
||||
if (!t.isMemberExpression(parentId) && !t.isIdentifier(parentId)) {
|
||||
var key = file.generateUidIdentifier("ref", scope);
|
||||
var key = t.getUid(parentId, file, scope);
|
||||
|
||||
nodes.push(t.variableDeclaration("var", [
|
||||
t.variableDeclarator(key, parentId)
|
||||
|
||||
@@ -1,43 +1,25 @@
|
||||
var util = require("../../util");
|
||||
var t = require("../../types");
|
||||
var traverse = require("../../traverse");
|
||||
var util = require("../../util");
|
||||
var t = require("../../types");
|
||||
|
||||
exports.experimental = true;
|
||||
|
||||
var single = function (node, file) {
|
||||
var block = node.blocks[0];
|
||||
|
||||
var templateName = "array-expression-comprehension-map";
|
||||
if (node.filter) templateName = "array-expression-comprehension-filter";
|
||||
|
||||
var result = util.template(templateName, {
|
||||
STATEMENT: node.body,
|
||||
FILTER: node.filter,
|
||||
ARRAY: file.toArray(block.right),
|
||||
KEY: block.left
|
||||
});
|
||||
|
||||
var aliasPossibles = [result.callee.object, result];
|
||||
for (var i in aliasPossibles) {
|
||||
var call = aliasPossibles[i];
|
||||
if (t.isCallExpression(call)) {
|
||||
call.arguments[0]._aliasFunction = true;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
var multiple = function (node, file) {
|
||||
var uid = file.generateUidIdentifier("arr");
|
||||
var build = function (node, parent, file, scope) {
|
||||
var uid = t.getUid(parent, file, scope);
|
||||
|
||||
var container = util.template("array-comprehension-container", {
|
||||
KEY: uid
|
||||
});
|
||||
container.callee.expression._aliasFunction = true;
|
||||
container.callee._aliasFunction = true;
|
||||
|
||||
var block = container.callee.body;
|
||||
var body = block.body;
|
||||
|
||||
if (traverse.hasType(node, "YieldExpression", t.FUNCTION_TYPES)) {
|
||||
container.callee.generator = true;
|
||||
container = t.yieldExpression(container, true);
|
||||
}
|
||||
|
||||
var returnStatement = body.pop();
|
||||
|
||||
body.push(exports._build(node, function () {
|
||||
@@ -73,12 +55,8 @@ exports._build = function (node, buildBody) {
|
||||
);
|
||||
};
|
||||
|
||||
exports.ComprehensionExpression = function (node, parent, file) {
|
||||
exports.ComprehensionExpression = function (node, parent, file, scope) {
|
||||
if (node.generator) return;
|
||||
|
||||
if (node.blocks.length === 1) {
|
||||
return single(node, file);
|
||||
} else {
|
||||
return multiple(node, file);
|
||||
}
|
||||
return build(node, parent, file, scope);
|
||||
};
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
var bluebirdCoroutines = require("./optional-bluebird-coroutines");
|
||||
var t = require("../../types");
|
||||
|
||||
exports.optional = true;
|
||||
|
||||
exports.manipulateOptions = bluebirdCoroutines.manipulateOptions;
|
||||
|
||||
exports.Function = function (node, parent, file) {
|
||||
if (!node.async || node.generator) return;
|
||||
|
||||
bluebirdCoroutines._Function(node);
|
||||
|
||||
return t.callExpression(file.addDeclaration("async-to-generator"), [node]);
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
var traverse = require("../../traverse");
|
||||
var t = require("../../types");
|
||||
|
||||
exports.manipulateOptions = function (opts) {
|
||||
opts.experimental = true;
|
||||
opts.blacklist.push("generators");
|
||||
};
|
||||
|
||||
exports.optional = true;
|
||||
|
||||
exports._Function = function (node) {
|
||||
node.async = false;
|
||||
node.generator = true;
|
||||
|
||||
traverse(node, {
|
||||
enter: function (node) {
|
||||
if (t.isFunction(node)) this.stop();
|
||||
|
||||
if (t.isAwaitExpression(node)) {
|
||||
node.type = "YieldExpression";
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
exports.Function = function (node, parent, file) {
|
||||
if (!node.async || node.generator) return;
|
||||
|
||||
exports._Function(node);
|
||||
|
||||
var id = t.identifier("Bluebird");
|
||||
file.addImport(id, "bluebird");
|
||||
return t.callExpression(t.memberExpression(id, t.identifier("coroutine")), [node]);
|
||||
};
|
||||
@@ -4,14 +4,16 @@ var core = require("core-js/library");
|
||||
var t = require("../../types");
|
||||
var _ = require("lodash");
|
||||
|
||||
var coreHas = function (node) {
|
||||
return node.name !== "_" && _.has(core, node.name);
|
||||
};
|
||||
|
||||
exports.optional = true;
|
||||
|
||||
exports.ast = {
|
||||
enter: function (ast, file) {
|
||||
file._coreId = file.generateUidIdentifier("core");
|
||||
var specifiers = [t.importSpecifier(t.identifier("default"), file._coreId)];
|
||||
var declar = t.importDeclaration(specifiers, t.literal("core-js/library"));
|
||||
ast.program.body.unshift(declar);
|
||||
file.addImport(file._coreId, "core-js/library");
|
||||
},
|
||||
|
||||
exit: function (ast, file) {
|
||||
@@ -26,11 +28,13 @@ exports.ast = {
|
||||
|
||||
if (!t.isReferenced(obj, node)) return;
|
||||
|
||||
var coreHasObject = obj.name !== "_" && _.has(core, obj.name);
|
||||
if (coreHasObject && _.has(core[obj.name], prop.name)) {
|
||||
if (coreHas(obj) && _.has(core[obj.name], prop.name)) {
|
||||
this.stop();
|
||||
return t.memberExpression(file._coreId, node);
|
||||
}
|
||||
} else if (t.isIdentifier(node) && !t.isMemberExpression(parent) && t.isReferenced(node, parent) && coreHas(node)) {
|
||||
// new Promise -> new _core.Promise
|
||||
return t.memberExpression(file._coreId, node);
|
||||
} else if (t.isCallExpression(node)) {
|
||||
// arr[Symbol.iterator]() -> _core.$for.getIterator(arr)
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ var getPropRef = function (nodes, prop, file, scope) {
|
||||
if (t.isIdentifier(prop)) {
|
||||
return t.literal(prop.name);
|
||||
} else {
|
||||
var temp = file.generateUidIdentifier("propKey", scope);
|
||||
var temp = t.getUid(prop, file, scope);
|
||||
nodes.push(t.variableDeclaration("var", [
|
||||
t.variableDeclarator(temp, prop)
|
||||
]));
|
||||
@@ -20,7 +20,7 @@ var getPropRef = function (nodes, prop, file, scope) {
|
||||
|
||||
var getObjRef = function (nodes, obj, file, scope) {
|
||||
if (t.isDynamic(obj)) {
|
||||
var temp = file.generateUidIdentifier("obj", scope);
|
||||
var temp = t.getUid(obj, file, scope);
|
||||
nodes.push(t.variableDeclaration("var", [
|
||||
t.variableDeclarator(temp, obj)
|
||||
]));
|
||||
|
||||
@@ -107,6 +107,11 @@ function traverse(parent, opts, scope) {
|
||||
|
||||
if (updated) {
|
||||
parent[key] = _.flatten(parent[key]);
|
||||
|
||||
if (key === "body") {
|
||||
// we can safely compact this
|
||||
parent[key] = _.compact(parent[key]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
handle(parent, key);
|
||||
|
||||
@@ -17,23 +17,23 @@
|
||||
"ExportDeclaration": ["Statement", "Declaration"],
|
||||
"ImportDeclaration": ["Statement", "Declaration"],
|
||||
|
||||
"ArrowFunctionExpression": ["Scope", "Function"],
|
||||
"ArrowFunctionExpression": ["Scope", "Function", "Expression"],
|
||||
"FunctionDeclaration": ["Statement", "Declaration", "Scope", "Function"],
|
||||
"FunctionExpression": ["Scope", "Function"],
|
||||
"FunctionExpression": ["Scope", "Function", "Expression"],
|
||||
|
||||
"BlockStatement": ["Statement", "Scope"],
|
||||
"Program": ["Scope"],
|
||||
"CatchClause": ["Scope"],
|
||||
|
||||
"LogicalExpression": ["Binary"],
|
||||
"BinaryExpression": ["Binary"],
|
||||
"LogicalExpression": ["Binary", "Expression"],
|
||||
"BinaryExpression": ["Binary", "Expression"],
|
||||
|
||||
"UnaryExpression": ["UnaryLike"],
|
||||
"UnaryExpression": ["UnaryLike", "Expression"],
|
||||
"SpreadProperty": ["UnaryLike"],
|
||||
"SpreadElement": ["UnaryLike"],
|
||||
|
||||
"ClassDeclaration": ["Statement", "Declaration", "Class"],
|
||||
"ClassExpression": ["Class"],
|
||||
"ClassExpression": ["Class", "Expression"],
|
||||
|
||||
"ForOfStatement": ["Statement", "For", "Scope", "Loop"],
|
||||
"ForInStatement": ["Statement", "For", "Scope", "Loop"],
|
||||
@@ -43,5 +43,27 @@
|
||||
"ArrayPattern": ["Pattern"],
|
||||
|
||||
"Property": ["UserWhitespacable"],
|
||||
"XJSElement": ["UserWhitespacable"]
|
||||
"XJSElement": ["UserWhitespacable", "Expression"],
|
||||
|
||||
"ArrayExpression": ["Expression"],
|
||||
"AssignmentExpression": ["Expression"],
|
||||
"AwaitExpression": ["Expression"],
|
||||
"BindFunctionExpression": ["Expression"],
|
||||
"BindMemberExpression": ["Expression"],
|
||||
"CallExpression": ["Expression"],
|
||||
"ComprehensionExpression": ["Expression"],
|
||||
"ConditionalExpression": ["Expression"],
|
||||
"Identifier": ["Expression"],
|
||||
"Literal": ["Expression"],
|
||||
"MemberExpression": ["Expression"],
|
||||
"NewExpression": ["Expression"],
|
||||
"ObjectExpression": ["Expression"],
|
||||
"SequenceExpression": ["Expression"],
|
||||
"TaggedTemplateExpression": ["Expression"],
|
||||
"ThisExpression": ["Expression"],
|
||||
"UpdateExpression": ["Expression"],
|
||||
"VirtualPropertyExpression": ["Expression"],
|
||||
"XJSEmptyExpression": ["Expression"],
|
||||
"XJSMemberExpression": ["Expression"],
|
||||
"YieldExpression": ["Expression"]
|
||||
}
|
||||
|
||||
@@ -66,14 +66,6 @@ _.each(t.FLIPPED_ALIAS_KEYS, function (types, type) {
|
||||
|
||||
//
|
||||
|
||||
t.isExpression = function (node) {
|
||||
return !t.isStatement(node);
|
||||
};
|
||||
|
||||
addAssert("Expression", t.isExpression);
|
||||
|
||||
//
|
||||
|
||||
t.isFalsyExpression = function (node) {
|
||||
if (t.isLiteral(node)) {
|
||||
return !node.value;
|
||||
@@ -164,7 +156,7 @@ t.toIdentifier = function (name) {
|
||||
if (t.isIdentifier(name)) return name.name;
|
||||
|
||||
// replace all non-valid identifiers with dashes
|
||||
name = name.replace(/[^a-zA-Z0-9]/g, "-");
|
||||
name = name.replace(/[^a-zA-Z0-9$_]/g, "-");
|
||||
|
||||
// remove all dashes and numbers from start of name
|
||||
name = name.replace(/^[-0-9]+/, "");
|
||||
@@ -174,6 +166,9 @@ t.toIdentifier = function (name) {
|
||||
return c ? c.toUpperCase() : "";
|
||||
});
|
||||
|
||||
// remove underscores from start of name
|
||||
name = name.replace(/^\_/, "");
|
||||
|
||||
return name || '_';
|
||||
};
|
||||
|
||||
@@ -239,6 +234,49 @@ t.toBlock = function (node, parent) {
|
||||
return t.blockStatement(node);
|
||||
};
|
||||
|
||||
t.getUid = function (parent, file, scope) {
|
||||
var node = parent;
|
||||
|
||||
if (t.isAssignmentExpression(parent)) {
|
||||
node = parent.left;
|
||||
} else if (t.isVariableDeclarator(parent)) {
|
||||
node = parent.id;
|
||||
}
|
||||
|
||||
var id = "ref";
|
||||
|
||||
if (t.isProperty(node)) {
|
||||
node = node.key;
|
||||
}
|
||||
|
||||
if (t.isIdentifier(node)) {
|
||||
id = node.name;
|
||||
} else if (t.isLiteral(node)) {
|
||||
id = node.value;
|
||||
} else if (t.isMemberExpression(node)) {
|
||||
var parts = [];
|
||||
|
||||
var add = function (node) {
|
||||
if (t.isMemberExpression(node)) {
|
||||
add(node.object);
|
||||
add(node.property);
|
||||
} else if (t.isIdentifier(node)) {
|
||||
parts.push(node.name);
|
||||
} else if (t.isLiteral(node)) {
|
||||
parts.push(node.value);
|
||||
}
|
||||
};
|
||||
|
||||
add(node);
|
||||
|
||||
id = parts.join("$");
|
||||
}
|
||||
|
||||
id = id.replace(/^_/, "");
|
||||
|
||||
return file.generateUidIdentifier(id, scope);
|
||||
};
|
||||
|
||||
t.getIds = function (node, map, ignoreTypes) {
|
||||
ignoreTypes = ignoreTypes || [];
|
||||
|
||||
@@ -297,19 +335,26 @@ t.isVar = function (node) {
|
||||
return t.isVariableDeclaration(node, { kind: "var" }) && !node._let;
|
||||
};
|
||||
|
||||
//
|
||||
|
||||
t.COMMENT_KEYS = ["leadingComments", "trailingComments"];
|
||||
|
||||
t.removeComments = function (child) {
|
||||
delete child.leadingComments;
|
||||
delete child.trailingComments;
|
||||
_.each(t.COMMENT_KEYS, function (key) {
|
||||
delete child[key];
|
||||
});
|
||||
return child;
|
||||
};
|
||||
|
||||
t.inheritsComments = function (child, parent) {
|
||||
_.each(["leadingComments", "trailingComments"], function (key) {
|
||||
_.each(t.COMMENT_KEYS, function (key) {
|
||||
child[key] = _.uniq(_.compact([].concat(child[key], parent[key])));
|
||||
});
|
||||
return child;
|
||||
};
|
||||
|
||||
//
|
||||
|
||||
t.inherits = function (child, parent) {
|
||||
child.loc = parent.loc;
|
||||
child.end = parent.end;
|
||||
|
||||
@@ -52,22 +52,6 @@ exports.arrayify = function (val) {
|
||||
throw new TypeError("illegal type for arrayify");
|
||||
};
|
||||
|
||||
exports.getUid = function (parent, file) {
|
||||
var node;
|
||||
|
||||
if (t.isAssignmentExpression(parent)) {
|
||||
node = parent.left;
|
||||
} else if (t.isVariableDeclarator(parent)) {
|
||||
node = parent.id;
|
||||
}
|
||||
|
||||
var id = "ref";
|
||||
|
||||
if (t.isIdentifier(node)) id = node.name;
|
||||
|
||||
return file.generateUidIdentifier(id);
|
||||
};
|
||||
|
||||
exports.isAbsolute = function (loc) {
|
||||
if (!loc) return false;
|
||||
if (loc[0] === "/") return true; // unix
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "6to5",
|
||||
"description": "Turn ES6 code into readable vanilla ES5 with source maps",
|
||||
"version": "2.3.1",
|
||||
"version": "2.4.2",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://github.com/6to5/6to5",
|
||||
"repository": {
|
||||
@@ -35,7 +35,7 @@
|
||||
"test": "make test"
|
||||
},
|
||||
"dependencies": {
|
||||
"acorn-6to5": "0.11.1-1",
|
||||
"acorn-6to5": "0.11.1-2",
|
||||
"ast-types": "~0.6.1",
|
||||
"chokidar": "0.11.1",
|
||||
"commander": "2.5.0",
|
||||
|
||||
@@ -3,8 +3,9 @@ var test = {
|
||||
* Before bracket init
|
||||
*/
|
||||
["a"]: "1",
|
||||
[/*
|
||||
* Inside bracket init
|
||||
*/
|
||||
"b"]: "2"
|
||||
[( /*
|
||||
* Inside bracket init
|
||||
*/
|
||||
"b"
|
||||
)]: "2"
|
||||
}, ok = 42;
|
||||
|
||||
@@ -4,10 +4,11 @@ var test = {
|
||||
*/
|
||||
["a"]: "1",
|
||||
|
||||
[/*
|
||||
* Inside bracket init
|
||||
*/
|
||||
"b"]: "2",
|
||||
[( /*
|
||||
* Inside bracket init
|
||||
*/
|
||||
"b"
|
||||
)]: "2",
|
||||
|
||||
["c"
|
||||
/*
|
||||
@@ -17,9 +18,10 @@ var test = {
|
||||
// Before bracket, line comment
|
||||
["d"]: "4",
|
||||
|
||||
[
|
||||
// Inside bracket, line comment
|
||||
"e"]: "5",
|
||||
[(
|
||||
// Inside bracket, line comment
|
||||
"e"
|
||||
)]: "5",
|
||||
|
||||
["f"
|
||||
// After bracket, line comment
|
||||
|
||||
@@ -13,29 +13,34 @@ var _inherits = function (child, parent) {
|
||||
if (parent) child.__proto__ = parent;
|
||||
};
|
||||
|
||||
var Test = function Test() {
|
||||
woops["super"].test();
|
||||
Foo.call(this);
|
||||
Foo.prototype.test.call(this);
|
||||
foob(Foo);
|
||||
var Test = (function () {
|
||||
var _Foo = Foo;
|
||||
var Test = function Test() {
|
||||
woops["super"].test();
|
||||
_Foo.call(this);
|
||||
_Foo.prototype.test.call(this);
|
||||
foob(_Foo);
|
||||
|
||||
Foo.call.apply(Foo, [this].concat(_slice.call(arguments)));
|
||||
Foo.call.apply(Foo, [this, "test"].concat(_slice.call(arguments)));
|
||||
_Foo.call.apply(_Foo, [this].concat(_slice.call(arguments)));
|
||||
_Foo.call.apply(_Foo, [this, "test"].concat(_slice.call(arguments)));
|
||||
|
||||
Foo.prototype.test.call.apply(Foo.prototype, [this].concat(_slice.call(arguments)));
|
||||
Foo.prototype.test.call.apply(Foo.prototype, [this, "test"].concat(_slice.call(arguments)));
|
||||
};
|
||||
_Foo.prototype.test.call.apply(_Foo.prototype, [this].concat(_slice.call(arguments)));
|
||||
_Foo.prototype.test.call.apply(_Foo.prototype, [this, "test"].concat(_slice.call(arguments)));
|
||||
};
|
||||
|
||||
_inherits(Test, Foo);
|
||||
_inherits(Test, _Foo);
|
||||
|
||||
Test.prototype.test = function () {
|
||||
Foo.prototype.test.call(this);
|
||||
Foo.prototype.test.call.apply(Foo.prototype.test, [this].concat(_slice.call(arguments)));
|
||||
Foo.prototype.test.call.apply(Foo.prototype.test, [this, "test"].concat(_slice.call(arguments)));
|
||||
};
|
||||
Test.prototype.test = function () {
|
||||
_Foo.prototype.test.call(this);
|
||||
_Foo.prototype.test.call.apply(_Foo.prototype.test, [this].concat(_slice.call(arguments)));
|
||||
_Foo.prototype.test.call.apply(_Foo.prototype.test, [this, "test"].concat(_slice.call(arguments)));
|
||||
};
|
||||
|
||||
Test.foo = function () {
|
||||
Foo.foo.call(this);
|
||||
Foo.foo.call.apply(Foo.foo, [this].concat(_slice.call(arguments)));
|
||||
Foo.foo.call.apply(Foo.foo, [this, "test"].concat(_slice.call(arguments)));
|
||||
};
|
||||
Test.foo = function () {
|
||||
_Foo.foo.call(this);
|
||||
_Foo.foo.call.apply(_Foo.foo, [this].concat(_slice.call(arguments)));
|
||||
_Foo.foo.call.apply(_Foo.foo, [this, "test"].concat(_slice.call(arguments)));
|
||||
};
|
||||
|
||||
return Test;
|
||||
})();
|
||||
|
||||
@@ -12,9 +12,14 @@ var _inherits = function (child, parent) {
|
||||
if (parent) child.__proto__ = parent;
|
||||
};
|
||||
|
||||
var Test = function Test() {
|
||||
Foo.prototype.test;
|
||||
Foo.prototype.test.whatever;
|
||||
};
|
||||
var Test = (function () {
|
||||
var _Foo = Foo;
|
||||
var Test = function Test() {
|
||||
_Foo.prototype.test;
|
||||
_Foo.prototype.test.whatever;
|
||||
};
|
||||
|
||||
_inherits(Test, Foo);
|
||||
_inherits(Test, _Foo);
|
||||
|
||||
return Test;
|
||||
})();
|
||||
|
||||
@@ -12,13 +12,18 @@ var _inherits = function (child, parent) {
|
||||
if (parent) child.__proto__ = parent;
|
||||
};
|
||||
|
||||
var Test = function Test() {
|
||||
Foo.prototype.test.whatever();
|
||||
Foo.prototype.test.call(this);
|
||||
};
|
||||
var Test = (function () {
|
||||
var _Foo = Foo;
|
||||
var Test = function Test() {
|
||||
_Foo.prototype.test.whatever();
|
||||
_Foo.prototype.test.call(this);
|
||||
};
|
||||
|
||||
_inherits(Test, Foo);
|
||||
_inherits(Test, _Foo);
|
||||
|
||||
Test.test = function () {
|
||||
return Foo.wow.call(this);
|
||||
};
|
||||
Test.test = function () {
|
||||
return _Foo.wow.call(this);
|
||||
};
|
||||
|
||||
return Test;
|
||||
})();
|
||||
|
||||
@@ -16,8 +16,13 @@ var Test = function Test() {
|
||||
this.state = "test";
|
||||
};
|
||||
|
||||
var Foo = function Foo() {
|
||||
this.state = "test";
|
||||
};
|
||||
var Foo = (function () {
|
||||
var _Bar = Bar;
|
||||
var Foo = function Foo() {
|
||||
this.state = "test";
|
||||
};
|
||||
|
||||
_inherits(Foo, Bar);
|
||||
_inherits(Foo, _Bar);
|
||||
|
||||
return Foo;
|
||||
})();
|
||||
|
||||
@@ -12,18 +12,28 @@ var _inherits = function (child, parent) {
|
||||
if (parent) child.__proto__ = parent;
|
||||
};
|
||||
|
||||
var BaseController = function BaseController() {
|
||||
if (Chaplin.Controller) {
|
||||
Chaplin.Controller.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
var BaseController = (function () {
|
||||
var _Chaplin$Controller = Chaplin.Controller;
|
||||
var BaseController = function BaseController() {
|
||||
if (_Chaplin$Controller) {
|
||||
_Chaplin$Controller.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
|
||||
_inherits(BaseController, Chaplin.Controller);
|
||||
_inherits(BaseController, _Chaplin$Controller);
|
||||
|
||||
var BaseController2 = function BaseController2() {
|
||||
if (Chaplin.Controller.Another) {
|
||||
Chaplin.Controller.Another.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
return BaseController;
|
||||
})();
|
||||
|
||||
_inherits(BaseController2, Chaplin.Controller.Another);
|
||||
var BaseController2 = (function () {
|
||||
var _Chaplin$Controller$Another = Chaplin.Controller.Another;
|
||||
var BaseController2 = function BaseController2() {
|
||||
if (_Chaplin$Controller$Another) {
|
||||
_Chaplin$Controller$Another.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
|
||||
_inherits(BaseController2, _Chaplin$Controller$Another);
|
||||
|
||||
return BaseController2;
|
||||
})();
|
||||
|
||||
@@ -12,10 +12,15 @@ var _inherits = function (child, parent) {
|
||||
if (parent) child.__proto__ = parent;
|
||||
};
|
||||
|
||||
var Test = function Test() {
|
||||
if (Foo) {
|
||||
Foo.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
var Test = (function () {
|
||||
var _Foo = Foo;
|
||||
var Test = function Test() {
|
||||
if (_Foo) {
|
||||
_Foo.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
|
||||
_inherits(Test, Foo);
|
||||
_inherits(Test, _Foo);
|
||||
|
||||
return Test;
|
||||
})();
|
||||
|
||||
@@ -24,15 +24,15 @@ var a = _ref2[0];
|
||||
var b = _ref2[1];
|
||||
var _ref3 = [3, 4];
|
||||
|
||||
var _ref4 = _slicedToArray(_ref3, 2);
|
||||
var _ref3 = _slicedToArray(_ref3, 2);
|
||||
|
||||
var c = _ref4[0];
|
||||
var d = _ref4[1];
|
||||
var _ref5 = { e: 5, f: 6 };
|
||||
var c = _ref3[0];
|
||||
var d = _ref3[1];
|
||||
var _ref4 = { e: 5, f: 6 };
|
||||
|
||||
var e = _ref5.e;
|
||||
var f = _ref5.f;
|
||||
var _ref6 = { a: 7, b: 8 };
|
||||
var e = _ref4.e;
|
||||
var f = _ref4.f;
|
||||
var _ref5 = { a: 7, b: 8 };
|
||||
|
||||
var g = _ref6.a;
|
||||
var h = _ref6.b;
|
||||
var g = _ref5.a;
|
||||
var h = _ref5.b;
|
||||
|
||||
@@ -21,10 +21,10 @@ var _ref = ["hello", [", ", "junk"], ["world"]];
|
||||
var _ref2 = _slicedToArray(_ref, 4);
|
||||
|
||||
var a = _ref2[0];
|
||||
var _ref3 = _slicedToArray(_ref2[1], 1);
|
||||
var _ref2$1 = _slicedToArray(_ref2[1], 1);
|
||||
|
||||
var b = _ref3[0];
|
||||
var _ref4 = _slicedToArray(_ref2[2], 1);
|
||||
var b = _ref2$1[0];
|
||||
var _ref2$2 = _slicedToArray(_ref2[2], 1);
|
||||
|
||||
var c = _ref4[0];
|
||||
var c = _ref2$2[0];
|
||||
var d = _ref2[3];
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
var _temp, _ref;
|
||||
var _temp, _temp2;
|
||||
var _slicedToArray = function (arr, i) {
|
||||
if (Array.isArray(arr)) {
|
||||
return arr;
|
||||
@@ -17,4 +17,4 @@ var _slicedToArray = function (arr, i) {
|
||||
}
|
||||
};
|
||||
|
||||
console.log((_temp = [123], _ref = _slicedToArray(_temp, 1), x = _ref[0], _temp));
|
||||
console.log((_temp = [123], _temp2 = _slicedToArray(_temp, 1), x = _temp2[0], _temp));
|
||||
|
||||
@@ -21,10 +21,10 @@ var _ref = ["foo", "hello", [", ", "junk"], ["world"]];
|
||||
var _ref2 = _slicedToArray(_ref, 5);
|
||||
|
||||
var a = _ref2[1];
|
||||
var _ref3 = _slicedToArray(_ref2[2], 1);
|
||||
var _ref2$2 = _slicedToArray(_ref2[2], 1);
|
||||
|
||||
var b = _ref3[0];
|
||||
var _ref4 = _slicedToArray(_ref2[3], 1);
|
||||
var b = _ref2$2[0];
|
||||
var _ref2$3 = _slicedToArray(_ref2[3], 1);
|
||||
|
||||
var c = _ref4[0];
|
||||
var c = _ref2$3[0];
|
||||
var d = _ref2[4];
|
||||
|
||||
@@ -16,11 +16,11 @@ var _slicedToArray = function (arr, i) {
|
||||
}
|
||||
};
|
||||
|
||||
var _ref = _slicedToArray(rect.topLeft, 2);
|
||||
var _rect$topLeft = _slicedToArray(rect.topLeft, 2);
|
||||
|
||||
var x1 = _ref[0];
|
||||
var y1 = _ref[1];
|
||||
var _ref2 = _slicedToArray(rect.bottomRight, 2);
|
||||
var x1 = _rect$topLeft[0];
|
||||
var y1 = _rect$topLeft[1];
|
||||
var _rect$bottomRight = _slicedToArray(rect.bottomRight, 2);
|
||||
|
||||
var x2 = _ref2[0];
|
||||
var y2 = _ref2[1];
|
||||
var x2 = _rect$bottomRight[0];
|
||||
var y2 = _rect$bottomRight[1];
|
||||
|
||||
@@ -31,17 +31,17 @@ function unpackObject(_ref2) {
|
||||
|
||||
console.log(unpackObject({ title: "title", author: "author" }));
|
||||
|
||||
var unpackArray = function (_ref3, _ref5) {
|
||||
var _ref4 = _slicedToArray(_ref3, 3);
|
||||
var unpackArray = function (_ref3, _ref4) {
|
||||
var _ref3 = _slicedToArray(_ref3, 3);
|
||||
|
||||
var a = _ref4[0];
|
||||
var b = _ref4[1];
|
||||
var c = _ref4[2];
|
||||
var _ref6 = _slicedToArray(_ref5, 3);
|
||||
var a = _ref3[0];
|
||||
var b = _ref3[1];
|
||||
var c = _ref3[2];
|
||||
var _ref4 = _slicedToArray(_ref4, 3);
|
||||
|
||||
var x = _ref6[0];
|
||||
var y = _ref6[1];
|
||||
var z = _ref6[2];
|
||||
var x = _ref4[0];
|
||||
var y = _ref4[1];
|
||||
var z = _ref4[2];
|
||||
return a + b + c;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
define(["exports"], function (exports) {
|
||||
"use strict";
|
||||
"use strict";
|
||||
|
||||
define(["exports"], function (exports) {
|
||||
exports["default"] = foo;
|
||||
exports["default"] = 42;
|
||||
exports["default"] = {};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
define(["exports", "foo"], function (exports, _foo) {
|
||||
"use strict";
|
||||
"use strict";
|
||||
|
||||
define(["exports", "foo"], function (exports, _foo) {
|
||||
(function (obj) {
|
||||
for (var i in obj) {
|
||||
exports[i] = obj[i];
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
define(["exports"], function (exports) {
|
||||
"use strict";
|
||||
"use strict";
|
||||
|
||||
define(["exports"], function (exports) {
|
||||
exports.foo = foo;
|
||||
exports.foo = foo;
|
||||
exports.bar = bar;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
define(["exports"], function (exports) {
|
||||
"use strict";
|
||||
"use strict";
|
||||
|
||||
define(["exports"], function (exports) {
|
||||
exports.foo7 = foo7;
|
||||
var foo = exports.foo = 1;
|
||||
var foo = exports.foo = 1;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
define(["exports", "./evens"], function (exports, _evens) {
|
||||
"use strict";
|
||||
"use strict";
|
||||
|
||||
define(["exports", "./evens"], function (exports, _evens) {
|
||||
exports.nextOdd = nextOdd;
|
||||
var isEven = _evens.isEven;
|
||||
function nextOdd(n) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
define(["exports", "foo"], function (exports, _foo) {
|
||||
"use strict";
|
||||
"use strict";
|
||||
|
||||
define(["exports", "foo"], function (exports, _foo) {
|
||||
var _interopRequire = function (obj) {
|
||||
return obj && (obj["default"] || obj);
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
define(["exports", "foo"], function (exports, _foo) {
|
||||
"use strict";
|
||||
"use strict";
|
||||
|
||||
define(["exports", "foo"], function (exports, _foo) {
|
||||
var foo = _foo;
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
define(["exports", "foo"], function (exports, _foo) {
|
||||
"use strict";
|
||||
"use strict";
|
||||
|
||||
define(["exports", "foo"], function (exports, _foo) {
|
||||
var _interopRequire = function (obj) {
|
||||
return obj && (obj["default"] || obj);
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
define(["exports", "foo"], function (exports, _foo) {
|
||||
"use strict";
|
||||
"use strict";
|
||||
|
||||
define(["exports", "foo"], function (exports, _foo) {
|
||||
var bar = _foo.bar;
|
||||
var bar = _foo.bar;
|
||||
var baz = _foo.baz;
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
define(["exports", "foo", "foo-bar", "./directory/foo-bar"], function (exports, _foo, _fooBar, _directoryFooBar) {
|
||||
"use strict";
|
||||
});
|
||||
"use strict";
|
||||
|
||||
define(["exports", "foo", "foo-bar", "./directory/foo-bar"], function (exports, _foo, _fooBar, _directoryFooBar) {});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
define("es6-modules-amd/module-name/expected", ["exports"], function (exports) {
|
||||
"use strict";
|
||||
"use strict";
|
||||
|
||||
define("es6-modules-amd/module-name/expected", ["exports"], function (exports) {
|
||||
foobar();
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
define(["exports", "foo", "foo-bar", "./directory/foo-bar"], function (exports, _foo, _fooBar, _directoryFooBar) {
|
||||
"use strict";
|
||||
"use strict";
|
||||
|
||||
define(["exports", "foo", "foo-bar", "./directory/foo-bar"], function (exports, _foo, _fooBar, _directoryFooBar) {
|
||||
var _interopRequire = function (obj) {
|
||||
return obj && (obj["default"] || obj);
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
define(["exports"], function (exports) {
|
||||
"use strict";
|
||||
"use strict";
|
||||
|
||||
define(["exports"], function (exports) {
|
||||
var test = exports.test = 2;
|
||||
test = exports.test = 5;
|
||||
test = exports.test += 1;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
System.register([], function (_export) {
|
||||
var Foo;
|
||||
_export("default", foo);
|
||||
@@ -6,8 +8,6 @@ System.register([], function (_export) {
|
||||
return {
|
||||
setters: [],
|
||||
execute: function () {
|
||||
"use strict";
|
||||
|
||||
_export("default", 42);
|
||||
|
||||
_export("default", {});
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
System.register(["foo"], function (_export) {
|
||||
return {
|
||||
setters: [function (_foo) {
|
||||
@@ -19,8 +21,6 @@ System.register(["foo"], function (_export) {
|
||||
|
||||
_export("bar", _foo.bar);
|
||||
}],
|
||||
execute: function () {
|
||||
"use strict";
|
||||
}
|
||||
execute: function () {}
|
||||
};
|
||||
});
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
"use strict";
|
||||
|
||||
System.register([], function (_export) {
|
||||
return {
|
||||
setters: [],
|
||||
execute: function () {
|
||||
"use strict";
|
||||
|
||||
_export("foo", foo);
|
||||
|
||||
_export("foo", foo);
|
||||
@@ -19,4 +19,4 @@ System.register([], function (_export) {
|
||||
_export("bar", bar);
|
||||
}
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
System.register([], function (_export) {
|
||||
var foo, foo2, foo3, foo4, foo5, foo6, foo8;
|
||||
_export("foo7", foo7);
|
||||
@@ -6,8 +8,6 @@ System.register([], function (_export) {
|
||||
return {
|
||||
setters: [],
|
||||
execute: function () {
|
||||
"use strict";
|
||||
|
||||
foo = _export("foo", 1);
|
||||
foo2 = _export("foo2", function () {});
|
||||
foo3 = _export("foo3", undefined);
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
System.register(["./evens"], function (_export) {
|
||||
var isEven, p, isOdd;
|
||||
_export("nextOdd", nextOdd);
|
||||
@@ -11,8 +13,6 @@ System.register(["./evens"], function (_export) {
|
||||
isEven = _evens.isEven;
|
||||
}],
|
||||
execute: function () {
|
||||
"use strict";
|
||||
|
||||
p = _export("p", 5);
|
||||
isOdd = _export("isOdd", (function (isEven) {
|
||||
return function (n) {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
System.register(["foo"], function (_export) {
|
||||
var foo, foo;
|
||||
return {
|
||||
@@ -5,8 +7,6 @@ System.register(["foo"], function (_export) {
|
||||
foo = _foo["default"];
|
||||
foo = _foo["default"];
|
||||
}],
|
||||
execute: function () {
|
||||
"use strict";
|
||||
}
|
||||
execute: function () {}
|
||||
};
|
||||
});
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
"use strict";
|
||||
|
||||
System.register(["foo"], function (_export) {
|
||||
var foo;
|
||||
return {
|
||||
setters: [function (_foo) {
|
||||
foo = _foo;
|
||||
}],
|
||||
execute: function () {
|
||||
"use strict";
|
||||
}
|
||||
execute: function () {}
|
||||
};
|
||||
});
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
System.register(["foo"], function (_export) {
|
||||
var foo, xyz;
|
||||
return {
|
||||
@@ -5,8 +7,6 @@ System.register(["foo"], function (_export) {
|
||||
foo = _foo["default"];
|
||||
xyz = _foo.baz;
|
||||
}],
|
||||
execute: function () {
|
||||
"use strict";
|
||||
}
|
||||
execute: function () {}
|
||||
};
|
||||
});
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
System.register(["foo"], function (_export) {
|
||||
var bar, bar, baz, baz, baz, xyz;
|
||||
return {
|
||||
@@ -9,8 +11,6 @@ System.register(["foo"], function (_export) {
|
||||
baz = _foo.bar;
|
||||
xyz = _foo.xyz;
|
||||
}],
|
||||
execute: function () {
|
||||
"use strict";
|
||||
}
|
||||
execute: function () {}
|
||||
};
|
||||
});
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
"use strict";
|
||||
|
||||
System.register(["foo", "foo-bar", "./directory/foo-bar"], function (_export) {
|
||||
return {
|
||||
setters: [function (_foo) {}, function (_fooBar) {}, function (_directoryFooBar) {}],
|
||||
execute: function () {
|
||||
"use strict";
|
||||
}
|
||||
execute: function () {}
|
||||
};
|
||||
});
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
System.register(["foo", "foo-bar", "./directory/foo-bar"], function (_export) {
|
||||
var foo, foo, bar, bar, test;
|
||||
return {
|
||||
@@ -8,8 +10,6 @@ System.register(["foo", "foo-bar", "./directory/foo-bar"], function (_export) {
|
||||
bar = _foo.foo;
|
||||
}, function (_fooBar) {}, function (_directoryFooBar) {}],
|
||||
execute: function () {
|
||||
"use strict";
|
||||
|
||||
_export("test", test);
|
||||
|
||||
test = _export("test", 5);
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
System.register([], function (_export) {
|
||||
var test;
|
||||
return {
|
||||
setters: [],
|
||||
execute: function () {
|
||||
"use strict";
|
||||
|
||||
test = _export("test", 2);
|
||||
_export("test", test = 5);
|
||||
_export("test", test += 1);
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
(function (factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define(["exports"], factory);
|
||||
@@ -5,8 +7,6 @@
|
||||
factory(exports);
|
||||
}
|
||||
})(function (exports) {
|
||||
"use strict";
|
||||
|
||||
exports["default"] = foo;
|
||||
exports["default"] = 42;
|
||||
exports["default"] = {};
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
(function (factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define(["exports", "foo"], factory);
|
||||
@@ -5,8 +7,6 @@
|
||||
factory(exports, require("foo"));
|
||||
}
|
||||
})(function (exports, _foo) {
|
||||
"use strict";
|
||||
|
||||
(function (obj) {
|
||||
for (var i in obj) {
|
||||
exports[i] = obj[i];
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
(function (factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define(["exports"], factory);
|
||||
@@ -5,8 +7,6 @@
|
||||
factory(exports);
|
||||
}
|
||||
})(function (exports) {
|
||||
"use strict";
|
||||
|
||||
exports.foo = foo;
|
||||
exports.foo = foo;
|
||||
exports.bar = bar;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
(function (factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define(["exports"], factory);
|
||||
@@ -5,8 +7,6 @@
|
||||
factory(exports);
|
||||
}
|
||||
})(function (exports) {
|
||||
"use strict";
|
||||
|
||||
exports.foo7 = foo7;
|
||||
var foo = exports.foo = 1;
|
||||
var foo = exports.foo = 1;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
(function (factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define(["exports", "./evens"], factory);
|
||||
@@ -5,8 +7,6 @@
|
||||
factory(exports, require("./evens"));
|
||||
}
|
||||
})(function (exports, _evens) {
|
||||
"use strict";
|
||||
|
||||
exports.nextOdd = nextOdd;
|
||||
var isEven = _evens.isEven;
|
||||
function nextOdd(n) {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
(function (factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define(["exports", "foo"], factory);
|
||||
@@ -5,8 +7,6 @@
|
||||
factory(exports, require("foo"));
|
||||
}
|
||||
})(function (exports, _foo) {
|
||||
"use strict";
|
||||
|
||||
var _interopRequire = function (obj) {
|
||||
return obj && (obj["default"] || obj);
|
||||
};
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
(function (factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define(["exports", "foo"], factory);
|
||||
@@ -5,7 +7,5 @@
|
||||
factory(exports, require("foo"));
|
||||
}
|
||||
})(function (exports, _foo) {
|
||||
"use strict";
|
||||
|
||||
var foo = _foo;
|
||||
});
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
(function (factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define(["exports", "foo"], factory);
|
||||
@@ -5,8 +7,6 @@
|
||||
factory(exports, require("foo"));
|
||||
}
|
||||
})(function (exports, _foo) {
|
||||
"use strict";
|
||||
|
||||
var _interopRequire = function (obj) {
|
||||
return obj && (obj["default"] || obj);
|
||||
};
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
(function (factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define(["exports", "foo"], factory);
|
||||
@@ -5,8 +7,6 @@
|
||||
factory(exports, require("foo"));
|
||||
}
|
||||
})(function (exports, _foo) {
|
||||
"use strict";
|
||||
|
||||
var bar = _foo.bar;
|
||||
var bar = _foo.bar;
|
||||
var baz = _foo.baz;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
"use strict";
|
||||
|
||||
(function (factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define(["exports", "foo", "foo-bar", "./directory/foo-bar"], factory);
|
||||
} else if (typeof exports !== "undefined") {
|
||||
factory(exports, require("foo"), require("foo-bar"), require("./directory/foo-bar"));
|
||||
}
|
||||
})(function (exports, _foo, _fooBar, _directoryFooBar) {
|
||||
"use strict";
|
||||
});
|
||||
})(function (exports, _foo, _fooBar, _directoryFooBar) {});
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
(function (factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define("es6-modules-umd/module-name/expected", ["exports"], factory);
|
||||
@@ -5,7 +7,5 @@
|
||||
factory(exports);
|
||||
}
|
||||
})(function (exports) {
|
||||
"use strict";
|
||||
|
||||
foobar();
|
||||
});
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
(function (factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define(["exports", "foo", "foo-bar", "./directory/foo-bar"], factory);
|
||||
@@ -5,8 +7,6 @@
|
||||
factory(exports, require("foo"), require("foo-bar"), require("./directory/foo-bar"));
|
||||
}
|
||||
})(function (exports, _foo, _fooBar, _directoryFooBar) {
|
||||
"use strict";
|
||||
|
||||
var _interopRequire = function (obj) {
|
||||
return obj && (obj["default"] || obj);
|
||||
};
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
(function (factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define(["exports"], factory);
|
||||
@@ -5,8 +7,6 @@
|
||||
factory(exports);
|
||||
}
|
||||
})(function (exports) {
|
||||
"use strict";
|
||||
|
||||
var test = exports.test = 2;
|
||||
test = exports.test = 5;
|
||||
test = exports.test += 1;
|
||||
|
||||
@@ -2,9 +2,16 @@
|
||||
|
||||
function add() {
|
||||
var _arguments = arguments;
|
||||
return [1, 2, 3].map(function (i) {
|
||||
return i * _arguments[0];
|
||||
});
|
||||
return (function () {
|
||||
var _ref = [];
|
||||
|
||||
for (var _iterator = [1, 2, 3][Symbol.iterator](), _step; !(_step = _iterator.next()).done;) {
|
||||
var i = _step.value;
|
||||
_ref.push(i * _arguments[0]);
|
||||
}
|
||||
|
||||
return _ref;
|
||||
})();
|
||||
}
|
||||
|
||||
add(5);
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
var arr = [1, 2, 3].filter(function (i) {
|
||||
return i > 1;
|
||||
}).map(function (i) {
|
||||
return i * i;
|
||||
});
|
||||
var arr = (function () {
|
||||
var _arr = [];
|
||||
|
||||
for (var _iterator = [1, 2, 3][Symbol.iterator](), _step; !(_step = _iterator.next()).done;) {
|
||||
var i = _step.value;
|
||||
if (i > 1) {
|
||||
_arr.push(i * i);
|
||||
}
|
||||
}
|
||||
|
||||
return _arr;
|
||||
})();
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
"use strict";
|
||||
|
||||
var arr = [1, 2, 3].map(function (i) {
|
||||
return i * i;
|
||||
});
|
||||
var arr = (function () {
|
||||
var _arr = [];
|
||||
|
||||
for (var _iterator = [1, 2, 3][Symbol.iterator](), _step; !(_step = _iterator.next()).done;) {
|
||||
var i = _step.value;
|
||||
_arr.push(i * i);
|
||||
}
|
||||
|
||||
return _arr;
|
||||
})();
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
"use strict";
|
||||
|
||||
var seattlers = (function () {
|
||||
var _arr = [];
|
||||
var _seattlers = [];
|
||||
|
||||
for (var _iterator = countries[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) {
|
||||
var customers = _step.value;
|
||||
for (var _iterator2 = customers[Symbol.iterator](), _step2; !(_step2 = _iterator2.next()).done;) {
|
||||
var c = _step2.value;
|
||||
if (c.city == "Seattle") {
|
||||
_arr.push({ name: c.name, age: c.age });
|
||||
_seattlers.push({ name: c.name, age: c.age });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return _arr;
|
||||
return _seattlers;
|
||||
})();
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
var _toArray = function (arr) {
|
||||
return Array.isArray(arr) ? arr : Array.from(arr);
|
||||
};
|
||||
var arr = (function () {
|
||||
var _arr = [];
|
||||
|
||||
var arr = _toArray(nums).filter(function (i) {
|
||||
return i > 1;
|
||||
}).map(function (i) {
|
||||
return i * i;
|
||||
});
|
||||
for (var _iterator = nums[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) {
|
||||
var i = _step.value;
|
||||
if (i > 1) {
|
||||
_arr.push(i * i);
|
||||
}
|
||||
}
|
||||
|
||||
return _arr;
|
||||
})();
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
"use strict";
|
||||
|
||||
var _toArray = function (arr) {
|
||||
return Array.isArray(arr) ? arr : Array.from(arr);
|
||||
};
|
||||
var arr = (function () {
|
||||
var _arr = [];
|
||||
|
||||
var arr = _toArray(nums).map(function (i) {
|
||||
return i * i;
|
||||
});
|
||||
for (var _iterator = nums[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) {
|
||||
var i = _step.value;
|
||||
_arr.push(i * i);
|
||||
}
|
||||
|
||||
return _arr;
|
||||
})();
|
||||
|
||||
@@ -2,9 +2,16 @@
|
||||
|
||||
function add() {
|
||||
var _this = this;
|
||||
return [1, 2, 3].map(function (i) {
|
||||
return i * _this.multiplier;
|
||||
});
|
||||
return (function () {
|
||||
var _ref = [];
|
||||
|
||||
for (var _iterator = [1, 2, 3][Symbol.iterator](), _step; !(_step = _iterator.next()).done;) {
|
||||
var i = _step.value;
|
||||
_ref.push(i * _this.multiplier);
|
||||
}
|
||||
|
||||
return _ref;
|
||||
})();
|
||||
}
|
||||
|
||||
add.call({ multiplier: 5 });
|
||||
|
||||
3
test/fixtures/transformation/optional-async-to-generator/basic/actual.js
vendored
Normal file
3
test/fixtures/transformation/optional-async-to-generator/basic/actual.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
var foo = async function () {
|
||||
var wat = await bar();
|
||||
};
|
||||
42
test/fixtures/transformation/optional-async-to-generator/basic/expected.js
vendored
Normal file
42
test/fixtures/transformation/optional-async-to-generator/basic/expected.js
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
"use strict";
|
||||
|
||||
var _asyncToGenerator = function (fn) {
|
||||
return function () {
|
||||
var gen = fn.apply(this, arguments);
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
function step(getNext) {
|
||||
var next;
|
||||
try {
|
||||
next = getNext();
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
|
||||
return;
|
||||
}
|
||||
if (next.done) {
|
||||
resolve(next.value);
|
||||
|
||||
return;
|
||||
}
|
||||
Promise.resolve(next.value).then(function (v) {
|
||||
step(function () {
|
||||
return gen.next(v);
|
||||
});
|
||||
}, function (e) {
|
||||
step(function () {
|
||||
return gen["throw"](e);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
step(function () {
|
||||
return gen.next();
|
||||
});
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
var foo = _asyncToGenerator(function* () {
|
||||
var wat = yield bar();
|
||||
});
|
||||
3
test/fixtures/transformation/optional-async-to-generator/options.json
vendored
Normal file
3
test/fixtures/transformation/optional-async-to-generator/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"optional": ["asyncToGenerator"]
|
||||
}
|
||||
3
test/fixtures/transformation/optional-bluebird-coroutines/basic/actual.js
vendored
Normal file
3
test/fixtures/transformation/optional-bluebird-coroutines/basic/actual.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
var foo = async function () {
|
||||
var wat = await bar();
|
||||
};
|
||||
11
test/fixtures/transformation/optional-bluebird-coroutines/basic/expected.js
vendored
Normal file
11
test/fixtures/transformation/optional-bluebird-coroutines/basic/expected.js
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequire = function (obj) {
|
||||
return obj && (obj["default"] || obj);
|
||||
};
|
||||
|
||||
var Bluebird = _interopRequire(require("bluebird"));
|
||||
|
||||
var foo = Bluebird.coroutine(function* () {
|
||||
var wat = yield bar();
|
||||
});
|
||||
3
test/fixtures/transformation/optional-bluebird-coroutines/options.json
vendored
Normal file
3
test/fixtures/transformation/optional-bluebird-coroutines/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"optional": ["bluebirdCoroutines"]
|
||||
}
|
||||
@@ -27,10 +27,10 @@ var _ref = ["hello", [", ", "junk"], ["world"]];
|
||||
var _ref2 = _slicedToArray(_ref, 4);
|
||||
|
||||
var a = _ref2[0];
|
||||
var _ref3 = _slicedToArray(_ref2[1], 1);
|
||||
var _ref2$1 = _slicedToArray(_ref2[1], 1);
|
||||
|
||||
var b = _ref3[0];
|
||||
var _ref4 = _slicedToArray(_ref2[2], 1);
|
||||
var b = _ref2$1[0];
|
||||
var _ref2$2 = _slicedToArray(_ref2[2], 1);
|
||||
|
||||
var c = _ref4[0];
|
||||
var c = _ref2$2[0];
|
||||
var d = _ref2[3];
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
"use strict";
|
||||
|
||||
var _toArray = function (arr) {
|
||||
return Array.isArray(arr) ? arr : _core.Array.from(arr);
|
||||
};
|
||||
|
||||
var _interopRequire = function (obj) {
|
||||
return obj && (obj["default"] || obj);
|
||||
};
|
||||
|
||||
var _core = _interopRequire(require("core-js/library"));
|
||||
|
||||
var arr = _toArray(nums).map(function (i) {
|
||||
return i * i;
|
||||
});
|
||||
var arr = (function () {
|
||||
var _arr = [];
|
||||
|
||||
for (var _iterator = _core.$for.getIterator(nums), _step; !(_step = _iterator.next()).done;) {
|
||||
var i = _step.value;
|
||||
_arr.push(i * i);
|
||||
}
|
||||
|
||||
return _arr;
|
||||
})();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
var _propKey2, _obj2, _propKey4;
|
||||
var _ref2, _obj2, _ref4;
|
||||
var _hasOwn = Object.prototype.hasOwnProperty;
|
||||
var obj = {};
|
||||
|
||||
@@ -9,17 +9,17 @@ if (!_hasOwn.call(obj, "x")) obj.x = 2;
|
||||
|
||||
console.log((!_hasOwn.call(obj, "x") && (obj.x = 2), obj.x));
|
||||
|
||||
var _propKey = x();
|
||||
var _ref = x();
|
||||
|
||||
if (!_hasOwn.call(obj, _propKey)) obj[_propKey] = 2;
|
||||
if (!_hasOwn.call(obj, _ref)) obj[_ref] = 2;
|
||||
|
||||
|
||||
console.log((_propKey2 = x(), !_hasOwn.call(obj, _propKey2) && (obj[_propKey2] = 2), obj[_propKey2]));
|
||||
console.log((_ref2 = x(), !_hasOwn.call(obj, _ref2) && (obj[_ref2] = 2), obj[_ref2]));
|
||||
|
||||
var _obj = obj[y()];
|
||||
var _propKey3 = x();
|
||||
var _ref3 = x();
|
||||
|
||||
if (!_hasOwn.call(_obj, _propKey3)) _obj[_propKey3] = 2;
|
||||
if (!_hasOwn.call(_obj, _ref3)) _obj[_ref3] = 2;
|
||||
|
||||
|
||||
console.log((_obj2 = obj[y()], _propKey4 = x(), !_hasOwn.call(_obj2, _propKey4) && (_obj2[_propKey4] = 2), _obj2[_propKey4]));
|
||||
console.log((_obj2 = obj[y()], _ref4 = x(), !_hasOwn.call(_obj2, _ref4) && (_obj2[_ref4] = 2), _obj2[_ref4]));
|
||||
|
||||
Reference in New Issue
Block a user