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

Method printStmtNamespace

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

Source from the content-addressed store, hash-verified

2845}
2846
2847func (p *Printer) printStmtNamespace(n node.Node) {
2848 nn := n.(*stmt.Namespace)
2849 p.printFreeFloating(nn, freefloating.Start)
2850 io.WriteString(p.w, "namespace")
2851
2852 if nn.NamespaceName != nil {
2853 if nn.NamespaceName.GetFreeFloating().IsEmpty() {
2854 io.WriteString(p.w, " ")
2855 }
2856 p.Print(nn.NamespaceName)
2857 }
2858
2859 if nn.Stmts != nil {
2860 p.printFreeFloating(nn, freefloating.Namespace)
2861 io.WriteString(p.w, "{")
2862 p.printNodes(nn.Stmts)
2863 p.printFreeFloating(nn, freefloating.Stmts)
2864 io.WriteString(p.w, "}")
2865 } else {
2866 p.printFreeFloating(nn, freefloating.SemiColon)
2867 if nn.GetFreeFloating().IsEmpty() {
2868 io.WriteString(p.w, ";")
2869 }
2870 }
2871
2872 p.printFreeFloating(nn, freefloating.End)
2873}
2874
2875func (p *Printer) printStmtNop(n node.Node) {
2876 p.printFreeFloating(n, freefloating.Start)

Callers 1

printNodeMethod · 0.95

Calls 5

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

Tested by

no test coverage detected