add attributes fiald to all nodes
This commit is contained in:
@@ -5,13 +5,15 @@ import (
|
||||
)
|
||||
|
||||
type AltElse struct {
|
||||
name string
|
||||
stmt node.Node
|
||||
name string
|
||||
attributes map[string]interface{}
|
||||
stmt node.Node
|
||||
}
|
||||
|
||||
func NewAltElse(stmt node.Node) node.Node {
|
||||
return AltElse{
|
||||
"AltElse",
|
||||
map[string]interface{}{},
|
||||
stmt,
|
||||
}
|
||||
}
|
||||
@@ -21,7 +23,7 @@ func (n AltElse) Name() string {
|
||||
}
|
||||
|
||||
func (n AltElse) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
return n.attributes
|
||||
}
|
||||
|
||||
func (n AltElse) Walk(v node.Visitor) {
|
||||
|
||||
@@ -5,14 +5,16 @@ import (
|
||||
)
|
||||
|
||||
type AltElseIf struct {
|
||||
name string
|
||||
cond node.Node
|
||||
stmt node.Node
|
||||
name string
|
||||
attributes map[string]interface{}
|
||||
cond node.Node
|
||||
stmt node.Node
|
||||
}
|
||||
|
||||
func NewAltElseIf(cond node.Node, stmt node.Node) node.Node {
|
||||
return AltElseIf{
|
||||
"AltElseIf",
|
||||
map[string]interface{}{},
|
||||
cond,
|
||||
stmt,
|
||||
}
|
||||
@@ -23,7 +25,7 @@ func (n AltElseIf) Name() string {
|
||||
}
|
||||
|
||||
func (n AltElseIf) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
return n.attributes
|
||||
}
|
||||
|
||||
func (n AltElseIf) Walk(v node.Visitor) {
|
||||
|
||||
@@ -5,16 +5,18 @@ import (
|
||||
)
|
||||
|
||||
type AltIf struct {
|
||||
name string
|
||||
cond node.Node
|
||||
stmt node.Node
|
||||
elseIf []node.Node
|
||||
_else node.Node
|
||||
name string
|
||||
attributes map[string]interface{}
|
||||
cond node.Node
|
||||
stmt node.Node
|
||||
elseIf []node.Node
|
||||
_else node.Node
|
||||
}
|
||||
|
||||
func NewAltIf(cond node.Node, stmt node.Node) node.Node {
|
||||
return AltIf{
|
||||
"AltIf",
|
||||
map[string]interface{}{},
|
||||
cond,
|
||||
stmt,
|
||||
nil,
|
||||
@@ -27,7 +29,7 @@ func (n AltIf) Name() string {
|
||||
}
|
||||
|
||||
func (n AltIf) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
return n.attributes
|
||||
}
|
||||
|
||||
func (n AltIf) AddElseIf(elseIf node.Node) node.Node {
|
||||
|
||||
@@ -5,13 +5,15 @@ import (
|
||||
)
|
||||
|
||||
type Break struct {
|
||||
name string
|
||||
expr node.Node
|
||||
name string
|
||||
attributes map[string]interface{}
|
||||
expr node.Node
|
||||
}
|
||||
|
||||
func NewBreak(expr node.Node) node.Node {
|
||||
return Break{
|
||||
"Break",
|
||||
map[string]interface{}{},
|
||||
expr,
|
||||
}
|
||||
}
|
||||
@@ -21,7 +23,7 @@ func (n Break) Name() string {
|
||||
}
|
||||
|
||||
func (n Break) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
return n.attributes
|
||||
}
|
||||
|
||||
func (n Break) Walk(v node.Visitor) {
|
||||
|
||||
@@ -5,14 +5,16 @@ import (
|
||||
)
|
||||
|
||||
type Case struct {
|
||||
name string
|
||||
cond node.Node
|
||||
stmts []node.Node
|
||||
name string
|
||||
attributes map[string]interface{}
|
||||
cond node.Node
|
||||
stmts []node.Node
|
||||
}
|
||||
|
||||
func NewCase(cond node.Node, stmts []node.Node) node.Node {
|
||||
return Case{
|
||||
"Case",
|
||||
map[string]interface{}{},
|
||||
cond,
|
||||
stmts,
|
||||
}
|
||||
@@ -23,7 +25,7 @@ func (n Case) Name() string {
|
||||
}
|
||||
|
||||
func (n Case) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
return n.attributes
|
||||
}
|
||||
|
||||
func (n Case) Walk(v node.Visitor) {
|
||||
|
||||
@@ -5,15 +5,17 @@ import (
|
||||
)
|
||||
|
||||
type Catch struct {
|
||||
name string
|
||||
types []node.Node
|
||||
variable node.Node
|
||||
stmts []node.Node
|
||||
name string
|
||||
attributes map[string]interface{}
|
||||
types []node.Node
|
||||
variable node.Node
|
||||
stmts []node.Node
|
||||
}
|
||||
|
||||
func NewCatch(types []node.Node, variable node.Node, stmts []node.Node) node.Node {
|
||||
return Catch{
|
||||
"Catch",
|
||||
map[string]interface{}{},
|
||||
types,
|
||||
variable,
|
||||
stmts,
|
||||
@@ -25,7 +27,7 @@ func (n Catch) Name() string {
|
||||
}
|
||||
|
||||
func (n Catch) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
return n.attributes
|
||||
}
|
||||
|
||||
func (n Catch) Walk(v node.Visitor) {
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
|
||||
type Class struct {
|
||||
name string
|
||||
attributes map[string]interface{}
|
||||
className node.Node
|
||||
modifiers []node.Node
|
||||
args []node.Node
|
||||
@@ -17,6 +18,7 @@ type Class struct {
|
||||
func NewClass(className node.Node, modifiers []node.Node, args []node.Node, extends node.Node, implements []node.Node, stmts []node.Node) node.Node {
|
||||
return Class{
|
||||
"Class",
|
||||
map[string]interface{}{},
|
||||
className,
|
||||
modifiers,
|
||||
args,
|
||||
@@ -31,7 +33,7 @@ func (n Class) Name() string {
|
||||
}
|
||||
|
||||
func (n Class) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
return n.attributes
|
||||
}
|
||||
|
||||
func (n Class) Walk(v node.Visitor) {
|
||||
|
||||
@@ -5,14 +5,16 @@ import (
|
||||
)
|
||||
|
||||
type ClassConstList struct {
|
||||
name string
|
||||
modifiers []node.Node
|
||||
consts []node.Node
|
||||
name string
|
||||
attributes map[string]interface{}
|
||||
modifiers []node.Node
|
||||
consts []node.Node
|
||||
}
|
||||
|
||||
func NewClassConstList(modifiers []node.Node, consts []node.Node) node.Node {
|
||||
return ClassConstList{
|
||||
"ClassConstList",
|
||||
map[string]interface{}{},
|
||||
modifiers,
|
||||
consts,
|
||||
}
|
||||
@@ -23,7 +25,7 @@ func (n ClassConstList) Name() string {
|
||||
}
|
||||
|
||||
func (n ClassConstList) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
return n.attributes
|
||||
}
|
||||
|
||||
func (n ClassConstList) Walk(v node.Visitor) {
|
||||
|
||||
@@ -33,7 +33,7 @@ func (n ClassMethod) Name() string {
|
||||
}
|
||||
|
||||
func (n ClassMethod) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
return n.attributes
|
||||
}
|
||||
|
||||
func (n ClassMethod) Walk(v node.Visitor) {
|
||||
|
||||
@@ -5,13 +5,15 @@ import (
|
||||
)
|
||||
|
||||
type ConstList struct {
|
||||
name string
|
||||
consts []node.Node
|
||||
name string
|
||||
attributes map[string]interface{}
|
||||
consts []node.Node
|
||||
}
|
||||
|
||||
func NewConstList(consts []node.Node) node.Node {
|
||||
return ConstList{
|
||||
"ConstList",
|
||||
map[string]interface{}{},
|
||||
consts,
|
||||
}
|
||||
}
|
||||
@@ -21,7 +23,7 @@ func (n ConstList) Name() string {
|
||||
}
|
||||
|
||||
func (n ConstList) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
return n.attributes
|
||||
}
|
||||
|
||||
func (n ConstList) Walk(v node.Visitor) {
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
|
||||
type Constant struct {
|
||||
name string
|
||||
attributes map[string]interface{}
|
||||
constantName node.Node
|
||||
expr node.Node
|
||||
}
|
||||
@@ -13,6 +14,7 @@ type Constant struct {
|
||||
func NewConstant(constantName node.Node, expr node.Node) node.Node {
|
||||
return Constant{
|
||||
"Constant",
|
||||
map[string]interface{}{},
|
||||
constantName,
|
||||
expr,
|
||||
}
|
||||
@@ -23,7 +25,7 @@ func (n Constant) Name() string {
|
||||
}
|
||||
|
||||
func (n Constant) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
return n.attributes
|
||||
}
|
||||
|
||||
func (n Constant) Walk(v node.Visitor) {
|
||||
|
||||
@@ -5,13 +5,15 @@ import (
|
||||
)
|
||||
|
||||
type Continue struct {
|
||||
name string
|
||||
expr node.Node
|
||||
name string
|
||||
attributes map[string]interface{}
|
||||
expr node.Node
|
||||
}
|
||||
|
||||
func NewContinue(expr node.Node) node.Node {
|
||||
return Continue{
|
||||
"Continue",
|
||||
map[string]interface{}{},
|
||||
expr,
|
||||
}
|
||||
}
|
||||
@@ -21,7 +23,7 @@ func (n Continue) Name() string {
|
||||
}
|
||||
|
||||
func (n Continue) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
return n.attributes
|
||||
}
|
||||
|
||||
func (n Continue) Walk(v node.Visitor) {
|
||||
|
||||
@@ -5,14 +5,16 @@ import (
|
||||
)
|
||||
|
||||
type Declare struct {
|
||||
name string
|
||||
consts []node.Node
|
||||
stmt node.Node
|
||||
name string
|
||||
attributes map[string]interface{}
|
||||
consts []node.Node
|
||||
stmt node.Node
|
||||
}
|
||||
|
||||
func NewDeclare(consts []node.Node, stmt node.Node) node.Node {
|
||||
return Declare{
|
||||
"Declare",
|
||||
map[string]interface{}{},
|
||||
consts,
|
||||
stmt,
|
||||
}
|
||||
@@ -23,7 +25,7 @@ func (n Declare) Name() string {
|
||||
}
|
||||
|
||||
func (n Declare) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
return n.attributes
|
||||
}
|
||||
|
||||
func (n Declare) Walk(v node.Visitor) {
|
||||
|
||||
@@ -5,13 +5,15 @@ import (
|
||||
)
|
||||
|
||||
type Default struct {
|
||||
name string
|
||||
stmts []node.Node
|
||||
name string
|
||||
attributes map[string]interface{}
|
||||
stmts []node.Node
|
||||
}
|
||||
|
||||
func NewDefault(stmts []node.Node) node.Node {
|
||||
return Default{
|
||||
"Default",
|
||||
map[string]interface{}{},
|
||||
stmts,
|
||||
}
|
||||
}
|
||||
@@ -21,7 +23,7 @@ func (n Default) Name() string {
|
||||
}
|
||||
|
||||
func (n Default) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
return n.attributes
|
||||
}
|
||||
|
||||
func (n Default) Walk(v node.Visitor) {
|
||||
|
||||
@@ -5,14 +5,16 @@ import (
|
||||
)
|
||||
|
||||
type Do struct {
|
||||
name string
|
||||
stmt node.Node
|
||||
cond node.Node
|
||||
name string
|
||||
attributes map[string]interface{}
|
||||
stmt node.Node
|
||||
cond node.Node
|
||||
}
|
||||
|
||||
func NewDo(stmt node.Node, cond node.Node) node.Node {
|
||||
return Do{
|
||||
"Do",
|
||||
map[string]interface{}{},
|
||||
stmt,
|
||||
cond,
|
||||
}
|
||||
@@ -23,7 +25,7 @@ func (n Do) Name() string {
|
||||
}
|
||||
|
||||
func (n Do) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
return n.attributes
|
||||
}
|
||||
|
||||
func (n Do) Walk(v node.Visitor) {
|
||||
|
||||
@@ -5,13 +5,15 @@ import (
|
||||
)
|
||||
|
||||
type Echo struct {
|
||||
name string
|
||||
exprs []node.Node
|
||||
name string
|
||||
attributes map[string]interface{}
|
||||
exprs []node.Node
|
||||
}
|
||||
|
||||
func NewEcho(exprs []node.Node) node.Node {
|
||||
return Echo{
|
||||
"Echo",
|
||||
map[string]interface{}{},
|
||||
exprs,
|
||||
}
|
||||
}
|
||||
@@ -21,7 +23,7 @@ func (n Echo) Name() string {
|
||||
}
|
||||
|
||||
func (n Echo) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
return n.attributes
|
||||
}
|
||||
|
||||
func (n Echo) Walk(v node.Visitor) {
|
||||
|
||||
@@ -5,13 +5,15 @@ import (
|
||||
)
|
||||
|
||||
type Else struct {
|
||||
name string
|
||||
stmt node.Node
|
||||
name string
|
||||
attributes map[string]interface{}
|
||||
stmt node.Node
|
||||
}
|
||||
|
||||
func NewElse(stmt node.Node) node.Node {
|
||||
return Else{
|
||||
"Else",
|
||||
map[string]interface{}{},
|
||||
stmt,
|
||||
}
|
||||
}
|
||||
@@ -21,7 +23,7 @@ func (n Else) Name() string {
|
||||
}
|
||||
|
||||
func (n Else) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
return n.attributes
|
||||
}
|
||||
|
||||
func (n Else) Walk(v node.Visitor) {
|
||||
|
||||
@@ -5,14 +5,16 @@ import (
|
||||
)
|
||||
|
||||
type ElseIf struct {
|
||||
name string
|
||||
cond node.Node
|
||||
stmt node.Node
|
||||
name string
|
||||
attributes map[string]interface{}
|
||||
cond node.Node
|
||||
stmt node.Node
|
||||
}
|
||||
|
||||
func NewElseIf(cond node.Node, stmt node.Node) node.Node {
|
||||
return ElseIf{
|
||||
"ElseIf",
|
||||
map[string]interface{}{},
|
||||
cond,
|
||||
stmt,
|
||||
}
|
||||
@@ -23,7 +25,7 @@ func (n ElseIf) Name() string {
|
||||
}
|
||||
|
||||
func (n ElseIf) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
return n.attributes
|
||||
}
|
||||
|
||||
func (n ElseIf) Walk(v node.Visitor) {
|
||||
|
||||
@@ -5,13 +5,15 @@ import (
|
||||
)
|
||||
|
||||
type Expression struct {
|
||||
name string
|
||||
expr node.Node
|
||||
name string
|
||||
attributes map[string]interface{}
|
||||
expr node.Node
|
||||
}
|
||||
|
||||
func NewExpression(expr node.Node) node.Node {
|
||||
return Expression{
|
||||
"Expression",
|
||||
map[string]interface{}{},
|
||||
expr,
|
||||
}
|
||||
}
|
||||
@@ -21,7 +23,7 @@ func (n Expression) Name() string {
|
||||
}
|
||||
|
||||
func (n Expression) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
return n.attributes
|
||||
}
|
||||
|
||||
func (n Expression) Walk(v node.Visitor) {
|
||||
|
||||
@@ -5,13 +5,15 @@ import (
|
||||
)
|
||||
|
||||
type Finally struct {
|
||||
name string
|
||||
stmts []node.Node
|
||||
name string
|
||||
attributes map[string]interface{}
|
||||
stmts []node.Node
|
||||
}
|
||||
|
||||
func NewFinally(stmts []node.Node) node.Node {
|
||||
return Finally{
|
||||
"Finally",
|
||||
map[string]interface{}{},
|
||||
stmts,
|
||||
}
|
||||
}
|
||||
@@ -21,7 +23,7 @@ func (n Finally) Name() string {
|
||||
}
|
||||
|
||||
func (n Finally) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
return n.attributes
|
||||
}
|
||||
|
||||
func (n Finally) Walk(v node.Visitor) {
|
||||
|
||||
@@ -5,16 +5,18 @@ import (
|
||||
)
|
||||
|
||||
type For struct {
|
||||
name string
|
||||
init []node.Node
|
||||
cond []node.Node
|
||||
loop []node.Node
|
||||
stmt node.Node
|
||||
name string
|
||||
attributes map[string]interface{}
|
||||
init []node.Node
|
||||
cond []node.Node
|
||||
loop []node.Node
|
||||
stmt node.Node
|
||||
}
|
||||
|
||||
func NewFor(init []node.Node, cond []node.Node, loop []node.Node, stmt node.Node) node.Node {
|
||||
return For{
|
||||
"For",
|
||||
map[string]interface{}{},
|
||||
init,
|
||||
cond,
|
||||
loop,
|
||||
@@ -27,7 +29,7 @@ func (n For) Name() string {
|
||||
}
|
||||
|
||||
func (n For) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
return n.attributes
|
||||
}
|
||||
|
||||
func (n For) Walk(v node.Visitor) {
|
||||
|
||||
@@ -5,13 +5,15 @@ import (
|
||||
)
|
||||
|
||||
type Global struct {
|
||||
name string
|
||||
vars []node.Node
|
||||
name string
|
||||
attributes map[string]interface{}
|
||||
vars []node.Node
|
||||
}
|
||||
|
||||
func NewGlobal(vars []node.Node) node.Node {
|
||||
return Global{
|
||||
"Global",
|
||||
map[string]interface{}{},
|
||||
vars,
|
||||
}
|
||||
}
|
||||
@@ -21,7 +23,7 @@ func (n Global) Name() string {
|
||||
}
|
||||
|
||||
func (n Global) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
return n.attributes
|
||||
}
|
||||
|
||||
func (n Global) Walk(v node.Visitor) {
|
||||
|
||||
@@ -5,13 +5,15 @@ import (
|
||||
)
|
||||
|
||||
type Goto struct {
|
||||
name string
|
||||
label node.Node
|
||||
name string
|
||||
attributes map[string]interface{}
|
||||
label node.Node
|
||||
}
|
||||
|
||||
func NewGoto(label node.Node) node.Node {
|
||||
return Goto{
|
||||
"Goto",
|
||||
map[string]interface{}{},
|
||||
label,
|
||||
}
|
||||
}
|
||||
@@ -21,7 +23,7 @@ func (n Goto) Name() string {
|
||||
}
|
||||
|
||||
func (n Goto) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
return n.attributes
|
||||
}
|
||||
|
||||
func (n Goto) Walk(v node.Visitor) {
|
||||
|
||||
@@ -5,15 +5,17 @@ import (
|
||||
)
|
||||
|
||||
type GroupUse struct {
|
||||
name string
|
||||
useType node.Node
|
||||
prefix node.Node
|
||||
useList []node.Node
|
||||
name string
|
||||
attributes map[string]interface{}
|
||||
useType node.Node
|
||||
prefix node.Node
|
||||
useList []node.Node
|
||||
}
|
||||
|
||||
func NewGroupUse(useType node.Node, prefix node.Node, useList []node.Node) node.Node {
|
||||
return GroupUse{
|
||||
"GroupUse",
|
||||
map[string]interface{}{},
|
||||
useType,
|
||||
prefix,
|
||||
useList,
|
||||
@@ -25,7 +27,7 @@ func (n GroupUse) Name() string {
|
||||
}
|
||||
|
||||
func (n GroupUse) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
return n.attributes
|
||||
}
|
||||
|
||||
func (n GroupUse) SetUseType(useType node.Node) node.Node {
|
||||
|
||||
@@ -5,12 +5,14 @@ import (
|
||||
)
|
||||
|
||||
type HaltCompiler struct {
|
||||
name string
|
||||
name string
|
||||
attributes map[string]interface{}
|
||||
}
|
||||
|
||||
func NewHaltCompiler() node.Node {
|
||||
return HaltCompiler{
|
||||
"HaltCompiler",
|
||||
map[string]interface{}{},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +21,7 @@ func (n HaltCompiler) Name() string {
|
||||
}
|
||||
|
||||
func (n HaltCompiler) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
return n.attributes
|
||||
}
|
||||
|
||||
func (n HaltCompiler) Walk(v node.Visitor) {
|
||||
|
||||
@@ -5,16 +5,18 @@ import (
|
||||
)
|
||||
|
||||
type If struct {
|
||||
name string
|
||||
cond node.Node
|
||||
stmt node.Node
|
||||
elseIf []node.Node
|
||||
_else node.Node
|
||||
name string
|
||||
attributes map[string]interface{}
|
||||
cond node.Node
|
||||
stmt node.Node
|
||||
elseIf []node.Node
|
||||
_else node.Node
|
||||
}
|
||||
|
||||
func NewIf(cond node.Node, stmt node.Node) node.Node {
|
||||
return If{
|
||||
"If",
|
||||
map[string]interface{}{},
|
||||
cond,
|
||||
stmt,
|
||||
nil,
|
||||
@@ -27,7 +29,7 @@ func (n If) Name() string {
|
||||
}
|
||||
|
||||
func (n If) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
return n.attributes
|
||||
}
|
||||
|
||||
func (n If) AddElseIf(elseIf node.Node) node.Node {
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
|
||||
type Interface struct {
|
||||
name string
|
||||
attributes map[string]interface{}
|
||||
interfaceName node.Node
|
||||
extends []node.Node
|
||||
stmts []node.Node
|
||||
@@ -14,6 +15,7 @@ type Interface struct {
|
||||
func NewInterface(interfaceName node.Node, extends []node.Node, stmts []node.Node) node.Node {
|
||||
return Interface{
|
||||
"Interface",
|
||||
map[string]interface{}{},
|
||||
interfaceName,
|
||||
extends,
|
||||
stmts,
|
||||
@@ -25,7 +27,7 @@ func (n Interface) Name() string {
|
||||
}
|
||||
|
||||
func (n Interface) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
return n.attributes
|
||||
}
|
||||
|
||||
func (n Interface) Walk(v node.Visitor) {
|
||||
|
||||
@@ -5,13 +5,15 @@ import (
|
||||
)
|
||||
|
||||
type Label struct {
|
||||
name string
|
||||
labelName node.Node
|
||||
name string
|
||||
attributes map[string]interface{}
|
||||
labelName node.Node
|
||||
}
|
||||
|
||||
func NewLabel(labelName node.Node) node.Node {
|
||||
return Label{
|
||||
"Label",
|
||||
map[string]interface{}{},
|
||||
labelName,
|
||||
}
|
||||
}
|
||||
@@ -21,7 +23,7 @@ func (n Label) Name() string {
|
||||
}
|
||||
|
||||
func (n Label) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
return n.attributes
|
||||
}
|
||||
|
||||
func (n Label) Walk(v node.Visitor) {
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
|
||||
type Namespace struct {
|
||||
name string
|
||||
attributes map[string]interface{}
|
||||
namespaceName node.Node
|
||||
stmts []node.Node
|
||||
}
|
||||
@@ -13,6 +14,7 @@ type Namespace struct {
|
||||
func NewNamespace(namespaceName node.Node, stmts []node.Node) node.Node {
|
||||
return Namespace{
|
||||
"Namespace",
|
||||
map[string]interface{}{},
|
||||
namespaceName,
|
||||
stmts,
|
||||
}
|
||||
@@ -23,7 +25,7 @@ func (n Namespace) Name() string {
|
||||
}
|
||||
|
||||
func (n Namespace) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
return n.attributes
|
||||
}
|
||||
|
||||
func (n Namespace) Walk(v node.Visitor) {
|
||||
|
||||
@@ -5,12 +5,14 @@ import (
|
||||
)
|
||||
|
||||
type Nop struct {
|
||||
name string
|
||||
name string
|
||||
attributes map[string]interface{}
|
||||
}
|
||||
|
||||
func NewNop() node.Node {
|
||||
return Nop{
|
||||
"Nop",
|
||||
map[string]interface{}{},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +21,7 @@ func (n Nop) Name() string {
|
||||
}
|
||||
|
||||
func (n Nop) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
return n.attributes
|
||||
}
|
||||
|
||||
func (n Nop) Walk(v node.Visitor) {
|
||||
|
||||
@@ -5,14 +5,16 @@ import (
|
||||
)
|
||||
|
||||
type Property struct {
|
||||
name string
|
||||
variable node.Node
|
||||
expr node.Node
|
||||
name string
|
||||
attributes map[string]interface{}
|
||||
variable node.Node
|
||||
expr node.Node
|
||||
}
|
||||
|
||||
func NewProperty(variable node.Node, expr node.Node) node.Node {
|
||||
return Property{
|
||||
"Property",
|
||||
map[string]interface{}{},
|
||||
variable,
|
||||
expr,
|
||||
}
|
||||
@@ -22,7 +24,7 @@ func (n Property) Name() string {
|
||||
}
|
||||
|
||||
func (n Property) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
return n.attributes
|
||||
}
|
||||
|
||||
func (n Property) Walk(v node.Visitor) {
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
|
||||
type PropertyList struct {
|
||||
name string
|
||||
attributes map[string]interface{}
|
||||
modifiers []node.Node
|
||||
properties []node.Node
|
||||
}
|
||||
@@ -13,6 +14,7 @@ type PropertyList struct {
|
||||
func NewPropertyList(modifiers []node.Node, properties []node.Node) node.Node {
|
||||
return PropertyList{
|
||||
"PropertyList",
|
||||
map[string]interface{}{},
|
||||
modifiers,
|
||||
properties,
|
||||
}
|
||||
@@ -23,7 +25,7 @@ func (n PropertyList) Name() string {
|
||||
}
|
||||
|
||||
func (n PropertyList) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
return n.attributes
|
||||
}
|
||||
|
||||
func (n PropertyList) Walk(v node.Visitor) {
|
||||
|
||||
@@ -5,13 +5,15 @@ import (
|
||||
)
|
||||
|
||||
type Return struct {
|
||||
name string
|
||||
expr node.Node
|
||||
name string
|
||||
attributes map[string]interface{}
|
||||
expr node.Node
|
||||
}
|
||||
|
||||
func NewReturn(expr node.Node) node.Node {
|
||||
return Return{
|
||||
"Return",
|
||||
map[string]interface{}{},
|
||||
expr,
|
||||
}
|
||||
}
|
||||
@@ -21,7 +23,7 @@ func (n Return) Name() string {
|
||||
}
|
||||
|
||||
func (n Return) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
return n.attributes
|
||||
}
|
||||
|
||||
func (n Return) Walk(v node.Visitor) {
|
||||
|
||||
@@ -5,13 +5,15 @@ import (
|
||||
)
|
||||
|
||||
type Static struct {
|
||||
name string
|
||||
vars []node.Node
|
||||
name string
|
||||
attributes map[string]interface{}
|
||||
vars []node.Node
|
||||
}
|
||||
|
||||
func NewStatic(vars []node.Node) node.Node {
|
||||
return Static{
|
||||
"Static",
|
||||
map[string]interface{}{},
|
||||
vars,
|
||||
}
|
||||
}
|
||||
@@ -21,7 +23,7 @@ func (n Static) Name() string {
|
||||
}
|
||||
|
||||
func (n Static) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
return n.attributes
|
||||
}
|
||||
|
||||
func (n Static) Walk(v node.Visitor) {
|
||||
|
||||
@@ -5,14 +5,16 @@ import (
|
||||
)
|
||||
|
||||
type StaticVar struct {
|
||||
name string
|
||||
variable node.Node
|
||||
expr node.Node
|
||||
name string
|
||||
attributes map[string]interface{}
|
||||
variable node.Node
|
||||
expr node.Node
|
||||
}
|
||||
|
||||
func NewStaticVar(variable node.Node, expr node.Node) node.Node {
|
||||
return StaticVar{
|
||||
"StaticVar",
|
||||
map[string]interface{}{},
|
||||
variable,
|
||||
expr,
|
||||
}
|
||||
@@ -23,7 +25,7 @@ func (n StaticVar) Name() string {
|
||||
}
|
||||
|
||||
func (n StaticVar) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
return n.attributes
|
||||
}
|
||||
|
||||
func (n StaticVar) Walk(v node.Visitor) {
|
||||
|
||||
@@ -5,13 +5,15 @@ import (
|
||||
)
|
||||
|
||||
type StmtList struct {
|
||||
name string
|
||||
stmts []node.Node
|
||||
name string
|
||||
attributes map[string]interface{}
|
||||
stmts []node.Node
|
||||
}
|
||||
|
||||
func NewStmtList(stmts []node.Node) node.Node {
|
||||
return StmtList{
|
||||
"StmtList",
|
||||
map[string]interface{}{},
|
||||
stmts,
|
||||
}
|
||||
}
|
||||
@@ -21,7 +23,7 @@ func (n StmtList) Name() string {
|
||||
}
|
||||
|
||||
func (n StmtList) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
return n.attributes
|
||||
}
|
||||
|
||||
func (n StmtList) Walk(v node.Visitor) {
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
)
|
||||
|
||||
func (n Switch) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
return n.attributes
|
||||
}
|
||||
|
||||
func (n Switch) Name() string {
|
||||
@@ -14,15 +14,17 @@ func (n Switch) Name() string {
|
||||
}
|
||||
|
||||
type Switch struct {
|
||||
name string
|
||||
token token.Token
|
||||
cond node.Node
|
||||
cases []node.Node
|
||||
name string
|
||||
attributes map[string]interface{}
|
||||
token token.Token
|
||||
cond node.Node
|
||||
cases []node.Node
|
||||
}
|
||||
|
||||
func NewSwitch(token token.Token, cond node.Node, cases []node.Node) node.Node {
|
||||
return Switch{
|
||||
"Switch",
|
||||
map[string]interface{}{},
|
||||
token,
|
||||
cond,
|
||||
cases,
|
||||
|
||||
@@ -5,13 +5,15 @@ import (
|
||||
)
|
||||
|
||||
type Throw struct {
|
||||
name string
|
||||
expr node.Node
|
||||
name string
|
||||
attributes map[string]interface{}
|
||||
expr node.Node
|
||||
}
|
||||
|
||||
func NewThrow(expr node.Node) node.Node {
|
||||
return Throw{
|
||||
"Throw",
|
||||
map[string]interface{}{},
|
||||
expr,
|
||||
}
|
||||
}
|
||||
@@ -21,7 +23,7 @@ func (n Throw) Name() string {
|
||||
}
|
||||
|
||||
func (n Throw) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
return n.attributes
|
||||
}
|
||||
|
||||
func (n Throw) Walk(v node.Visitor) {
|
||||
|
||||
@@ -5,14 +5,16 @@ import (
|
||||
)
|
||||
|
||||
type Trait struct {
|
||||
name string
|
||||
traitName node.Node
|
||||
stmts []node.Node
|
||||
name string
|
||||
attributes map[string]interface{}
|
||||
traitName node.Node
|
||||
stmts []node.Node
|
||||
}
|
||||
|
||||
func NewTrait(traitName node.Node, stmts []node.Node) node.Node {
|
||||
return Trait{
|
||||
"Trait",
|
||||
map[string]interface{}{},
|
||||
traitName,
|
||||
stmts,
|
||||
}
|
||||
@@ -23,7 +25,7 @@ func (n Trait) Name() string {
|
||||
}
|
||||
|
||||
func (n Trait) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
return n.attributes
|
||||
}
|
||||
|
||||
func (n Trait) Walk(v node.Visitor) {
|
||||
|
||||
@@ -5,14 +5,16 @@ import (
|
||||
)
|
||||
|
||||
type TraitMethodRef struct {
|
||||
name string
|
||||
trait node.Node
|
||||
method node.Node
|
||||
name string
|
||||
attributes map[string]interface{}
|
||||
trait node.Node
|
||||
method node.Node
|
||||
}
|
||||
|
||||
func NewTraitMethodRef(trait node.Node, method node.Node) node.Node {
|
||||
return TraitMethodRef{
|
||||
"TraitMethodRef",
|
||||
map[string]interface{}{},
|
||||
trait,
|
||||
method,
|
||||
}
|
||||
@@ -23,7 +25,7 @@ func (n TraitMethodRef) Name() string {
|
||||
}
|
||||
|
||||
func (n TraitMethodRef) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
return n.attributes
|
||||
}
|
||||
|
||||
func (n TraitMethodRef) Walk(v node.Visitor) {
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
|
||||
type TraitUse struct {
|
||||
name string
|
||||
attributes map[string]interface{}
|
||||
traits []node.Node
|
||||
adaptations []node.Node
|
||||
}
|
||||
@@ -13,6 +14,7 @@ type TraitUse struct {
|
||||
func NewTraitUse(traits []node.Node, adaptations []node.Node) node.Node {
|
||||
return TraitUse{
|
||||
"TraitUse",
|
||||
map[string]interface{}{},
|
||||
traits,
|
||||
adaptations,
|
||||
}
|
||||
@@ -23,7 +25,7 @@ func (n TraitUse) Name() string {
|
||||
}
|
||||
|
||||
func (n TraitUse) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
return n.attributes
|
||||
}
|
||||
|
||||
func (n TraitUse) Walk(v node.Visitor) {
|
||||
|
||||
@@ -5,15 +5,17 @@ import (
|
||||
)
|
||||
|
||||
type TraitUseAlias struct {
|
||||
name string
|
||||
ref node.Node
|
||||
modifier node.Node
|
||||
alias node.Node
|
||||
name string
|
||||
attributes map[string]interface{}
|
||||
ref node.Node
|
||||
modifier node.Node
|
||||
alias node.Node
|
||||
}
|
||||
|
||||
func NewTraitUseAlias(ref node.Node, modifier node.Node, alias node.Node) node.Node {
|
||||
return TraitUseAlias{
|
||||
"TraitUseAlias",
|
||||
map[string]interface{}{},
|
||||
ref,
|
||||
modifier,
|
||||
alias,
|
||||
@@ -25,7 +27,7 @@ func (n TraitUseAlias) Name() string {
|
||||
}
|
||||
|
||||
func (n TraitUseAlias) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
return n.attributes
|
||||
}
|
||||
|
||||
func (n TraitUseAlias) Walk(v node.Visitor) {
|
||||
|
||||
@@ -5,14 +5,16 @@ import (
|
||||
)
|
||||
|
||||
type TraitUsePrecedence struct {
|
||||
name string
|
||||
ref node.Node
|
||||
insteadof node.Node
|
||||
name string
|
||||
attributes map[string]interface{}
|
||||
ref node.Node
|
||||
insteadof node.Node
|
||||
}
|
||||
|
||||
func NewTraitUsePrecedence(ref node.Node, insteadof node.Node) node.Node {
|
||||
return TraitUsePrecedence{
|
||||
"TraitUsePrecedence",
|
||||
map[string]interface{}{},
|
||||
ref,
|
||||
insteadof,
|
||||
}
|
||||
@@ -23,7 +25,7 @@ func (n TraitUsePrecedence) Name() string {
|
||||
}
|
||||
|
||||
func (n TraitUsePrecedence) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
return n.attributes
|
||||
}
|
||||
|
||||
func (n TraitUsePrecedence) Walk(v node.Visitor) {
|
||||
|
||||
@@ -5,15 +5,17 @@ import (
|
||||
)
|
||||
|
||||
type Try struct {
|
||||
name string
|
||||
stmts []node.Node
|
||||
catches []node.Node
|
||||
finally node.Node
|
||||
name string
|
||||
attributes map[string]interface{}
|
||||
stmts []node.Node
|
||||
catches []node.Node
|
||||
finally node.Node
|
||||
}
|
||||
|
||||
func NewTry(stmts []node.Node, catches []node.Node, finally node.Node) node.Node {
|
||||
return Try{
|
||||
"Try",
|
||||
map[string]interface{}{},
|
||||
stmts,
|
||||
catches,
|
||||
finally,
|
||||
@@ -25,7 +27,7 @@ func (n Try) Name() string {
|
||||
}
|
||||
|
||||
func (n Try) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
return n.attributes
|
||||
}
|
||||
|
||||
func (n Try) Walk(v node.Visitor) {
|
||||
|
||||
@@ -5,13 +5,15 @@ import (
|
||||
)
|
||||
|
||||
type Unset struct {
|
||||
name string
|
||||
vars []node.Node
|
||||
name string
|
||||
attributes map[string]interface{}
|
||||
vars []node.Node
|
||||
}
|
||||
|
||||
func NewUnset(vars []node.Node) node.Node {
|
||||
return Unset{
|
||||
"Unset",
|
||||
map[string]interface{}{},
|
||||
vars,
|
||||
}
|
||||
}
|
||||
@@ -21,7 +23,7 @@ func (n Unset) Name() string {
|
||||
}
|
||||
|
||||
func (n Unset) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
return n.attributes
|
||||
}
|
||||
|
||||
func (n Unset) Walk(v node.Visitor) {
|
||||
|
||||
@@ -5,15 +5,17 @@ import (
|
||||
)
|
||||
|
||||
type Use struct {
|
||||
name string
|
||||
useType node.Node
|
||||
use node.Node
|
||||
alias node.Node
|
||||
name string
|
||||
attributes map[string]interface{}
|
||||
useType node.Node
|
||||
use node.Node
|
||||
alias node.Node
|
||||
}
|
||||
|
||||
func NewUse(useType node.Node, use node.Node, alias node.Node) node.Node {
|
||||
return Use{
|
||||
"Use",
|
||||
map[string]interface{}{},
|
||||
useType,
|
||||
use,
|
||||
alias,
|
||||
@@ -25,7 +27,7 @@ func (n Use) Name() string {
|
||||
}
|
||||
|
||||
func (n Use) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
return n.attributes
|
||||
}
|
||||
|
||||
func (n Use) SetUseType(useType node.Node) node.Node {
|
||||
|
||||
@@ -5,14 +5,16 @@ import (
|
||||
)
|
||||
|
||||
type UseList struct {
|
||||
name string
|
||||
useType node.Node
|
||||
uses []node.Node
|
||||
name string
|
||||
attributes map[string]interface{}
|
||||
useType node.Node
|
||||
uses []node.Node
|
||||
}
|
||||
|
||||
func NewUseList(useType node.Node, uses []node.Node) node.Node {
|
||||
return UseList{
|
||||
"UseList",
|
||||
map[string]interface{}{},
|
||||
useType,
|
||||
uses,
|
||||
}
|
||||
@@ -23,7 +25,7 @@ func (n UseList) Name() string {
|
||||
}
|
||||
|
||||
func (n UseList) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
return n.attributes
|
||||
}
|
||||
|
||||
func (n UseList) Walk(v node.Visitor) {
|
||||
|
||||
@@ -6,15 +6,17 @@ import (
|
||||
)
|
||||
|
||||
type While struct {
|
||||
name string
|
||||
token token.Token
|
||||
cond node.Node
|
||||
stmt node.Node
|
||||
name string
|
||||
attributes map[string]interface{}
|
||||
token token.Token
|
||||
cond node.Node
|
||||
stmt node.Node
|
||||
}
|
||||
|
||||
func NewWhile(token token.Token, cond node.Node, stmt node.Node) node.Node {
|
||||
return While{
|
||||
"While",
|
||||
map[string]interface{}{},
|
||||
token,
|
||||
cond,
|
||||
stmt,
|
||||
@@ -26,7 +28,7 @@ func (n While) Name() string {
|
||||
}
|
||||
|
||||
func (n While) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
return n.attributes
|
||||
}
|
||||
|
||||
func (n While) Walk(v node.Visitor) {
|
||||
|
||||
Reference in New Issue
Block a user