MCPcopy Index your code
hub / github.com/TypeScriptToLua/TypeScriptToLua / printFunctionDefinition

Method printFunctionDefinition

src/LuaPrinter.ts:691–707  ·  view source on GitHub ↗
(statement: lua.FunctionDefinition)

Source from the content-addressed store, hash-verified

689 }
690
691 public printFunctionDefinition(statement: lua.FunctionDefinition): SourceNode {
692 const expression = statement.right[0];
693 const chunks: SourceChunk[] = [];
694
695 chunks.push("function ");
696 chunks.push(this.printExpression(statement.left[0]));
697 chunks.push("(");
698 chunks.push(...this.printFunctionParameters(expression));
699 chunks.push(")\n");
700
701 this.pushIndent();
702 chunks.push(this.printBlock(expression.body));
703 this.popIndent();
704 chunks.push(this.indent(this.createSourceNode(statement, "end")));
705
706 return this.createSourceNode(expression, chunks);
707 }
708
709 public printTableFieldExpression(expression: lua.TableFieldExpression): SourceNode {
710 const chunks: SourceChunk[] = [];

Calls 7

printExpressionMethod · 0.95
pushIndentMethod · 0.95
printBlockMethod · 0.95
popIndentMethod · 0.95
indentMethod · 0.95
createSourceNodeMethod · 0.95

Tested by

no test coverage detected