Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not remove generator markers #463

Merged
merged 4 commits into from
Aug 26, 2019

Conversation

itsbth
Copy link
Contributor

@itsbth itsbth commented Jun 25, 2019

Fixes #462

Previously, the star ended up in rangesToRemove.
Considered simply adding it to isAccessModifier, but I don't really think it is one.

Copy link
Owner

@alangpierce alangpierce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! I guess I don't use generators much, so didn't catch this on my own code 😬.

I think I'd actually prefer to add it to isAccessModifier. Notice that async is there as well, so probably it's fair to say the method name is a misnomer at this point. I added a comment "Determine if this is any token that can go before the name in a method/field.", but probably it should just be renamed. Maybe isClassElementModifier would be a better name?

Mostly I worry about the further-down line while (isAccessModifier(tokens.tokenAtRelativeIndex(-1))) { needing to handle * as well. That's part of the logic to skip to the next method/field in a class, and ideally the * would be included in the range handled by the next iteration. I can't specifically think of a bug that would happen there, but it seems best to handle that right.

@codecov-io
Copy link

codecov-io commented Jun 26, 2019

Codecov Report

Merging #463 into master will increase coverage by 0.11%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #463      +/-   ##
==========================================
+ Coverage   81.56%   81.67%   +0.11%     
==========================================
  Files          52       52              
  Lines        5429     5429              
  Branches     1207     1207              
==========================================
+ Hits         4428     4434       +6     
+ Misses        706      702       -4     
+ Partials      295      293       -2
Impacted Files Coverage Δ
src/util/getClassInfo.ts 85.12% <ø> (ø) ⬆️
src/parser/traverser/statement.ts 82.09% <0%> (+1.06%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6ed6dff...4406c4c. Read the comment docs.

@itsbth
Copy link
Contributor Author

itsbth commented Jun 26, 2019

Moved it to isAccessModifier. Didn't rename the function, but can do that if you want that in this PR.

{transforms: ["jsx", "imports", "typescript"]},
);
});

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also add a test for?

class C {
  async *m() {
    yield await 1;
  }
}

@arv
Copy link
Contributor

arv commented Jul 25, 2019

Thanks

Copy link
Owner

@alangpierce alangpierce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, and sorry for the delay! Looks like the build didn't run, so I'll kick one off and merge assuming it passes.

@alangpierce alangpierce merged commit 8882acd into alangpierce:master Aug 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generator methods are not transpiled correctly
4 participants