MCPcopy Index your code
hub / github.com/nodejs/node / shouldReportBadModifier

Function shouldReportBadModifier

test/fixtures/snapshot/typescript.js:87974–88015  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

87972 : undefined;
87973 }
87974 function shouldReportBadModifier(node) {
87975 switch (node.kind) {
87976 case 172 /* SyntaxKind.GetAccessor */:
87977 case 173 /* SyntaxKind.SetAccessor */:
87978 case 171 /* SyntaxKind.Constructor */:
87979 case 167 /* SyntaxKind.PropertyDeclaration */:
87980 case 166 /* SyntaxKind.PropertySignature */:
87981 case 169 /* SyntaxKind.MethodDeclaration */:
87982 case 168 /* SyntaxKind.MethodSignature */:
87983 case 176 /* SyntaxKind.IndexSignature */:
87984 case 261 /* SyntaxKind.ModuleDeclaration */:
87985 case 266 /* SyntaxKind.ImportDeclaration */:
87986 case 265 /* SyntaxKind.ImportEqualsDeclaration */:
87987 case 272 /* SyntaxKind.ExportDeclaration */:
87988 case 271 /* SyntaxKind.ExportAssignment */:
87989 case 213 /* SyntaxKind.FunctionExpression */:
87990 case 214 /* SyntaxKind.ArrowFunction */:
87991 case 164 /* SyntaxKind.Parameter */:
87992 case 163 /* SyntaxKind.TypeParameter */:
87993 return false;
87994 default:
87995 if (node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 305 /* SyntaxKind.SourceFile */) {
87996 return false;
87997 }
87998 switch (node.kind) {
87999 case 256 /* SyntaxKind.FunctionDeclaration */:
88000 return nodeHasAnyModifiersExcept(node, 131 /* SyntaxKind.AsyncKeyword */);
88001 case 257 /* SyntaxKind.ClassDeclaration */:
88002 case 180 /* SyntaxKind.ConstructorType */:
88003 return nodeHasAnyModifiersExcept(node, 126 /* SyntaxKind.AbstractKeyword */);
88004 case 258 /* SyntaxKind.InterfaceDeclaration */:
88005 case 237 /* SyntaxKind.VariableStatement */:
88006 case 259 /* SyntaxKind.TypeAliasDeclaration */:
88007 case 170 /* SyntaxKind.ClassStaticBlockDeclaration */:
88008 return true;
88009 case 260 /* SyntaxKind.EnumDeclaration */:
88010 return nodeHasAnyModifiersExcept(node, 85 /* SyntaxKind.ConstKeyword */);
88011 default:
88012 ts.Debug.fail();
88013 }
88014 }
88015 }
88016 function nodeHasAnyModifiersExcept(node, allowedModifier) {
88017 return node.modifiers.length > 1 || node.modifiers[0].kind !== allowedModifier;
88018 }

Callers 1

Calls 2

failMethod · 0.45

Tested by

no test coverage detected