-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Add support for parsing and emitting class expressions. #2567
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
Conversation
This type represents the expression+type arguments you can get in a class or interface heritage clause section. For class-implements clauses, or interface-extends clauses, these expressions can only be identifiers or dotted names. For class extends clauses, these could be any expressions in the future. However, for now, we only support identifiers and dotted names.
fc61772 to
b363a45
Compare
src/compiler/checker.ts
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can someone suggest a better name for this? :)
src/compiler/checker.ts
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we mention that it can be identifiers\qualified names with optional type arguments?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Add support for parsing and emitting class expressions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really do not like this name. why do we need it here? why can not we just have getTypeOfNode?
Currently class expressions are not typechecked. We'll have to figure out how we want to appropriately design things there.
Parsing and emitting of class expressions themselves was not too hard. The most difficult part was changing things to support arbitrary expressions in the 'heritage' clause sections of a class. Parsing here was not bad. However, it did mean further parts of the typechecker and services layer needed to become aware of this new shape for the AST.