MCPcopy Create free account
hub / github.com/z7zmey/php-parser / printStmtFunction

Method printStmtFunction

printer/printer.go:2634–2673  ·  view source on GitHub ↗
(n node.Node)

Source from the content-addressed store, hash-verified

2632}
2633
2634func (p *Printer) printStmtFunction(n node.Node) {
2635 nn := n.(*stmt.Function)
2636 p.printFreeFloating(nn, freefloating.Start)
2637
2638 io.WriteString(p.w, "function")
2639 p.printFreeFloating(nn, freefloating.Function)
2640
2641 if nn.ReturnsRef {
2642 if nn.GetFreeFloating().IsEmpty() {
2643 io.WriteString(p.w, " ")
2644 }
2645 io.WriteString(p.w, "&")
2646 } else {
2647 if nn.FunctionName.GetFreeFloating().IsEmpty() {
2648 io.WriteString(p.w, " ")
2649 }
2650 }
2651
2652 p.Print(nn.FunctionName)
2653 p.printFreeFloating(nn, freefloating.Name)
2654
2655 io.WriteString(p.w, "(")
2656 p.joinPrint(",", nn.Params)
2657 p.printFreeFloating(nn, freefloating.ParamList)
2658 io.WriteString(p.w, ")")
2659 p.printFreeFloating(nn, freefloating.Params)
2660
2661 if nn.ReturnType != nil {
2662 io.WriteString(p.w, ":")
2663 p.Print(nn.ReturnType)
2664 }
2665 p.printFreeFloating(nn, freefloating.ReturnType)
2666
2667 io.WriteString(p.w, "{")
2668 p.printNodes(nn.Stmts)
2669 p.printFreeFloating(nn, freefloating.Stmts)
2670 io.WriteString(p.w, "}")
2671
2672 p.printFreeFloating(nn, freefloating.End)
2673}
2674
2675func (p *Printer) printStmtGlobal(n node.Node) {
2676 nn := n.(*stmt.Global)

Callers 1

printNodeMethod · 0.95

Calls 6

printFreeFloatingMethod · 0.95
PrintMethod · 0.95
joinPrintMethod · 0.95
printNodesMethod · 0.95
IsEmptyMethod · 0.80
GetFreeFloatingMethod · 0.65

Tested by

no test coverage detected