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

Function getContainerFlags

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

Source from the content-addressed store, hash-verified

46198 }
46199 }
46200 function getContainerFlags(node) {
46201 switch (node.kind) {
46202 case 226 /* SyntaxKind.ClassExpression */:
46203 case 257 /* SyntaxKind.ClassDeclaration */:
46204 case 260 /* SyntaxKind.EnumDeclaration */:
46205 case 205 /* SyntaxKind.ObjectLiteralExpression */:
46206 case 182 /* SyntaxKind.TypeLiteral */:
46207 case 322 /* SyntaxKind.JSDocTypeLiteral */:
46208 case 286 /* SyntaxKind.JsxAttributes */:
46209 return 1 /* ContainerFlags.IsContainer */;
46210 case 258 /* SyntaxKind.InterfaceDeclaration */:
46211 return 1 /* ContainerFlags.IsContainer */ | 64 /* ContainerFlags.IsInterface */;
46212 case 261 /* SyntaxKind.ModuleDeclaration */:
46213 case 259 /* SyntaxKind.TypeAliasDeclaration */:
46214 case 195 /* SyntaxKind.MappedType */:
46215 case 176 /* SyntaxKind.IndexSignature */:
46216 return 1 /* ContainerFlags.IsContainer */ | 32 /* ContainerFlags.HasLocals */;
46217 case 305 /* SyntaxKind.SourceFile */:
46218 return 1 /* ContainerFlags.IsContainer */ | 4 /* ContainerFlags.IsControlFlowContainer */ | 32 /* ContainerFlags.HasLocals */;
46219 case 172 /* SyntaxKind.GetAccessor */:
46220 case 173 /* SyntaxKind.SetAccessor */:
46221 case 169 /* SyntaxKind.MethodDeclaration */:
46222 if (ts.isObjectLiteralOrClassExpressionMethodOrAccessor(node)) {
46223 return 1 /* ContainerFlags.IsContainer */ | 4 /* ContainerFlags.IsControlFlowContainer */ | 32 /* ContainerFlags.HasLocals */ | 8 /* ContainerFlags.IsFunctionLike */ | 128 /* ContainerFlags.IsObjectLiteralOrClassExpressionMethodOrAccessor */;
46224 }
46225 // falls through
46226 case 171 /* SyntaxKind.Constructor */:
46227 case 256 /* SyntaxKind.FunctionDeclaration */:
46228 case 168 /* SyntaxKind.MethodSignature */:
46229 case 174 /* SyntaxKind.CallSignature */:
46230 case 323 /* SyntaxKind.JSDocSignature */:
46231 case 317 /* SyntaxKind.JSDocFunctionType */:
46232 case 179 /* SyntaxKind.FunctionType */:
46233 case 175 /* SyntaxKind.ConstructSignature */:
46234 case 180 /* SyntaxKind.ConstructorType */:
46235 case 170 /* SyntaxKind.ClassStaticBlockDeclaration */:
46236 return 1 /* ContainerFlags.IsContainer */ | 4 /* ContainerFlags.IsControlFlowContainer */ | 32 /* ContainerFlags.HasLocals */ | 8 /* ContainerFlags.IsFunctionLike */;
46237 case 213 /* SyntaxKind.FunctionExpression */:
46238 case 214 /* SyntaxKind.ArrowFunction */:
46239 return 1 /* ContainerFlags.IsContainer */ | 4 /* ContainerFlags.IsControlFlowContainer */ | 32 /* ContainerFlags.HasLocals */ | 8 /* ContainerFlags.IsFunctionLike */ | 16 /* ContainerFlags.IsFunctionExpression */;
46240 case 262 /* SyntaxKind.ModuleBlock */:
46241 return 4 /* ContainerFlags.IsControlFlowContainer */;
46242 case 167 /* SyntaxKind.PropertyDeclaration */:
46243 return node.initializer ? 4 /* ContainerFlags.IsControlFlowContainer */ : 0;
46244 case 292 /* SyntaxKind.CatchClause */:
46245 case 242 /* SyntaxKind.ForStatement */:
46246 case 243 /* SyntaxKind.ForInStatement */:
46247 case 244 /* SyntaxKind.ForOfStatement */:
46248 case 263 /* SyntaxKind.CaseBlock */:
46249 return 2 /* ContainerFlags.IsBlockScopedContainer */;
46250 case 235 /* SyntaxKind.Block */:
46251 // do not treat blocks directly inside a function as a block-scoped-container.
46252 // Locals that reside in this block should go to the function locals. Otherwise 'x'
46253 // would not appear to be a redeclaration of a block scoped local in the following
46254 // example:
46255 //
46256 // function foo() {
46257 // var x;

Callers 2

bindFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected