Compare commits

...

14 Commits

Author SHA1 Message Date
Sebastian McKenzie
3a0dbabf5a v2.3.2 2015-01-02 01:04:43 +11:00
Sebastian McKenzie
383912c11b more reliable t.isExpression 2015-01-02 01:04:04 +11:00
Sebastian McKenzie
470c8fced0 add parens on expressions with trailing comments - fixes #349 2015-01-02 00:57:48 +11:00
Sebastian McKenzie
e3dc2355e8 v2.3.1 2015-01-02 00:46:14 +11:00
Sebastian McKenzie
9733cb58c9 remove unused variable 2015-01-02 00:45:26 +11:00
Sebastian McKenzie
edd5a3878a fix redefined variables 2015-01-02 00:45:01 +11:00
Sebastian McKenzie
78d2c4fa8d 2.3.1 changelog 2015-01-02 00:43:54 +11:00
Sebastian McKenzie
e268dc6138 return Object.defineProperties without a closure in property methods assignment unless it's really necessary 2015-01-02 00:42:28 +11:00
Sebastian McKenzie
5b6c0fcacd add whitespace after array and object expressions 2015-01-02 00:41:58 +11:00
Sebastian McKenzie
777f2be14e add undefinedToVoid optional transformer 2015-01-02 00:41:33 +11:00
Sebastian McKenzie
41d60a85e9 simplify define property by using a helper in playground object getter memoization 2015-01-02 00:40:47 +11:00
Sebastian McKenzie
800c350db6 use Object.defineProperty on computed properties - fixes #357 2015-01-02 00:40:37 +11:00
Sebastian McKenzie
7b5b8ab6ed add undefinedToVoid optional transformer 2015-01-02 00:25:17 +11:00
Sebastian McKenzie
52e23473ed allow export default non-functions mapping to module.exports in common module formatter - fixes #356 2015-01-01 22:58:46 +11:00
60 changed files with 421 additions and 236 deletions

View File

@@ -2,6 +2,15 @@
Gaps between patch versions are faulty/broken releases.
## 2.3.2
* Add parens on expressions with trailing comments.
## 2.3.1
* Add `undefinedToVoid` optional transformer.
* Use `Object.defineProperty` for computed properties.
## 2.3.0
* Upgrade `acorn-6to5`.

View File

@@ -26,7 +26,8 @@ File.declarations = [
"sliced-to-array",
"object-without-properties",
"has-own",
"slice"
"slice",
"define-property"
];
File.normaliseOptions = function (opts) {

View File

@@ -148,6 +148,11 @@ CodeGenerator.prototype.print = function (node, parent, opts) {
};
if (this[node.type]) {
// 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.printLeadingComments(node, parent);
newline(true);
@@ -155,11 +160,6 @@ 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 (needsParens) this.push(")");

View File

@@ -60,6 +60,10 @@ Node.prototype.needsParens = function () {
if (!parent) return false;
if (t.isExpression(node) && node.leadingComments && node.leadingComments.length) {
return true;
}
if (t.isNewExpression(parent) && parent.callee === node) {
return t.isCallExpression(node) || _.some(node, function (val) {
return t.isCallExpression(val);

View File

@@ -55,6 +55,8 @@ _.each({
Function: 1,
Class: 1,
For: 1,
ArrayExpression: { after: 1 },
ObjectExpression: { after: 1 },
SwitchStatement: 1,
IfStatement: { before: 1 },
CallExpression: { after: 1 },

View File

@@ -126,7 +126,7 @@ DefaultFormatter.prototype._pushStatement = function (ref, nodes) {
DefaultFormatter.prototype._hoistExport = function (declar, assign, priority) {
if (t.isFunctionDeclaration(declar)) {
assign._blockHoist = priority || 1;
assign._blockHoist = priority || 2;
}
return assign;

View File

@@ -57,6 +57,7 @@ CommonJSFormatter.prototype.importDeclaration = function (node, nodes) {
CommonJSFormatter.prototype.exportDeclaration = function (node, nodes) {
if (node.default) {
var declar = node.declaration;
var assign;
// module.exports = VALUE;
var templateName = "exports-default-module";
@@ -64,15 +65,29 @@ CommonJSFormatter.prototype.exportDeclaration = function (node, nodes) {
// exports = module.exports = VALUE;
if (this.hasNonDefaultExports) templateName = "exports-default-module-override";
var assign = util.template(templateName, {
VALUE: this._pushStatement(declar, nodes)
}, true);
if (t.isFunction(declar) || !this.hasNonDefaultExports) {
assign = util.template(templateName, {
VALUE: this._pushStatement(declar, nodes)
}, true);
// hoist to the top if this default is a function
nodes.push(this._hoistExport(declar, assign, 2));
} else {
DefaultFormatter.prototype.exportDeclaration.apply(this, arguments);
// hoist to the top if this default is a function
nodes.push(this._hoistExport(declar, assign, 3));
return;
} else {
// this export isn't a function so we can't hoist it to the top so we need to set it
// at the very end of the file with something like:
//
// module.exports = Object.assign(exports["default"], exports)
//
assign = util.template("common-export-default-assign", true);
assign._blockHoist = 0;
nodes.push(assign);
}
}
DefaultFormatter.prototype.exportDeclaration.apply(this, arguments);
};
CommonJSFormatter.prototype.exportSpecifier = function (specifier, node, nodes) {

View File

@@ -0,0 +1 @@
module.exports = Object.assign(exports["default"], exports);

View File

@@ -0,0 +1,8 @@
(function (obj, key, value) {
return Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
});

View File

@@ -1,3 +0,0 @@
(function (KEY) {
return KEY;
})(OBJECT)

View File

@@ -1,4 +0,0 @@
(function (KEY) {
CONTENT;
return KEY;
})(OBJECT);

View File

@@ -1,6 +0,0 @@
Object.defineProperty(this, KEY, {
enumerable: true,
configurable: true,
writable: true,
value: VALUE
})

View File

@@ -81,6 +81,7 @@ _.each({
_declarations: require("./transformers/_declarations"),
coreAliasing: require("./transformers/optional-core-aliasing"),
undefinedToVoid: require("./transformers/optional-undefined-to-void"),
// wrap up
_aliasFunctions: require("./transformers/_alias-functions"),

View File

@@ -1,17 +1,27 @@
var _ = require("lodash");
// Priority:
//
// - 0 We want this to be at the **very** bottom
// - 1 Default node position
// - 2 Priority over normal nodes
// - 3 We want this to be at the **very** top
exports.BlockStatement =
exports.Program = {
exit: function (node) {
var hasChange = false;
for (var i in node.body) {
var bodyNode = node.body[i];
if (bodyNode && bodyNode._blockHoist) hasChange = true;
if (bodyNode && bodyNode._blockHoist != null) hasChange = true;
}
if (!hasChange) return;
var nodePriorities = _.groupBy(node.body, function (bodyNode) {
return bodyNode._blockHoist || 0;
var priority = bodyNode._blockHoist;
if (priority == null) priority = 1;
if (priority === true) priority = 2;
return priority;
});
node.body = _.flatten(_.values(nodePriorities).reverse());

View File

@@ -20,14 +20,21 @@ exports.ObjectExpression = function (node, parent, file) {
if (!hasAny) return;
var objId = util.getUid(parent, file);
if (node.properties.length) {
var objId = util.getUid(parent, file);
return util.template("object-define-properties-closure", {
KEY: objId,
OBJECT: node,
CONTENT: util.template("object-define-properties", {
OBJECT: objId,
return util.template("object-define-properties-closure", {
KEY: objId,
OBJECT: node,
CONTENT: util.template("object-define-properties", {
OBJECT: objId,
PROPS: util.buildDefineProperties(mutatorMap)
})
});
} else {
return util.template("object-define-properties", {
OBJECT: node,
PROPS: util.buildDefineProperties(mutatorMap)
})
});
});
}
};

View File

@@ -3,45 +3,95 @@ var t = require("../../types");
exports.ObjectExpression = function (node, parent, file) {
var hasComputed = false;
var prop;
var key;
var i;
var computed = [];
node.properties = node.properties.filter(function (prop) {
if (prop.computed) {
hasComputed = true;
computed.unshift(prop);
return false;
} else {
return true;
}
});
for (i in node.properties) {
hasComputed = t.isProperty(node.properties[i], { computed: true });
if (hasComputed) break;
}
if (!hasComputed) return;
var objId = util.getUid(parent, file);
var container = util.template("function-return-obj", {
KEY: objId,
OBJECT: node
});
var body = [];
var container = t.functionExpression(null, [], t.blockStatement(body));
container._aliasFunction = true;
var containerCallee = container.callee;
var containerBody = containerCallee.body.body;
var props = node.properties;
containerCallee._aliasFunction = true;
// normalise key
for (var i in computed) {
var prop = computed[i];
containerBody.unshift(
t.expressionStatement(
t.assignmentExpression(
"=",
t.memberExpression(objId, prop.key, true),
prop.value
)
)
);
for (i in props) {
prop = props[i];
key = prop.key;
if (!prop.computed && t.isIdentifier(key)) {
prop.key = t.literal(key.name);
}
}
return container;
// add all non-computed properties and `__proto__` properties to the initializer
var initProps = [];
var broken = false;
for (i in props) {
prop = props[i];
if (prop.computed) {
broken = true;
}
if (!broken || t.isLiteral(prop.key, { value: "__proto__" })) {
initProps.push(prop);
props[i] = null;
}
}
// add a simple assignment for all Symbol member expressions due to symbol polyfill limitations
// otherwise use Object.defineProperty
for (i in props) {
prop = props[i];
if (!prop) continue;
key = prop.key;
var bodyNode;
if (prop.computed && t.isMemberExpression(key) && t.isIdentifier(key.object, { name: "Symbol" })) {
bodyNode = t.assignmentExpression(
"=",
t.memberExpression(objId, key, true),
prop.value
);
} else {
bodyNode = t.callExpression(file.addDeclaration("define-property"), [objId, key, prop.value]);
}
body.push(t.expressionStatement(bodyNode));
}
// only one node and it's a Object.defineProperty that returns the object
if (body.length === 1) {
var first = body[0].expression;
if (t.isCallExpression(first)) {
first.arguments[0] = t.objectExpression([]);
return first;
}
}
//
body.unshift(t.variableDeclaration("var", [
t.variableDeclarator(objId, t.objectExpression(initProps))
]));
body.push(t.returnStatement(objId));
return t.callExpression(container, []);
};

View File

@@ -0,0 +1,9 @@
var t = require("../../types");
exports.optional = true;
exports.Identifier = function (node, parent) {
if (node.name === "undefined" && t.isReferenced(node, parent)) {
return t.unaryExpression("void", t.literal(0), true);
}
};

View File

@@ -1,9 +1,8 @@
var traverse = require("../../traverse");
var util = require("../../util");
var t = require("../../types");
exports.Property =
exports.MethodDefinition = function (node) {
exports.MethodDefinition = function (node, parent, file) {
if (node.kind !== "memo") return;
node.kind = "get";
@@ -21,10 +20,11 @@ exports.MethodDefinition = function (node) {
if (t.isFunction(node)) return;
if (t.isReturnStatement(node) && node.argument) {
node.argument = t.memberExpression(util.template("object-getter-memoization", {
KEY: key,
VALUE: node.argument
}), key, true);
node.argument = t.memberExpression(t.callExpression(file.addDeclaration("define-property"), [
t.thisExpression(),
key,
node.argument
]), key, true);
}
}
});

View File

@@ -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"]
}

View File

@@ -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;
@@ -297,19 +289,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;

View File

@@ -1,7 +1,7 @@
{
"name": "6to5",
"description": "Turn ES6 code into readable vanilla ES5 with source maps",
"version": "2.3.0",
"version": "2.3.2",
"author": "Sebastian McKenzie <sebmck@gmail.com>",
"homepage": "https://github.com/6to5/6to5",
"repository": {

View File

@@ -3,8 +3,8 @@ var test = {
* Before bracket init
*/
["a"]: "1",
[/*
* Inside bracket init
*/
"b"]: "2"
[( /*
* Inside bracket init
*/
"b")]: "2"
}, ok = 42;

View File

@@ -4,10 +4,10 @@ var test = {
*/
["a"]: "1",
[/*
* Inside bracket init
*/
"b"]: "2",
[( /*
* Inside bracket init
*/
"b")]: "2",
["c"
/*
@@ -17,9 +17,9 @@ var test = {
// Before bracket, line comment
["d"]: "4",
[
[(
// Inside bracket, line comment
"e"]: "5",
"e")]: "5",
["f"
// After bracket, line comment

View File

@@ -1,17 +1,13 @@
"use strict";
var obj = (function (_obj) {
Object.defineProperties(_obj, {
foo: {
get: function () {
return 5 + 5;
},
set: function (value) {
this._foo = value;
},
enumerable: true
}
});
return _obj;
})({});
var obj = Object.defineProperties({}, {
foo: {
get: function () {
return 5 + 5;
},
set: function (value) {
this._foo = value;
},
enumerable: true
}
});

View File

@@ -1,14 +1,10 @@
"use strict";
var obj = (function (_obj) {
Object.defineProperties(_obj, {
foo: {
get: function () {
return 5 + 5;
},
enumerable: true
}
});
return _obj;
})({});
var obj = Object.defineProperties({}, {
foo: {
get: function () {
return 5 + 5;
},
enumerable: true
}
});

View File

@@ -1,14 +1,10 @@
"use strict";
var obj = (function (_obj) {
Object.defineProperties(_obj, {
foo: {
set: function (value) {
this._foo = value;
},
enumerable: true
}
});
return _obj;
})({});
var obj = Object.defineProperties({}, {
foo: {
set: function (value) {
this._foo = value;
},
enumerable: true
}
});

View File

@@ -1,6 +1,12 @@
"use strict";
foo((function (_ref) {
_ref[bar] = "foobar";
return _ref;
})({}));
var _defineProperty = function (obj, key, value) {
return Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
};
foo(_defineProperty({}, bar, "foobar"));

View File

@@ -1,6 +1,12 @@
"use strict";
foo = (function (_foo) {
_foo[bar] = "foobar";
return _foo;
})({});
var _defineProperty = function (obj, key, value) {
return Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
};
foo = _defineProperty({}, bar, "foobar");

View File

@@ -0,0 +1,3 @@
var foo = {
[Symbol.iterator]: "foobar"
};

View File

@@ -0,0 +1,8 @@
"use strict";
var foo = (function () {
var _foo = {};
_foo[Symbol.iterator] = "foobar";
return _foo;
})();

View File

@@ -1,9 +1,14 @@
"use strict";
var obj = (function (_obj) {
_obj[foobar] = function () {
return "foobar";
};
var _defineProperty = function (obj, key, value) {
return Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
};
return _obj;
})({});
var obj = _defineProperty({}, foobar, function () {
return "foobar";
});

View File

@@ -1,10 +1,24 @@
"use strict";
var obj = (function (_obj) {
_obj["x" + foo] = "heh";
_obj["y" + bar] = "noo";
var _defineProperty = function (obj, key, value) {
return Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
};
var obj = (function () {
var _obj = {};
_defineProperty(_obj, "x" + foo, "heh");
_defineProperty(_obj, "y" + bar, "noo");
_defineProperty(_obj, "foo", "foo");
_defineProperty(_obj, "bar", "bar");
return _obj;
})({
foo: "foo",
bar: "bar"
});
})();

View File

@@ -1,7 +1,20 @@
"use strict";
var obj = (function (_obj) {
_obj["x" + foo] = "heh";
_obj["y" + bar] = "noo";
var _defineProperty = function (obj, key, value) {
return Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
};
var obj = (function () {
var _obj = {};
_defineProperty(_obj, "x" + foo, "heh");
_defineProperty(_obj, "y" + bar, "noo");
return _obj;
})({});
})();

View File

@@ -1,6 +1,12 @@
"use strict";
var obj = (function (_obj) {
_obj["x" + foo] = "heh";
return _obj;
})({});
var _defineProperty = function (obj, key, value) {
return Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
};
var obj = _defineProperty({}, "x" + foo, "heh");

View File

@@ -1,7 +1,12 @@
"use strict";
var _this = this;
var obj = (function (_obj) {
_obj["x" + _this.foo] = "heh";
return _obj;
})({});
var _defineProperty = function (obj, key, value) {
return Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
};
var obj = _defineProperty({}, "x" + this.foo, "heh");

View File

@@ -1,6 +1,12 @@
"use strict";
var foo = (function (_foo) {
_foo[bar] = "foobar";
return _foo;
})({});
var _defineProperty = function (obj, key, value) {
return Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
};
var foo = _defineProperty({}, bar, "foobar");

View File

@@ -5,6 +5,7 @@ var _slicedToArray = function (arr, i) {
return arr;
} else {
var _arr = [];
for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) {
_arr.push(_step.value);
@@ -28,8 +29,10 @@ var _ref4 = _slicedToArray(_ref3, 2);
var c = _ref4[0];
var d = _ref4[1];
var _ref5 = { e: 5, f: 6 };
var e = _ref5.e;
var f = _ref5.f;
var _ref6 = { a: 7, b: 8 };
var g = _ref6.a;
var h = _ref6.b;

View File

@@ -5,6 +5,7 @@ var _slicedToArray = function (arr, i) {
return arr;
} else {
var _arr = [];
for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) {
_arr.push(_step.value);

View File

@@ -6,6 +6,7 @@ var _slicedToArray = function (arr, i) {
return arr;
} else {
var _arr = [];
for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) {
_arr.push(_step.value);

View File

@@ -5,6 +5,7 @@ var _slicedToArray = function (arr, i) {
return arr;
} else {
var _arr = [];
for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) {
_arr.push(_step.value);

View File

@@ -5,6 +5,7 @@ var _slicedToArray = function (arr, i) {
return arr;
} else {
var _arr = [];
for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) {
_arr.push(_step.value);

View File

@@ -2,6 +2,7 @@
var _objectWithoutProperties = function (obj, keys) {
var target = {};
for (var i in obj) {
if (keys.indexOf(i) >= 0) continue;
if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;

View File

@@ -5,6 +5,7 @@ var _slicedToArray = function (arr, i) {
return arr;
} else {
var _arr = [];
for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) {
_arr.push(_step.value);

View File

@@ -5,6 +5,7 @@ var _slicedToArray = function (arr, i) {
return arr;
} else {
var _arr = [];
for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) {
_arr.push(_step.value);

View File

@@ -5,6 +5,7 @@ var _slicedToArray = function (arr, i) {
return arr;
} else {
var _arr = [];
for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) {
_arr.push(_step.value);

View File

@@ -5,6 +5,7 @@ var _slicedToArray = function (arr, i) {
return arr;
} else {
var _arr = [];
for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) {
_arr.push(_step.value);

View File

@@ -5,6 +5,7 @@ var _slicedToArray = function (arr, i) {
return arr;
} else {
var _arr = [];
for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) {
_arr.push(_step.value);

View File

@@ -0,0 +1,3 @@
export default new Cachier()
export function Cachier(databaseName) {}

View File

@@ -0,0 +1,6 @@
"use strict";
exports.Cachier = Cachier;
exports["default"] = new Cachier();
function Cachier(databaseName) {}
module.exports = Object.assign(exports["default"], exports);

View File

@@ -8,5 +8,3 @@ import {foo as bar} from "foo";
export {test};
export var test = 5;
export default test;

View File

@@ -18,5 +18,3 @@ var bar = require("foo").bar;
var bar = require("foo").foo;
exports.test = test;
var test = exports.test = 5;
exports = module.exports = test;

View File

@@ -2,6 +2,7 @@
var seattlers = (function () {
var _arr = [];
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;) {

View File

@@ -2,6 +2,7 @@
var arr = (function () {
var _arr = [];
for (var _iterator = "abcdefgh".split("")[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) {
var x = _step.value;
for (var _iterator2 = "12345678".split("")[Symbol.iterator](), _step2; !(_step2 = _iterator2.next()).done;) {

View File

@@ -5,6 +5,7 @@ var _slicedToArray = function (arr, i) {
return arr;
} else {
var _arr = [];
for (var _iterator = _core.$for.getIterator(arr), _step; !(_step = _iterator.next()).done;) {
_arr.push(_step.value);

View File

@@ -0,0 +1,2 @@
var foo;
foo === undefined;

View File

@@ -0,0 +1,4 @@
"use strict";
var foo;
foo === void 0;

View File

@@ -0,0 +1,2 @@
var foo;
foo === undefined.foo;

View File

@@ -0,0 +1,4 @@
"use strict";
var foo;
foo === (void 0).foo;

View File

@@ -0,0 +1,3 @@
{
"optional": ["undefinedToVoid"]
}

View File

@@ -5,60 +5,24 @@ var _prototypeProperties = function (child, staticProps, instanceProps) {
if (instanceProps) Object.defineProperties(child.prototype, instanceProps);
};
var _defineProperty = function (obj, key, value) {
return Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
};
var Foo = function Foo() {};
_prototypeProperties(Foo, null, (function (_ref) {
_ref[bar] = {
get: function () {
return Object.defineProperty(this, bar, {
enumerable: true,
configurable: true,
writable: true,
value: complex()
})[bar];
},
enumerable: true
};
return _ref;
})({
bar: {
get: function () {
return Object.defineProperty(this, "bar", {
enumerable: true,
configurable: true,
writable: true,
value: complex()
}).bar;
},
enumerable: true
}
_prototypeProperties(Foo, null, _defineProperty({}, bar, {
get: function () {
return _defineProperty(this, bar, complex())[bar];
},
enumerable: true
}));
var foo = (function (_foo) {
_foo[bar] = function () {
return Object.defineProperty(this, bar, {
enumerable: true,
configurable: true,
writable: true,
value: complex()
})[bar];
};
return _foo;
})((function (_ref2) {
Object.defineProperties(_ref2, {
bar: {
get: function () {
return Object.defineProperty(this, "bar", {
enumerable: true,
configurable: true,
writable: true,
value: complex()
}).bar;
},
enumerable: true
}
});
return _ref2;
})({}));
var foo = _defineProperty({}, bar, function () {
return _defineProperty(this, bar, complex())[bar];
});