File tree Expand file tree Collapse file tree 1 file changed +4
-16
lines changed Expand file tree Collapse file tree 1 file changed +4
-16
lines changed Original file line number Diff line number Diff line change 77 "errors"
88 "fmt"
99 "io"
10- "log"
1110
1211 "github.com/haya14busa/go-vimlparser/ast"
1312)
@@ -42,19 +41,6 @@ func (p *printer) init(cfg *Config) {
4241 p .Config = * cfg
4342}
4443
45- func (p * printer ) print (args ... interface {}) {
46- for _ , arg := range args {
47- switch arg := arg .(type ) {
48- case * ast.BasicLit :
49- p .writeString (arg .Value )
50- case * ast.Ident :
51- p .writeString (arg .Name )
52- default :
53- log .Fatal (fmt .Errorf ("print: unsupported type %T" , arg ))
54- }
55- }
56- }
57-
5844func (p * printer ) writeString (s string ) {
5945 p .output = append (p .output , s ... )
6046}
@@ -90,8 +76,10 @@ func (p *printer) expr(expr ast.Expr) error {
9076 // case *ast.CurlyName:
9177 // case *ast.CurlyNameLit:
9278 // case *ast.CurlyNameExpr:
93- case * ast.BasicLit , * ast.Ident :
94- p .print (n )
79+ case * ast.BasicLit :
80+ p .writeString (n .Value )
81+ case * ast.Ident :
82+ p .writeString (n .Name )
9583 // case *ast.LambdaExpr:
9684 // case *ast.ParenExpr:
9785 default :
You can’t perform that action at this time.
0 commit comments