Skip to content

Commit

Permalink
Do not remove generator markers (#463)
Browse files Browse the repository at this point in the history
Fixes #462
  • Loading branch information
itsbth authored and alangpierce committed Aug 26, 2019
1 parent 6ed6dff commit 8882acd
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/util/getClassInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ function isAccessModifier(token: Token): boolean {
tt._private,
tt._protected,
tt._abstract,
tt.star,
].includes(token.type);
}

Expand Down
38 changes: 38 additions & 0 deletions test/sucrase-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,44 @@ describe("sucrase", () => {
);
});

it("handles generator class methods", () => {
assertResult(
`
class A {
*foo() {
}
}
`,
`"use strict";
class A {
*foo() {
}
}
`,
{transforms: ["jsx", "imports", "typescript"]},
);
});

it("handles async generator class methods", () => {
assertResult(
`
class C {
async *m() {
yield await 1;
}
}
`,
`"use strict";
class C {
async *m() {
yield await 1;
}
}
`,
{transforms: ["jsx", "imports", "typescript"]},
);
});

it("removes numeric separators from number literals", () => {
assertResult(
`
Expand Down

0 comments on commit 8882acd

Please sign in to comment.