[refactoring] dumper: fix dumping node value

This commit is contained in:
Vadym Slizov 2020-07-04 21:10:41 +03:00
parent 8417e7d6d2
commit 7a8746600b
2 changed files with 10 additions and 10 deletions

View File

@ -196,7 +196,7 @@ func (v *Dump) Identifier(n *ast.Identifier) {
v.print("&ast.Identifier{\n")
v.printIndent(v.indent)
v.print(fmt.Sprintf("Value: %q,\n", n.Value))
v.print(fmt.Sprintf("Value: []byte(%q),\n", n.Value))
v.printNode(n.GetNode())
}
@ -490,7 +490,7 @@ func (v *Dump) StmtInlineHtml(n *ast.StmtInlineHtml) {
v.print("&ast.StmtInlineHtml{\n")
v.printIndent(v.indent)
v.print(fmt.Sprintf("Value: %q,\n", n.Value))
v.print(fmt.Sprintf("Value: []byte(%q),\n", n.Value))
v.printNode(n.GetNode())
}
@ -1342,7 +1342,7 @@ func (v *Dump) ScalarDnumber(n *ast.ScalarDnumber) {
v.print("&ast.ScalarDnumber{\n")
v.printIndent(v.indent)
v.print(fmt.Sprintf("Value: %q,\n", n.Value))
v.print(fmt.Sprintf("Value: []byte(%q),\n", n.Value))
v.printNode(n.GetNode())
}
@ -1359,7 +1359,7 @@ func (v *Dump) ScalarEncapsedStringPart(n *ast.ScalarEncapsedStringPart) {
v.print("&ast.ScalarEncapsedStringPart{\n")
v.printIndent(v.indent)
v.print(fmt.Sprintf("Value: %q,\n", n.Value))
v.print(fmt.Sprintf("Value: []byte(%q),\n", n.Value))
v.printNode(n.GetNode())
}
@ -1379,7 +1379,7 @@ func (v *Dump) ScalarLnumber(n *ast.ScalarLnumber) {
v.print("&ast.ScalarLnumber{\n")
v.printIndent(v.indent)
v.print(fmt.Sprintf("Value: %q,\n", n.Value))
v.print(fmt.Sprintf("Value: []byte(%q),\n", n.Value))
v.printNode(n.GetNode())
}
@ -1389,7 +1389,7 @@ func (v *Dump) ScalarMagicConstant(n *ast.ScalarMagicConstant) {
v.print("&ast.ScalarMagicConstant{\n")
v.printIndent(v.indent)
v.print(fmt.Sprintf("Value: %q,\n", n.Value))
v.print(fmt.Sprintf("Value: []byte(%q),\n", n.Value))
v.printNode(n.GetNode())
}
@ -1399,7 +1399,7 @@ func (v *Dump) ScalarString(n *ast.ScalarString) {
v.print("&ast.ScalarString{\n")
v.printIndent(v.indent)
v.print(fmt.Sprintf("Value: %q,\n", n.Value))
v.print(fmt.Sprintf("Value: []byte(%q),\n", n.Value))
v.printNode(n.GetNode())
}
@ -1430,7 +1430,7 @@ func (v *Dump) NameNamePart(n *ast.NameNamePart) {
v.print("&ast.NameNamePart{\n")
v.printIndent(v.indent)
v.print(fmt.Sprintf("Value: %q,\n", n.Value))
v.print(fmt.Sprintf("Value: []byte(%q),\n", n.Value))
v.printNode(n.GetNode())
}

View File

@ -61,7 +61,7 @@ func ExampleDump() {
// },
// Stmts: []ast.Vertex{
// &ast.Identifier{
// Value: "",
// Value: []byte(""),
// },
// &ast.Parameter{
// Variadic: true,
@ -69,7 +69,7 @@ func ExampleDump() {
// },
// },
// &ast.StmtInlineHtml{
// Value: "foo",
// Value: []byte("foo"),
// },
// },
//}