Browse Source

get rid of ListNode

master
Brett Langdon 10 years ago
parent
commit
4144f5c209
2 changed files with 16 additions and 26 deletions
  1. +16
    -7
      ast/fileinput.go
  2. +0
    -19
      ast/listnode.go

+ 16
- 7
ast/fileinput.go View File

@ -1,19 +1,28 @@
package ast package ast
import "github.com/brettlangdon/gython/token"
type FileInput struct { type FileInput struct {
ListNode
BaseNode
children []interface{}
} }
func NewFileInput() *FileInput { func NewFileInput() *FileInput {
node := &FileInput{}
node.initChildren()
node := &FileInput{
children: make([]interface{}, 0),
}
node.initBaseNode(FILE_INPUT)
return node return node
} }
func (node *FileInput) ID() NodeID {
return FILE_INPUT
func (node *FileInput) AppendToken(t *token.Token) {
node.children = append(node.children, t)
}
func (node *FileInput) AppendNode(n StatementNode) {
node.children = append(node.children, n)
} }
func (node *FileInput) Name() string {
return NodeNames[FILE_INPUT]
func (node *FileInput) Children() []interface{} {
return node.children
} }

+ 0
- 19
ast/listnode.go View File

@ -1,19 +0,0 @@
package ast
import "github.com/brettlangdon/gython/token"
type ListNode struct {
children []interface{}
}
func (node *ListNode) initChildren() {
node.children = make([]interface{}, 0)
}
func (node *ListNode) AppendToken(t *token.Token) {
node.children = append(node.children, t)
}
func (node *ListNode) AppendNode(n Node) {
node.children = append(node.children, n)
}

Loading…
Cancel
Save