clean up destructuring transformer and optimise array destructuring - closes #749
This commit is contained in:
9
test/fixtures/transformation/es6-destructuring/array-unpack-optimisation/actual.js
vendored
Normal file
9
test/fixtures/transformation/es6-destructuring/array-unpack-optimisation/actual.js
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
// opt
|
||||
var [a, b] = [1, 2];
|
||||
var [[a, b]] = [[1, 2]];
|
||||
|
||||
// deopt
|
||||
var [a, b] = [1, 2, 3];
|
||||
var [[a, b]] = [[1, 2, 3]];
|
||||
var [a, b, ...items] = [1, 2, 3];
|
||||
var [[a, b, ...items]] = [[1, 2, 3]];
|
||||
23
test/fixtures/transformation/es6-destructuring/array-unpack-optimisation/expected.js
vendored
Normal file
23
test/fixtures/transformation/es6-destructuring/array-unpack-optimisation/expected.js
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
|
||||
// opt
|
||||
var a = 1;
|
||||
var b = 2;
|
||||
var a = 1;
|
||||
var b = 2;
|
||||
|
||||
// deopt
|
||||
var _ref = [1, 2, 3];
|
||||
var a = _ref[0];
|
||||
var b = _ref[1];
|
||||
var _ref2 = [1, 2, 3];
|
||||
var a = _ref2[0];
|
||||
var b = _ref2[1];
|
||||
var _ref3 = [1, 2, 3];
|
||||
var a = _ref3[0];
|
||||
var b = _ref3[1];
|
||||
var items = _ref3.slice(2);
|
||||
var _ref4 = [1, 2, 3];
|
||||
var a = _ref4[0];
|
||||
var b = _ref4[1];
|
||||
var items = _ref4.slice(2);
|
||||
Reference in New Issue
Block a user