Skip to content

Commit 00d8479

Browse files
committed
fixup some old docs
1 parent 736b984 commit 00d8479

File tree

3 files changed

+23
-10
lines changed

3 files changed

+23
-10
lines changed

bindings/declarations.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ type TypeParameter struct {
6565
DefaultType ExpressionType
6666
}
6767

68-
func (h *TypeParameter) isNode() {}
68+
func (p *TypeParameter) isNode() {}
6969

7070
// Simplify removes duplicate type parameters
7171
func Simplify(p []*TypeParameter) ([]*TypeParameter, error) {

bindings/string.go

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,26 @@
11
package bindings
22

3-
import "fmt"
3+
import (
4+
"fmt"
5+
"strings"
6+
)
47

58
// These string functions are purely for debugging
69

7-
func (a Alias) String() string { return fmt.Sprintf("Alias:%s", a.Name) }
8-
func (k LiteralKeyword) String() string { return string(k) }
9-
func (a ArrayType) String() string { return fmt.Sprintf("[]%s", a.Node) }
10-
func (i Interface) String() string { return fmt.Sprintf("Interface:%s", i.Name) }
11-
func (f PropertySignature) String() string { return fmt.Sprintf("PropertySignature:%s", f.Name) }
12-
func (r ReferenceType) String() string { return fmt.Sprintf("Reference:%s", r.Name) }
13-
func (r UnionType) String() string { return "Union" }
10+
func (a Alias) String() string { return fmt.Sprintf("Alias:%s", a.Name) }
11+
func (k LiteralKeyword) String() string { return string(k) }
12+
func (a ArrayLiteralType) String() string {
13+
strs := []string{}
14+
for _, e := range a.Elements {
15+
strs = append(strs, fmt.Sprintf("%s", e))
16+
}
17+
return fmt.Sprintf("{%s}", strings.Join(strs, ","))
18+
}
19+
func (a ArrayType) String() string { return fmt.Sprintf("[]%s", a.Node) }
20+
func (i Interface) String() string { return fmt.Sprintf("Interface:%s", i.Name) }
21+
func (f PropertySignature) String() string { return fmt.Sprintf("PropertySignature:%s", f.Name) }
22+
func (r ReferenceType) String() string { return fmt.Sprintf("Reference:%s", r.Name) }
23+
func (r UnionType) String() string { return "Union" }
24+
func (o OperatorNodeType) String() string { return fmt.Sprintf("Operator:%s", o.Keyword) }
25+
func (p TypeParameter) String() string { return fmt.Sprintf("TypeParameter:%s", p.Name) }
26+
func (v VariableDeclaration) String() string { return fmt.Sprintf("VariableDeclaration:%s", v.Name) }

example/simple/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func main() {
4141
)
4242

4343
// to see the AST tree
44-
//ts.ForEach(func(key string, node *convert.typescriptNode) {
44+
//ts.ForEach(func(key string, node bindings.Node) {
4545
// walk.Walk(walk.PrintingVisitor(0), node.Node)
4646
//})
4747

0 commit comments

Comments
 (0)