Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var cb = function (node) {
var savedScope = _this.scope;
var boundary = utils.isScopeBoundary(node);
if (boundary !== 0 /* None */) {
if (boundary === 1 /* Function */) {
if (node.kind === ts.SyntaxKind.ModuleDeclaration &&
utils.hasModifier(node.modifiers, ts.SyntaxKind.DeclareKeyword)) {
// don't check ambient namespaces
return;
}
_this.scope = new Scope();
if (utils.isFunctionDeclaration(node) ||
utils.isMethodDeclaration(node) ||
utils.isFunctionExpression(node) ||
utils.isArrowFunction(node) ||
utils.isConstructorDeclaration(node)) {
// special handling for function parameters
// each parameter initializer can only reassign preceding parameters of variables of the containing scope
if (node.body !== undefined) {
for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) {
var param = _a[_i];
cb(param);
_this.settle(savedScope);
}
cb(node.body);
_this.onScopeEnd(savedScope);
}
_this.scope = savedScope;
var cb = function (node) {
var savedScope = _this.scope;
var boundary = utils.isScopeBoundary(node);
if (boundary !== 0 /* None */) {
if (boundary === 1 /* Function */) {
if (node.kind === ts.SyntaxKind.ModuleDeclaration &&
utils.hasModifier(node.modifiers, ts.SyntaxKind.DeclareKeyword)) {
// don't check ambient namespaces
return;
}
_this.scope = new Scope();
if (utils.isFunctionDeclaration(node) ||
utils.isMethodDeclaration(node) ||
utils.isFunctionExpression(node) ||
utils.isArrowFunction(node) ||
utils.isConstructorDeclaration(node)) {
// special handling for function parameters
// each parameter initializer can only reassign preceding parameters of variables of the containing scope
if (node.body !== undefined) {
for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) {
var param = _a[_i];
cb(param);
_this.settle(savedScope);
}
cb(node.body);
_this.onScopeEnd(savedScope);
}
_this.scope = savedScope;
const cb = (node: ts.Node): void => {
const savedScope = this.scope;
const boundary = utils.isScopeBoundary(node);
if (boundary !== utils.ScopeBoundary.None) {
if (boundary === utils.ScopeBoundary.Function) {
if (
node.kind === ts.SyntaxKind.ModuleDeclaration &&
utils.hasModifier(node.modifiers, ts.SyntaxKind.DeclareKeyword)
) {
// don't check ambient namespaces
return;
}
this.scope = new Scope();
if (
utils.isFunctionDeclaration(node) ||
utils.isMethodDeclaration(node) ||
utils.isFunctionExpression(node) ||
utils.isArrowFunction(node) ||
utils.isConstructorDeclaration(node)
) {
// special handling for function parameters
// each parameter initializer can only reassign preceding parameters of variables of the containing scope
if (node.body !== undefined) {
for (const param of node.parameters) {
cb(param);
this.settle(savedScope);
}
cb(node.body);
this.onScopeEnd(savedScope);
}
this.scope = savedScope;
function getEquivalentNodesForDocs(node: ts.Node, docType: DocType): ts.Node[] {
const exclusions = context.options.get(docType);
if (exclusions === undefined || exclusions.overloadsSeparateDocs) {
return [node];
}
if (tsutils.isFunctionDeclaration(node) && node.name !== undefined) {
const functionName = node.name.text;
return getSiblings(node).filter(
child =>
tsutils.isFunctionDeclaration(child) &&
child.name !== undefined &&
child.name.text === functionName,
);
}
if (tsutils.isConstructorDeclaration(node)) {
const {
parent: { members },
} = node;
return members.filter(child => tsutils.isConstructorDeclaration(child));
addFailures(getMisplacedOverloads(statements, function (statement) {
return utils.isFunctionDeclaration(statement) && statement.name !== undefined ? statement.name.text : undefined;
}));
}
function cb(node: ts.Node): void {
if (tsutils.isFunctionDeclaration(node)) {
validate(node);
} else if (tsutils.isMethodDeclaration(node)) {
validate(node);
} else if (tsutils.isVariableDeclaration(node)) {
validate(node);
}
return ts.forEachChild(node, cb);
}
function cb(node) {
if (tsutils.isFunctionDeclaration(node)) {
validate(node);
}
else if (tsutils.isMethodDeclaration(node)) {
validate(node);
}
else if (tsutils.isVariableDeclaration(node)) {
validate(node);
}
return ts.forEachChild(node, cb);
}
return ts.forEachChild(ctx.sourceFile, cb);
addFailures(getMisplacedOverloads(statements, function (statement) {
return utils.isFunctionDeclaration(statement) && statement.name !== undefined
? statement.name.text
: undefined;
}));
}
function cb(node) {
if (tsutils.isVariableDeclaration(node) ||
tsutils.isFunctionDeclaration(node) ||
tsutils.isPropertyDeclaration(node) ||
tsutils.isAccessorDeclaration(node) ||
tsutils.isMethodDeclaration(node)) {
validateNode(node);
}
if (tsutils.isParameterDeclaration(node)) {
if (node.name.getText() !== 'this') {
validateNode(node);
}
}
if (tsutils.isPropertySignature(node)) {
if (allowQuotedProperties === false || !tsutils.isStringLiteral(node.name)) {
validateNode(node);
}
}
return ts.forEachChild(node, cb);
while (node.parent) {
var parent_1 = node.parent;
if (tsutils.isCallExpression(parent_1)) {
var callExpression = parent_1;
return {
callInfo: {
callExpression: callExpression,
argIndex: callExpression.arguments.indexOf(node)
}
};
}
if (tsutils.isImportEqualsDeclaration(parent_1) || tsutils.isImportDeclaration(parent_1) || tsutils.isExportDeclaration(parent_1)) {
return { ignoreUsage: true };
}
if (tsutils.isVariableDeclaration(parent_1) ||
tsutils.isFunctionDeclaration(parent_1) ||
tsutils.isPropertyDeclaration(parent_1) ||
tsutils.isMethodDeclaration(parent_1) ||
tsutils.isVariableDeclarationList(parent_1) ||
tsutils.isInterfaceDeclaration(parent_1) ||
tsutils.isClassDeclaration(parent_1) ||
tsutils.isEnumDeclaration(parent_1) ||
tsutils.isModuleDeclaration(parent_1) ||
tsutils.isTypeAliasDeclaration(parent_1) ||
tsutils.isSourceFile(parent_1)) {
return undefined;
}
node = parent_1;
}
return undefined;
}
function cb(node) {