[decorators] Correctly insert _initialize(this) after super(). (#8970)
* [decorators] Correctly insert `_initialize(this)` after `super()`. This commit fixes to problem: 1) After `super();` statements, `_initialize(this)` was inserted without a trailing semicolon. 2) `(0, super())` causes an infinite recursion. * Fix tests * Add test
This commit is contained in:
committed by
Daniel Tschinder
parent
5d5cd8612f
commit
b706e34fc8
@@ -113,6 +113,10 @@ const bareSupersVisitor = {
|
||||
CallExpression(path, { initializeInstanceElements }) {
|
||||
if (path.get("callee").isSuper()) {
|
||||
path.insertAfter(t.cloneNode(initializeInstanceElements));
|
||||
|
||||
// Sometimes this path gets requeued (e.g. in (super(), foo)), and
|
||||
// it leads to infinite recursion.
|
||||
path.skip();
|
||||
}
|
||||
},
|
||||
Function(path) {
|
||||
|
||||
Reference in New Issue
Block a user