(node *ast.Expression, precedence ast.OperatorPrecedence)
| 3211 | } |
| 3212 | |
| 3213 | func (p *Printer) emitExpression(node *ast.Expression, precedence ast.OperatorPrecedence) { |
| 3214 | parens := ast.GetExpressionPrecedence(ast.SkipPartiallyEmittedExpressions(node)) < precedence |
| 3215 | if parens { |
| 3216 | p.writePunctuation("(") |
| 3217 | } |
| 3218 | |
| 3219 | switch node.Kind { |
| 3220 | // Keywords |
| 3221 | case ast.KindTrueKeyword, ast.KindFalseKeyword, ast.KindNullKeyword: |
| 3222 | p.emitTokenNode(node) |
| 3223 | case ast.KindThisKeyword, ast.KindSuperKeyword, ast.KindImportKeyword: |
| 3224 | p.emitKeywordExpression(node.AsKeywordExpression()) |
| 3225 | |
| 3226 | // Literals |
| 3227 | case ast.KindNumericLiteral: |
| 3228 | p.emitNumericLiteral(node.AsNumericLiteral()) |
| 3229 | case ast.KindBigIntLiteral: |
| 3230 | p.emitBigIntLiteral(node.AsBigIntLiteral()) |
| 3231 | case ast.KindStringLiteral: |
| 3232 | p.emitStringLiteral(node.AsStringLiteral()) |
| 3233 | case ast.KindRegularExpressionLiteral: |
| 3234 | p.emitRegularExpressionLiteral(node.AsRegularExpressionLiteral()) |
| 3235 | case ast.KindNoSubstitutionTemplateLiteral: |
| 3236 | p.emitNoSubstitutionTemplateLiteral(node.AsNoSubstitutionTemplateLiteral()) |
| 3237 | |
| 3238 | // Identifiers |
| 3239 | case ast.KindIdentifier: |
| 3240 | p.emitIdentifierReference(node.AsIdentifier()) |
| 3241 | case ast.KindPrivateIdentifier: |
| 3242 | p.emitPrivateIdentifier(node.AsPrivateIdentifier()) |
| 3243 | |
| 3244 | // Expressions |
| 3245 | case ast.KindArrayLiteralExpression: |
| 3246 | p.emitArrayLiteralExpression(node.AsArrayLiteralExpression()) |
| 3247 | case ast.KindObjectLiteralExpression: |
| 3248 | p.emitObjectLiteralExpression(node.AsObjectLiteralExpression()) |
| 3249 | case ast.KindPropertyAccessExpression: |
| 3250 | p.emitPropertyAccessExpression(node.AsPropertyAccessExpression()) |
| 3251 | case ast.KindElementAccessExpression: |
| 3252 | p.emitElementAccessExpression(node.AsElementAccessExpression()) |
| 3253 | case ast.KindCallExpression: |
| 3254 | p.emitCallExpression(node.AsCallExpression()) |
| 3255 | case ast.KindNewExpression: |
| 3256 | p.emitNewExpression(node.AsNewExpression()) |
| 3257 | case ast.KindTaggedTemplateExpression: |
| 3258 | p.emitTaggedTemplateExpression(node.AsTaggedTemplateExpression()) |
| 3259 | case ast.KindTypeAssertionExpression: |
| 3260 | p.emitTypeAssertionExpression(node.AsTypeAssertion()) |
| 3261 | case ast.KindParenthesizedExpression: |
| 3262 | p.emitParenthesizedExpression(node.AsParenthesizedExpression()) |
| 3263 | case ast.KindFunctionExpression: |
| 3264 | p.emitFunctionExpression(node.AsFunctionExpression()) |
| 3265 | case ast.KindArrowFunction: |
| 3266 | p.emitArrowFunction(node.AsArrowFunction()) |
| 3267 | case ast.KindDeleteExpression: |
| 3268 | p.emitDeleteExpression(node.AsDeleteExpression()) |
| 3269 | case ast.KindTypeOfExpression: |
| 3270 | p.emitTypeOfExpression(node.AsTypeOfExpression()) |
no test coverage detected