Skip to content

Commit

Permalink
Updates from review and after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo committed Mar 16, 2020
1 parent 8aadff9 commit 771986f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 20 deletions.
20 changes: 5 additions & 15 deletions packages/babel-plugin-transform-for-of/src/index.js
Expand Up @@ -180,26 +180,16 @@ export default declare((api, options) => {
t.identifier("value"),
);

if (
t.isIdentifier(left) ||
t.isPattern(left) ||
t.isMemberExpression(left)
) {
// for (i of test), for ({ i } of test)
declar = t.expressionStatement(
t.assignmentExpression("=", left, stepValue),
);
} else if (t.isVariableDeclaration(left)) {
if (t.isVariableDeclaration(left)) {
// for (let i of test)
declar = t.variableDeclaration(left.kind, [
t.variableDeclarator(left.declarations[0].id, stepValue),
]);
} else {
throw path
.get("left")
.buildCodeFrameError(
`Unknown node type ${left.type} in ForStatement`,
);
// for (i of test), for ({ i } of test)
declar = t.expressionStatement(
t.assignmentExpression("=", left, stepValue),
);
}

// ensure that it's a block so we can take all its statements
Expand Down
@@ -1,15 +1,11 @@
function _createSuper(Derived) { return function () { var Super = babelHelpers.getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = babelHelpers.getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return babelHelpers.possibleConstructorReturn(this, result); }; }

function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }

function broken(x) {
if (true) {
var Foo = /*#__PURE__*/function (_Bar) {
"use strict";

babelHelpers.inherits(Foo, _Bar);

var _super = _createSuper(Foo);
var _super = babelHelpers.createSuper(Foo);

function Foo() {
babelHelpers.classCallCheck(this, Foo);
Expand Down

0 comments on commit 771986f

Please sign in to comment.