( node: ExpressionNode, context: CodegenContext, )
| 783 | } |
| 784 | |
| 785 | function genExpressionAsPropertyKey( |
| 786 | node: ExpressionNode, |
| 787 | context: CodegenContext, |
| 788 | ) { |
| 789 | const { push } = context |
| 790 | if (node.type === NodeTypes.COMPOUND_EXPRESSION) { |
| 791 | push(`[`) |
| 792 | genCompoundExpression(node, context) |
| 793 | push(`]`) |
| 794 | } else if (node.isStatic) { |
| 795 | class="cm">// only quote keys if necessary |
| 796 | const text = isSimpleIdentifier(node.content) |
| 797 | ? node.content |
| 798 | : JSON.stringify(node.content) |
| 799 | push(text, NewlineType.None, node) |
| 800 | } else { |
| 801 | push(`[${node.content}]`, NewlineType.Unknown, node) |
| 802 | } |
| 803 | } |
| 804 | |
| 805 | function genComment(node: CommentNode, context: CodegenContext) { |
| 806 | const { push, helper, pure } = context |
no test coverage detected