commit
ce2335604c
@ -32,7 +32,7 @@
|
||||
"babel-template": "7.0.0-alpha.9",
|
||||
"babel-traverse": "7.0.0-alpha.9",
|
||||
"babel-types": "7.0.0-alpha.9",
|
||||
"babylon": "7.0.0-beta.8",
|
||||
"babylon": "7.0.0-beta.10",
|
||||
"convert-source-map": "^1.1.0",
|
||||
"debug": "^2.1.1",
|
||||
"json5": "^0.5.0",
|
||||
|
||||
@ -1,5 +1,13 @@
|
||||
export function ClassDeclaration(node: Object) {
|
||||
this.printJoin(node.decorators, node);
|
||||
import * as t from "babel-types";
|
||||
|
||||
export function ClassDeclaration(node: Object, parent: Object) {
|
||||
if (
|
||||
!t.isExportDefaultDeclaration(parent) &&
|
||||
!t.isExportNamedDeclaration(parent)
|
||||
) {
|
||||
this.printJoin(node.decorators, node);
|
||||
}
|
||||
|
||||
this.word("class");
|
||||
|
||||
if (node.id) {
|
||||
|
||||
@ -52,13 +52,21 @@ export function ExportAllDeclaration(node: Object) {
|
||||
this.semicolon();
|
||||
}
|
||||
|
||||
export function ExportNamedDeclaration() {
|
||||
export function ExportNamedDeclaration(node: Object) {
|
||||
if (t.isClassDeclaration(node.declaration)) {
|
||||
this.printJoin(node.declaration.decorators, node);
|
||||
}
|
||||
|
||||
this.word("export");
|
||||
this.space();
|
||||
ExportDeclaration.apply(this, arguments);
|
||||
}
|
||||
|
||||
export function ExportDefaultDeclaration() {
|
||||
export function ExportDefaultDeclaration(node: Object) {
|
||||
if (t.isClassDeclaration(node.declaration)) {
|
||||
this.printJoin(node.declaration.decorators, node);
|
||||
}
|
||||
|
||||
this.word("export");
|
||||
this.space();
|
||||
this.word("default");
|
||||
|
||||
@ -9,6 +9,7 @@ declare class A<T> extends B<T> { x: number }
|
||||
declare class A { static foo(): number; static x : string }
|
||||
declare class A { static [ indexer: number]: string }
|
||||
declare class A { static () : number }
|
||||
declare class B { (): number }
|
||||
declare class A mixins B<T>, C {}
|
||||
declare type A = string
|
||||
declare type T<U> = { [k:string]: U }
|
||||
|
||||
@ -9,6 +9,7 @@ declare class A<T> extends B<T> { x: number }
|
||||
declare class A { static foo: () => number, static x: string, }
|
||||
declare class A { static [indexer: number]: string }
|
||||
declare class A { static (): number }
|
||||
declare class B { (): number }
|
||||
declare class A mixins B<T>, C {}
|
||||
declare type A = string;
|
||||
declare type T<U> = { [k: string]: U };
|
||||
|
||||
1
packages/babel-generator/test/fixtures/regression/babylon-317/actual.js
vendored
Normal file
1
packages/babel-generator/test/fixtures/regression/babylon-317/actual.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
({ set = {} }) => set;
|
||||
1
packages/babel-generator/test/fixtures/regression/babylon-317/expected.js
vendored
Normal file
1
packages/babel-generator/test/fixtures/regression/babylon-317/expected.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
({ set = {} }) => set;
|
||||
@ -3,6 +3,7 @@ class Foo {
|
||||
foo = 1;
|
||||
"foo";
|
||||
"foo" = 1;
|
||||
foo = super.foo();
|
||||
["foo"];
|
||||
["foo"] = 1;
|
||||
["f" + "oo"];
|
||||
@ -12,8 +13,56 @@ class Foo {
|
||||
static foo = 1;
|
||||
static "foo";
|
||||
static "foo" = 1;
|
||||
static foo = super.foo();
|
||||
static ["foo"];
|
||||
static ["foo"] = 1;
|
||||
static ["f" + "oo"];
|
||||
static ["f" + "oo"] = 1;
|
||||
|
||||
get;
|
||||
set;
|
||||
static;
|
||||
static = 1;
|
||||
async;
|
||||
foo; bar;
|
||||
foo = 0; bar = 1;
|
||||
}
|
||||
|
||||
class A1 {
|
||||
static
|
||||
a
|
||||
static
|
||||
}
|
||||
|
||||
class A2 {
|
||||
get
|
||||
*a(){}
|
||||
}
|
||||
|
||||
class A3 {
|
||||
static
|
||||
*a(){}
|
||||
}
|
||||
|
||||
class A4 {
|
||||
async
|
||||
a(){}
|
||||
}
|
||||
|
||||
class A5 {
|
||||
static
|
||||
async
|
||||
a
|
||||
}
|
||||
|
||||
class A6 {
|
||||
get
|
||||
['a'](){}
|
||||
}
|
||||
|
||||
class A7 {
|
||||
static
|
||||
get
|
||||
static
|
||||
(){}
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ class Foo {
|
||||
foo = 1;
|
||||
"foo";
|
||||
"foo" = 1;
|
||||
foo = super.foo();
|
||||
["foo"];
|
||||
["foo"] = 1;
|
||||
["f" + "oo"];
|
||||
@ -12,8 +13,49 @@ class Foo {
|
||||
static foo = 1;
|
||||
static "foo";
|
||||
static "foo" = 1;
|
||||
static foo = super.foo();
|
||||
static ["foo"];
|
||||
static ["foo"] = 1;
|
||||
static ["f" + "oo"];
|
||||
static ["f" + "oo"] = 1;
|
||||
|
||||
get;
|
||||
set;
|
||||
static;
|
||||
static = 1;
|
||||
async;
|
||||
foo;bar;
|
||||
foo = 0;bar = 1;
|
||||
}
|
||||
|
||||
class A1 {
|
||||
static a;
|
||||
static;
|
||||
}
|
||||
|
||||
class A2 {
|
||||
get;
|
||||
*a() {}
|
||||
}
|
||||
|
||||
class A3 {
|
||||
static *a() {}
|
||||
}
|
||||
|
||||
class A4 {
|
||||
async;
|
||||
a() {}
|
||||
}
|
||||
|
||||
class A5 {
|
||||
static async;
|
||||
a;
|
||||
}
|
||||
|
||||
class A6 {
|
||||
get ['a']() {}
|
||||
}
|
||||
|
||||
class A7 {
|
||||
static get static() {}
|
||||
}
|
||||
|
||||
@ -10,4 +10,46 @@ class Foo {
|
||||
static ["foo"]() {}
|
||||
static get foo() {}
|
||||
static set foo(bar) {}
|
||||
static static() {}
|
||||
|
||||
get
|
||||
() {}
|
||||
|
||||
set
|
||||
() {}
|
||||
|
||||
static
|
||||
() {}
|
||||
|
||||
async
|
||||
() {}
|
||||
|
||||
static
|
||||
get
|
||||
() {}
|
||||
|
||||
static
|
||||
set
|
||||
() {}
|
||||
|
||||
static
|
||||
static
|
||||
() {}
|
||||
|
||||
static
|
||||
async
|
||||
() {}
|
||||
|
||||
static
|
||||
a
|
||||
() {}
|
||||
|
||||
get
|
||||
async
|
||||
() {}
|
||||
|
||||
static
|
||||
get
|
||||
static
|
||||
() {}
|
||||
}
|
||||
|
||||
@ -10,4 +10,27 @@ class Foo {
|
||||
static ["foo"]() {}
|
||||
static get foo() {}
|
||||
static set foo(bar) {}
|
||||
static static() {}
|
||||
|
||||
get() {}
|
||||
|
||||
set() {}
|
||||
|
||||
static() {}
|
||||
|
||||
async() {}
|
||||
|
||||
static get() {}
|
||||
|
||||
static set() {}
|
||||
|
||||
static static() {}
|
||||
|
||||
static async() {}
|
||||
|
||||
static a() {}
|
||||
|
||||
get async() {}
|
||||
|
||||
static get static() {}
|
||||
}
|
||||
|
||||
@ -29,3 +29,17 @@ class Foo {
|
||||
@bar
|
||||
set bar(foo) {}
|
||||
}
|
||||
|
||||
@foo
|
||||
export default class Foo {
|
||||
bar() {
|
||||
class Baz {}
|
||||
}
|
||||
}
|
||||
|
||||
@foo
|
||||
export class Foo {
|
||||
bar() {
|
||||
class Baz {}
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,3 +29,17 @@ class Foo {
|
||||
@bar
|
||||
set bar(foo) {}
|
||||
}
|
||||
|
||||
@foo
|
||||
export default class Foo {
|
||||
bar() {
|
||||
class Baz {}
|
||||
}
|
||||
}
|
||||
|
||||
@foo
|
||||
export class Foo {
|
||||
bar() {
|
||||
class Baz {}
|
||||
}
|
||||
}
|
||||
1
packages/babel-generator/test/fixtures/types/ExportDefaultDeclaration10/actual.js
vendored
Normal file
1
packages/babel-generator/test/fixtures/types/ExportDefaultDeclaration10/actual.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
export async function foo() {}
|
||||
1
packages/babel-generator/test/fixtures/types/ExportDefaultDeclaration10/expected.js
vendored
Normal file
1
packages/babel-generator/test/fixtures/types/ExportDefaultDeclaration10/expected.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
export async function foo() {}
|
||||
1
packages/babel-generator/test/fixtures/types/ExportDefaultDeclaration11/actual.js
vendored
Normal file
1
packages/babel-generator/test/fixtures/types/ExportDefaultDeclaration11/actual.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
export default async () => await foo()
|
||||
1
packages/babel-generator/test/fixtures/types/ExportDefaultDeclaration11/expected.js
vendored
Normal file
1
packages/babel-generator/test/fixtures/types/ExportDefaultDeclaration11/expected.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
export default (async () => await foo());
|
||||
1
packages/babel-generator/test/fixtures/types/ExportDefaultDeclaration9/actual.js
vendored
Normal file
1
packages/babel-generator/test/fixtures/types/ExportDefaultDeclaration9/actual.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
export default async function bar() {}
|
||||
1
packages/babel-generator/test/fixtures/types/ExportDefaultDeclaration9/expected.js
vendored
Normal file
1
packages/babel-generator/test/fixtures/types/ExportDefaultDeclaration9/expected.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
export default async function bar() {}
|
||||
1
packages/babel-generator/test/fixtures/types/ExportSpecifier16/actual.js
vendored
Normal file
1
packages/babel-generator/test/fixtures/types/ExportSpecifier16/actual.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
export * as default from "foo";
|
||||
1
packages/babel-generator/test/fixtures/types/ExportSpecifier16/expected.js
vendored
Normal file
1
packages/babel-generator/test/fixtures/types/ExportSpecifier16/expected.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
export * as default from "foo";
|
||||
@ -10,3 +10,4 @@ false;
|
||||
0b10;
|
||||
0o70;
|
||||
0X1F;
|
||||
-0b1111011;
|
||||
|
||||
@ -10,3 +10,4 @@ false;
|
||||
0b10;
|
||||
0o70;
|
||||
0X1F;
|
||||
-0b1111011;
|
||||
|
||||
3
packages/babel-generator/test/fixtures/types/RestProperty/actual.js
vendored
Normal file
3
packages/babel-generator/test/fixtures/types/RestProperty/actual.js
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
var { ...{ z } } = { z: 1 };
|
||||
var { ...{ x = 5 } } = { x : 1 };
|
||||
({ x, ...{ y, z } } = o);
|
||||
3
packages/babel-generator/test/fixtures/types/RestProperty/expected.js
vendored
Normal file
3
packages/babel-generator/test/fixtures/types/RestProperty/expected.js
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
var { ...{ z } } = { z: 1 };
|
||||
var { ...{ x = 5 } } = { x: 1 };
|
||||
({ x, ...{ y, z } } = o);
|
||||
9
packages/babel-plugin-transform-class-properties/test/fixtures/spec/super-call/actual.js
vendored
Normal file
9
packages/babel-plugin-transform-class-properties/test/fixtures/spec/super-call/actual.js
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
class A {
|
||||
foo() {
|
||||
return "bar";
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
foo = super.foo();
|
||||
}
|
||||
30
packages/babel-plugin-transform-class-properties/test/fixtures/spec/super-call/expected.js
vendored
Normal file
30
packages/babel-plugin-transform-class-properties/test/fixtures/spec/super-call/expected.js
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
var A = function () {
|
||||
function A() {
|
||||
babelHelpers.classCallCheck(this, A);
|
||||
}
|
||||
|
||||
babelHelpers.createClass(A, [{
|
||||
key: "foo",
|
||||
value: function foo() {
|
||||
return "bar";
|
||||
}
|
||||
}]);
|
||||
return A;
|
||||
}();
|
||||
|
||||
var B = function (_A) {
|
||||
babelHelpers.inherits(B, _A);
|
||||
|
||||
function B(...args) {
|
||||
var _temp, _this, _ret;
|
||||
|
||||
babelHelpers.classCallCheck(this, B);
|
||||
return _ret = (_temp = (_this = babelHelpers.possibleConstructorReturn(this, (B.__proto__ || Object.getPrototypeOf(B)).call(this, ...args)), _this), Object.defineProperty(_this, "foo", {
|
||||
enumerable: true,
|
||||
writable: true,
|
||||
value: babelHelpers.get(B.prototype.__proto__ || Object.getPrototypeOf(B.prototype), "foo", _this).call(_this)
|
||||
}), _temp), babelHelpers.possibleConstructorReturn(_this, _ret);
|
||||
}
|
||||
|
||||
return B;
|
||||
}(A);
|
||||
14
packages/babel-plugin-transform-decorators/test/fixtures/class-export-default/exec.js
vendored
Normal file
14
packages/babel-plugin-transform-decorators/test/fixtures/class-export-default/exec.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
const calls = [];
|
||||
|
||||
function foo(target) {
|
||||
calls.push(target.name);
|
||||
}
|
||||
|
||||
@foo
|
||||
export default class Foo {
|
||||
bar() {
|
||||
class Baz {}
|
||||
}
|
||||
}
|
||||
|
||||
assert.deepEqual(calls, ["Foo"]);
|
||||
@ -2,4 +2,6 @@ var z = {};
|
||||
var { ...x } = z;
|
||||
var { x, ...y } = z;
|
||||
var { [x]: x, ...y } = z;
|
||||
(function({ x, ...y }) { })
|
||||
(function({ x, ...y }) { });
|
||||
|
||||
({ x, ...{ y, z } } = o);
|
||||
|
||||
@ -1,11 +1,23 @@
|
||||
var z = {};
|
||||
var x = babelHelpers.objectWithoutProperties(z, []);
|
||||
var x = z.x,
|
||||
y = babelHelpers.objectWithoutProperties(z, ["x"]);
|
||||
var x = z[x],
|
||||
y = babelHelpers.objectWithoutProperties(z, [x]);
|
||||
var _z = z,
|
||||
x = babelHelpers.objectWithoutProperties(_z, []);
|
||||
var _z2 = z,
|
||||
x = _z2.x,
|
||||
y = babelHelpers.objectWithoutProperties(_z2, ["x"]);
|
||||
var _z3 = z,
|
||||
x = _z3[x],
|
||||
y = babelHelpers.objectWithoutProperties(_z3, [x]);
|
||||
|
||||
(function (_ref) {
|
||||
var x = _ref.x,
|
||||
y = babelHelpers.objectWithoutProperties(_ref, ["x"]);
|
||||
});
|
||||
|
||||
var _o = o;
|
||||
x = _o.x;
|
||||
|
||||
var _babelHelpers$objectW = babelHelpers.objectWithoutProperties(_o, ["x"]);
|
||||
|
||||
y = _babelHelpers$objectW.y;
|
||||
z = _babelHelpers$objectW.z;
|
||||
_o;
|
||||
@ -0,0 +1 @@
|
||||
export * as default from "foo";
|
||||
@ -0,0 +1,2 @@
|
||||
import * as _default from "foo";
|
||||
export { _default as default };
|
||||
@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["external-helpers", "transform-export-extensions"]
|
||||
}
|
||||
@ -17,3 +17,6 @@ let {
|
||||
} = complex;
|
||||
|
||||
let { x4: { ...y4 } } = z;
|
||||
|
||||
var { ...{ z } } = { z: 1 };
|
||||
var { ...{ x = 5 } } = { x : 1 };
|
||||
|
||||
@ -24,3 +24,6 @@ let {
|
||||
|
||||
let {} = z,
|
||||
y4 = babelHelpers.objectWithoutProperties(z.x4, []);
|
||||
|
||||
var { z } = babelHelpers.objectWithoutProperties({ z: 1 }, []);
|
||||
var { x = 5 } = babelHelpers.objectWithoutProperties({ x: 1 }, []);
|
||||
@ -8,7 +8,7 @@
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-template",
|
||||
"main": "lib/index.js",
|
||||
"dependencies": {
|
||||
"babylon": "7.0.0-beta.8",
|
||||
"babylon": "7.0.0-beta.10",
|
||||
"babel-traverse": "7.0.0-alpha.9",
|
||||
"babel-types": "7.0.0-alpha.9",
|
||||
"lodash": "^4.2.0"
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
"babel-helper-function-name": "7.0.0-alpha.7",
|
||||
"babel-messages": "7.0.0-alpha.9",
|
||||
"babel-types": "7.0.0-alpha.9",
|
||||
"babylon": "7.0.0-beta.8",
|
||||
"babylon": "7.0.0-beta.10",
|
||||
"debug": "^2.2.0",
|
||||
"globals": "^9.0.0",
|
||||
"invariant": "^2.2.0",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user