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
Support extending classes #33
Comments
+1 |
@mohebifar , can we add transpiler dependent transforms for class inheritance? Since typescript implementation and coffeescript implementation of class inheritance differs slightly. I have created a transform for extending classes created via typescript transpiler. I could raise that PR. |
Do we want this added to the class transform or as an additional transform to be used in conjunction with the class transform? |
I think ideally it should be part of the class transform. But perhaps there are some practical considerations for not making it so. |
These two branches are 100% the same. Refs #33
Make it obvious which variable we expect to be parent class. Refs #33
Just use simple node.type comparison and make the matchers for the specific require-s more specific. Refs #33
Instead only use this.inheritsNode and let the RequireDetector return full AST that we must match against - not just identifier node. Refs #33
Instead of hard-coding invocations of the specific detectors. Refs #33
As they are no more shared between different transforms. Refs #33
@apexearth The inheritance feature has now been finally released in 2.4.0. Should have released it sooner, but thought that I'll solve the two remaining small problems. But didn't really found time to tackle them. |
Closing this old task. Created #186 to handle the two remaining issues. |
Edited by @nene:
The initial implementation has been merged in from #183, some things remain to be improved:
We're currently overly strict by not detecting inheritance in the following code:
we only detect the inheritance when the above is followed by constructor assignment:
We detect importing
util.inherits
usingrequire()
:but we'll fail with:
Call to superclass constructor must currently be directly inside the body of the constructor, the following will not work:
super()
must be called before any references tothis
. The following code will fail:super()
must always be called from subclass constructor. The following code will fail:We should also convert superclass method calls inside other methods. Converting this:
into this:
The text was updated successfully, but these errors were encountered: