(expression: lua.TableFieldExpression)
| 707 | } |
| 708 | |
| 709 | public printTableFieldExpression(expression: lua.TableFieldExpression): SourceNode { |
| 710 | const chunks: SourceChunk[] = []; |
| 711 | |
| 712 | const value = this.printExpression(expression.value); |
| 713 | |
| 714 | if (expression.key) { |
| 715 | if (lua.isStringLiteral(expression.key) && isValidLuaIdentifier(expression.key.value, this.options)) { |
| 716 | chunks.push(expression.key.value, " = ", value); |
| 717 | } else { |
| 718 | chunks.push("[", this.printExpression(expression.key), "] = ", value); |
| 719 | } |
| 720 | } else { |
| 721 | chunks.push(value); |
| 722 | } |
| 723 | |
| 724 | return this.createSourceNode(expression, chunks); |
| 725 | } |
| 726 | |
| 727 | public printTableExpression(expression: lua.TableExpression): SourceNode { |
| 728 | return this.createSourceNode(expression, ["{", ...this.printExpressionList(expression.fields), "}"]); |
no test coverage detected