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

Function emitPropertyAccessExpression

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

Source from the content-addressed store, hash-verified

112165 }
112166 }
112167 function emitPropertyAccessExpression(node) {
112168 emitExpression(node.expression, parenthesizer.parenthesizeLeftSideOfAccess);
112169 var token = node.questionDotToken || ts.setTextRangePosEnd(ts.factory.createToken(24 /* SyntaxKind.DotToken */), node.expression.end, node.name.pos);
112170 var linesBeforeDot = getLinesBetweenNodes(node, node.expression, token);
112171 var linesAfterDot = getLinesBetweenNodes(node, token, node.name);
112172 writeLinesAndIndent(linesBeforeDot, /*writeSpaceIfNotIndenting*/ false);
112173 var shouldEmitDotDot = token.kind !== 28 /* SyntaxKind.QuestionDotToken */ &&
112174 mayNeedDotDotForPropertyAccess(node.expression) &&
112175 !writer.hasTrailingComment() &&
112176 !writer.hasTrailingWhitespace();
112177 if (shouldEmitDotDot) {
112178 writePunctuation(".");
112179 }
112180 if (node.questionDotToken) {
112181 emit(token);
112182 }
112183 else {
112184 emitTokenWithComment(token.kind, node.expression.end, writePunctuation, node);
112185 }
112186 writeLinesAndIndent(linesAfterDot, /*writeSpaceIfNotIndenting*/ false);
112187 emit(node.name);
112188 decreaseIndentIf(linesBeforeDot, linesAfterDot);
112189 }
112190 // 1..toString is a valid property access, emit a dot after the literal
112191 // Also emit a dot if expression is a integer const enum value - it will appear in generated code as numeric literal
112192 function mayNeedDotDotForPropertyAccess(expression) {

Callers 1

Calls 8

emitExpressionFunction · 0.85
getLinesBetweenNodesFunction · 0.85
writeLinesAndIndentFunction · 0.85
writePunctuationFunction · 0.85
emitTokenWithCommentFunction · 0.85
decreaseIndentIfFunction · 0.85
emitFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…