in src/transforms/deprecation-warnings.ts [377:463]
private visitor<T extends ts.Node>(node: T): ts.VisitResult<T> {
if (ts.isMethodDeclaration(node) && node.body != null) {
const statements = this.getStatementsForDeclaration(node);
this.warningCallsWereInjected = this.warningCallsWereInjected || statements.length > 0;
return ts.factory.updateMethodDeclaration(
node,
node.modifiers,
node.asteriskToken,
node.name,
node.questionToken,
node.typeParameters,
node.parameters,
node.type,
ts.factory.updateBlock(node.body, [
...wrapWithRethrow(
statements,
ts.factory.createPropertyAccessExpression(ts.factory.createThis(), node.name.getText(node.getSourceFile())),
),
...node.body.statements,
]),
) as any;
} else if (ts.isGetAccessorDeclaration(node) && node.body != null) {
const statements = this.getStatementsForDeclaration(node);
this.warningCallsWereInjected = this.warningCallsWereInjected || statements.length > 0;
return ts.factory.updateGetAccessorDeclaration(
node,
node.modifiers,
node.name,
node.parameters,
node.type,
ts.factory.updateBlock(node.body, [
...wrapWithRethrow(
statements,
ts.factory.createPropertyAccessExpression(
ts.factory.createCallExpression(
ts.factory.createPropertyAccessExpression(
ts.factory.createIdentifier(NAMESPACE),
GET_PROPERTY_DESCRIPTOR,
),
undefined,
[ts.factory.createThis(), ts.factory.createStringLiteral(node.name.getText(node.getSourceFile()))],
),
'get',
),
),
...node.body.statements,
]),
) as any;
} else if (ts.isSetAccessorDeclaration(node) && node.body != null) {
const statements = this.getStatementsForDeclaration(node);
this.warningCallsWereInjected = this.warningCallsWereInjected || statements.length > 0;
return ts.factory.updateSetAccessorDeclaration(
node,
node.modifiers,
node.name,
node.parameters,
ts.factory.updateBlock(node.body, [
...wrapWithRethrow(
statements,
ts.factory.createPropertyAccessExpression(
ts.factory.createCallExpression(
ts.factory.createPropertyAccessExpression(
ts.factory.createIdentifier(NAMESPACE),
GET_PROPERTY_DESCRIPTOR,
),
undefined,
[ts.factory.createThis(), ts.factory.createStringLiteral(node.name.getText(node.getSourceFile()))],
),
'set',
),
),
...node.body.statements,
]),
) as any;
} else if (ts.isConstructorDeclaration(node) && node.body != null) {
const statements = this.getStatementsForDeclaration(node);
this.warningCallsWereInjected = this.warningCallsWereInjected || statements.length > 0;
return ts.factory.updateConstructorDeclaration(
node,
node.modifiers,
node.parameters,
ts.factory.updateBlock(node.body, insertStatements(node.body, wrapWithRethrow(statements, node.parent.name!))),
) as any;
}
return this.visitEachChild(node);
}