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

Function isNewIdentifierDefinitionLocation

test/fixtures/snapshot/typescript.js:134217–134268  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

134215 return false;
134216 }
134217 function isNewIdentifierDefinitionLocation() {
134218 if (contextToken) {
134219 var containingNodeKind = contextToken.parent.kind;
134220 var tokenKind = keywordForNode(contextToken);
134221 // Previous token may have been a keyword that was converted to an identifier.
134222 switch (tokenKind) {
134223 case 27 /* SyntaxKind.CommaToken */:
134224 return containingNodeKind === 208 /* SyntaxKind.CallExpression */ // func( a, |
134225 || containingNodeKind === 171 /* SyntaxKind.Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */
134226 || containingNodeKind === 209 /* SyntaxKind.NewExpression */ // new C(a, |
134227 || containingNodeKind === 204 /* SyntaxKind.ArrayLiteralExpression */ // [a, |
134228 || containingNodeKind === 221 /* SyntaxKind.BinaryExpression */ // const x = (a, |
134229 || containingNodeKind === 179 /* SyntaxKind.FunctionType */ // var x: (s: string, list|
134230 || containingNodeKind === 205 /* SyntaxKind.ObjectLiteralExpression */; // const obj = { x, |
134231 case 20 /* SyntaxKind.OpenParenToken */:
134232 return containingNodeKind === 208 /* SyntaxKind.CallExpression */ // func( |
134233 || containingNodeKind === 171 /* SyntaxKind.Constructor */ // constructor( |
134234 || containingNodeKind === 209 /* SyntaxKind.NewExpression */ // new C(a|
134235 || containingNodeKind === 212 /* SyntaxKind.ParenthesizedExpression */ // const x = (a|
134236 || containingNodeKind === 191 /* SyntaxKind.ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */
134237 case 22 /* SyntaxKind.OpenBracketToken */:
134238 return containingNodeKind === 204 /* SyntaxKind.ArrayLiteralExpression */ // [ |
134239 || containingNodeKind === 176 /* SyntaxKind.IndexSignature */ // [ | : string ]
134240 || containingNodeKind === 162 /* SyntaxKind.ComputedPropertyName */; // [ | /* this can become an index signature */
134241 case 141 /* SyntaxKind.ModuleKeyword */: // module |
134242 case 142 /* SyntaxKind.NamespaceKeyword */: // namespace |
134243 case 100 /* SyntaxKind.ImportKeyword */: // import |
134244 return true;
134245 case 24 /* SyntaxKind.DotToken */:
134246 return containingNodeKind === 261 /* SyntaxKind.ModuleDeclaration */; // module A.|
134247 case 18 /* SyntaxKind.OpenBraceToken */:
134248 return containingNodeKind === 257 /* SyntaxKind.ClassDeclaration */ // class A { |
134249 || containingNodeKind === 205 /* SyntaxKind.ObjectLiteralExpression */; // const obj = { |
134250 case 63 /* SyntaxKind.EqualsToken */:
134251 return containingNodeKind === 254 /* SyntaxKind.VariableDeclaration */ // const x = a|
134252 || containingNodeKind === 221 /* SyntaxKind.BinaryExpression */; // x = a|
134253 case 15 /* SyntaxKind.TemplateHead */:
134254 return containingNodeKind === 223 /* SyntaxKind.TemplateExpression */; // `aa ${|
134255 case 16 /* SyntaxKind.TemplateMiddle */:
134256 return containingNodeKind === 233 /* SyntaxKind.TemplateSpan */; // `aa ${10} dd ${|
134257 case 131 /* SyntaxKind.AsyncKeyword */:
134258 return containingNodeKind === 169 /* SyntaxKind.MethodDeclaration */ // const obj = { async c|()
134259 || containingNodeKind === 297 /* SyntaxKind.ShorthandPropertyAssignment */; // const obj = { async c|
134260 case 41 /* SyntaxKind.AsteriskToken */:
134261 return containingNodeKind === 169 /* SyntaxKind.MethodDeclaration */; // const obj = { * c|
134262 }
134263 if (isClassMemberCompletionKeyword(tokenKind)) {
134264 return true;
134265 }
134266 }
134267 return false;
134268 }
134269 function isInStringOrRegularExpressionOrTemplateLiteral(contextToken) {
134270 // To be "in" one of these literals, the position has to be:
134271 // 1. entirely within the token text.

Callers 2

getCompletionDataFunction · 0.85
getGlobalCompletionsFunction · 0.85

Calls 2

keywordForNodeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…