MCPcopy Create free account
hub / github.com/nodejs/node / emitParameter

Function emitParameter

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

Source from the content-addressed store, hash-verified

111777 }
111778 }
111779 function emitParameter(node) {
111780 emitDecorators(node, node.decorators);
111781 emitModifiers(node, node.modifiers);
111782 emit(node.dotDotDotToken);
111783 emitNodeWithWriter(node.name, writeParameter);
111784 emit(node.questionToken);
111785 if (node.parent && node.parent.kind === 317 /* SyntaxKind.JSDocFunctionType */ && !node.name) {
111786 emit(node.type);
111787 }
111788 else {
111789 emitTypeAnnotation(node.type);
111790 }
111791 // The comment position has to fallback to any present node within the parameterdeclaration because as it turns out, the parser can make parameter declarations with _just_ an initializer.
111792 emitInitializer(node.initializer, node.type ? node.type.end : node.questionToken ? node.questionToken.end : node.name ? node.name.end : node.modifiers ? node.modifiers.end : node.decorators ? node.decorators.end : node.pos, node, parenthesizer.parenthesizeExpressionForDisallowedComma);
111793 }
111794 function emitDecorator(decorator) {
111795 writePunctuation("@");
111796 emitExpression(decorator.expression, parenthesizer.parenthesizeLeftSideOfAccess);

Callers 1

Calls 6

emitDecoratorsFunction · 0.85
emitModifiersFunction · 0.85
emitNodeWithWriterFunction · 0.85
emitTypeAnnotationFunction · 0.85
emitInitializerFunction · 0.85
emitFunction · 0.70

Tested by

no test coverage detected