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

Function parseNameOfParameter

test/fixtures/snapshot/typescript.js:33453–33469  ·  view source on GitHub ↗
(modifiers)

Source from the content-addressed store, hash-verified

33451 isStartOfType(/*inStartOfParameter*/ !isJSDocParameter);
33452 }
33453 function parseNameOfParameter(modifiers) {
33454 // FormalParameter [Yield,Await]:
33455 // BindingElement[?Yield,?Await]
33456 var name = parseIdentifierOrPattern(ts.Diagnostics.Private_identifiers_cannot_be_used_as_parameters);
33457 if (ts.getFullWidth(name) === 0 && !ts.some(modifiers) && ts.isModifierKind(token())) {
33458 // in cases like
33459 // 'use strict'
33460 // function foo(static)
33461 // isParameter('static') === true, because of isModifier('static')
33462 // however 'static' is not a legal identifier in a strict mode.
33463 // so result of this function will be ParameterDeclaration (flags = 0, name = missing, type = undefined, initializer = undefined)
33464 // and current token will not change => parsing of the enclosing parameter list will last till the end of time (or OOM)
33465 // to avoid this we'll advance cursor to the next token.
33466 nextToken();
33467 }
33468 return name;
33469 }
33470 function isParameterNameStart() {
33471 // Be permissive about await and yield by calling isBindingIdentifier instead of isIdentifier; disallowing
33472 // them during a speculative parse leads to many more follow-on errors than allowing the function to parse then later

Callers 1

parseParameterWorkerFunction · 0.85

Calls 4

parseIdentifierOrPatternFunction · 0.85
nextTokenFunction · 0.85
someMethod · 0.80
tokenFunction · 0.70

Tested by

no test coverage detected