Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
static getContainerBodyPos(container: ContainerNodes, sourceFile: ts.SourceFile) {
if (ts.isSourceFile(container))
return 0;
if (ts.isClassDeclaration(container)
|| ts.isEnumDeclaration(container)
|| ts.isInterfaceDeclaration(container)
|| ts.isTypeLiteralNode(container)
|| ts.isClassExpression(container)
|| ts.isBlock(container)
|| ts.isModuleBlock(container)
|| ts.isObjectLiteralExpression(container))
{
// this function is only used when there are no statements or members, so only do this
return getTokenEnd(container, SyntaxKind.OpenBraceToken);
}
if (ts.isCaseClause(container) || ts.isDefaultClause(container))
return getTokenEnd(container, SyntaxKind.ColonToken);
return errors.throwNotImplementedForNeverValueError(container);
function getContainerChildren() {
if (ts.isSourceFile(container) || ts.isBlock(container) || ts.isModuleBlock(container) || ts.isCaseClause(container) || ts.isDefaultClause(container))
return container.statements;
if (ts.isClassDeclaration(container)
|| ts.isClassExpression(container)
|| ts.isEnumDeclaration(container)
|| ts.isInterfaceDeclaration(container)
|| ts.isTypeLiteralNode(container)
|| ts.isClassExpression(container))
{
return container.members;
}
if (ts.isObjectLiteralExpression(container))
return container.properties;
return errors.throwNotImplementedForNeverValueError(container);
}
function getCtor() {
if (isStatementContainerNode(container))
return CompilerCommentStatement;
if (ts.isClassLike(container))
return CompilerCommentClassElement;
if (ts.isInterfaceDeclaration(container) || ts.isTypeLiteralNode(container))
return CompilerCommentTypeElement;
if (ts.isObjectLiteralExpression(container))
return CompilerCommentObjectLiteralElement;
if (ts.isEnumDeclaration(container))
return CompilerCommentEnumMember;
throw new errors.NotImplementedError(`Not implemented comment node container type: ${getSyntaxKindName(container.kind)}`);
}
}