mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-24 14:14:32 -06:00
Fixed issue where last function context & parent node wasn't being preserved.
This came up when a `super()` call was nested in another constructor body. Current logic in the transform says that if the last containing non-arrow function body is non-static, and the current parent isn't a call expression, the call target of a `super` call will become `_super.prototype` instead of `super`. If the state is not saved, the containing arrow function and parent are not saved, and the information for this check won't be accurate.
This commit is contained in:
parent
d6e548b02e
commit
11bc6c470f
@ -1143,9 +1143,10 @@ namespace ts {
|
||||
firstStatement = ctor.body.statements[firstNonPrologue];
|
||||
|
||||
if (firstStatement.kind === SyntaxKind.ExpressionStatement && isSuperCallExpression((firstStatement as ExpressionStatement).expression)) {
|
||||
const superCall = (firstStatement as ExpressionStatement).expression as CallExpression;
|
||||
initializer = setOriginalNode(
|
||||
visitImmediateSuperCallInBody(((firstStatement as ExpressionStatement).expression as CallExpression)),
|
||||
(firstStatement as ExpressionStatement).expression
|
||||
saveStateAndInvoke(superCall, visitImmediateSuperCallInBody),
|
||||
superCall
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user