Skip to content
This repository was archived by the owner on Jan 19, 2019. It is now read-only.

New: Add type arguments and parameters to AST #183

Merged
merged 1 commit into from
Mar 19, 2017

Conversation

Pajn
Copy link
Contributor

@Pajn Pajn commented Mar 17, 2017

For prettier/prettier/issues/13 this information must be preserved in the AST.
I had no idea how to create the test so I just did what seemed reasonable but please correct me if it's wrong.

@jsf-clabot
Copy link

jsf-clabot commented Mar 17, 2017

CLA assistant check
All committers have signed the CLA.

@eslintbot
Copy link

Thanks for the pull request, @Pajn! I took a look to make sure it's ready for merging and found some changes are needed:

  • Pull requests with code require an issue to be mentioned at the end of the commit summary, such as (fixes #1234). Please update the commit summary with an issue (file a new issue if one doesn't already exist).

Can you please update the pull request to address these?

(More information can be found in our pull request guide.)

@eslintbot
Copy link

LGTM

@soda0289
Copy link
Member

soda0289 commented Mar 17, 2017

I think you will want to use convertTSTypeParametersToTypeParametersDeclaration() to convert the typescript type parameters instead of convertTypeArgumentsToTypeParameters()

I'm not a 100% sure thou. @JamesHenry do you know why there are two functions it seems one is only used for class declarations?

The tests look fine to me.

@eslintbot
Copy link

LGTM

@Pajn
Copy link
Contributor Author

Pajn commented Mar 17, 2017

I understood it as convertTSTypeParametersToTypeParametersDeclaration is for declaring them (introducing them in the scope) and convertTypeArgumentsToTypeParameters is for passing them, which is what is done in CallExpressions.

I realized that primitive types did not work, which is in my second commit. I'm unsure if I should include that in this PR or not. But I guess the above confusion must be solved first to even see if I modified the correct function :)

@Pajn Pajn force-pushed the support-call-type-arguments branch from eb2905d to 54854b2 Compare March 17, 2017 14:34
@eslintbot
Copy link

LGTM

@Pajn Pajn force-pushed the support-call-type-arguments branch from 54854b2 to 58c8377 Compare March 17, 2017 14:34
@eslintbot
Copy link

LGTM

@soda0289
Copy link
Member

@Pajn you could be correct. I just saw that convertTypeArgumentsToTypeParameters() is only used for class declarations.

Reading the code I don't think the new expression const a = new A<B>(); is also not keeping the type arguments. Is this correct? Do you want to add support for this as well?

@soda0289
Copy link
Member

soda0289 commented Mar 17, 2017

I also think class declarations do not record the generic type argument, only the implement clauses do. For example:

class A<T> {

}

@eslintbot
Copy link

LGTM

@Pajn Pajn force-pushed the support-call-type-arguments branch from 47fb44f to 97f5c5f Compare March 17, 2017 14:57
@eslintbot
Copy link

LGTM

@Pajn
Copy link
Contributor Author

Pajn commented Mar 17, 2017

Good catches! Might as well get as many cases as possible fixed.

@soda0289
Copy link
Member

Nice looks good!

@eslintbot
Copy link

LGTM

@Pajn Pajn changed the title New: Add call expression type arguments to AST New: Add type arguments and parameters to AST Mar 18, 2017
@JamesHenry
Copy link
Member

JamesHenry commented Mar 18, 2017

This LGTM, thanks @Pajn! It just needs to be rebased against master. You could also squash the commits down into a single one whilst you do that.

@Pajn Pajn force-pushed the support-call-type-arguments branch from c14bd58 to cf7000a Compare March 19, 2017 11:51
@eslintbot
Copy link

LGTM

@Pajn
Copy link
Contributor Author

Pajn commented Mar 19, 2017

Done. I was unsure on New/Fix again, I can change to what you prefer.

I must say thank you to both of you for being both helpful and very responsive on these PRs!

@JamesHenry JamesHenry merged commit bfb1506 into eslint:master Mar 19, 2017
@Pajn Pajn deleted the support-call-type-arguments branch March 19, 2017 16:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants