#51 saving optional tokes and tokens that have different representation as meta
This commit is contained in:
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// Assign node
|
||||
type Assign struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
Expression node.Node
|
||||
@@ -33,12 +33,8 @@ func (n *Assign) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Assign) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *Assign) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *Assign) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// Reference node
|
||||
type Reference struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
Expression node.Node
|
||||
@@ -33,12 +33,8 @@ func (n *Reference) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Reference) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *Reference) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *Reference) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// BitwiseAnd node
|
||||
type BitwiseAnd struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
Expression node.Node
|
||||
@@ -33,12 +33,8 @@ func (n *BitwiseAnd) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *BitwiseAnd) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *BitwiseAnd) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *BitwiseAnd) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// BitwiseOr node
|
||||
type BitwiseOr struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
Expression node.Node
|
||||
@@ -33,12 +33,8 @@ func (n *BitwiseOr) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *BitwiseOr) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *BitwiseOr) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *BitwiseOr) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// BitwiseXor node
|
||||
type BitwiseXor struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
Expression node.Node
|
||||
@@ -33,12 +33,8 @@ func (n *BitwiseXor) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *BitwiseXor) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *BitwiseXor) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *BitwiseXor) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// Concat node
|
||||
type Concat struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
Expression node.Node
|
||||
@@ -33,12 +33,8 @@ func (n *Concat) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Concat) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *Concat) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *Concat) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// Div node
|
||||
type Div struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
Expression node.Node
|
||||
@@ -33,12 +33,8 @@ func (n *Div) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Div) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *Div) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *Div) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// Minus node
|
||||
type Minus struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
Expression node.Node
|
||||
@@ -33,12 +33,8 @@ func (n *Minus) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Minus) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *Minus) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *Minus) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// Mod node
|
||||
type Mod struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
Expression node.Node
|
||||
@@ -33,12 +33,8 @@ func (n *Mod) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Mod) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *Mod) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *Mod) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// Mul node
|
||||
type Mul struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
Expression node.Node
|
||||
@@ -33,12 +33,8 @@ func (n *Mul) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Mul) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *Mul) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *Mul) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// Plus node
|
||||
type Plus struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
Expression node.Node
|
||||
@@ -33,12 +33,8 @@ func (n *Plus) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Plus) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *Plus) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *Plus) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// Pow node
|
||||
type Pow struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
Expression node.Node
|
||||
@@ -33,12 +33,8 @@ func (n *Pow) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Pow) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *Pow) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *Pow) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// ShiftLeft node
|
||||
type ShiftLeft struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
Expression node.Node
|
||||
@@ -33,12 +33,8 @@ func (n *ShiftLeft) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *ShiftLeft) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *ShiftLeft) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *ShiftLeft) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// ShiftRight node
|
||||
type ShiftRight struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
Expression node.Node
|
||||
@@ -33,12 +33,8 @@ func (n *ShiftRight) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *ShiftRight) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *ShiftRight) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *ShiftRight) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -29,12 +29,20 @@ var nodes = []node.Node{
|
||||
}
|
||||
|
||||
func TestMeta(t *testing.T) {
|
||||
expected := []meta.Meta{
|
||||
meta.NewComment("//comment\n", nil),
|
||||
meta.NewWhiteSpace(" ", nil),
|
||||
expected := &meta.Collection{
|
||||
&meta.Data{
|
||||
Value: "//comment\n",
|
||||
Type: meta.CommentType,
|
||||
Position: nil,
|
||||
},
|
||||
&meta.Data{
|
||||
Value: " ",
|
||||
Type: meta.WhiteSpaceType,
|
||||
Position: nil,
|
||||
},
|
||||
}
|
||||
for _, n := range nodes {
|
||||
n.AddMeta(expected)
|
||||
n.GetMeta().Push(*expected...)
|
||||
actual := n.GetMeta()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// BitwiseAnd node
|
||||
type BitwiseAnd struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
@@ -33,12 +33,8 @@ func (n *BitwiseAnd) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *BitwiseAnd) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *BitwiseAnd) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *BitwiseAnd) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// BitwiseOr node
|
||||
type BitwiseOr struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
@@ -33,12 +33,8 @@ func (n *BitwiseOr) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *BitwiseOr) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *BitwiseOr) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *BitwiseOr) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// BitwiseXor node
|
||||
type BitwiseXor struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
@@ -33,12 +33,8 @@ func (n *BitwiseXor) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *BitwiseXor) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *BitwiseXor) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *BitwiseXor) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// BooleanAnd node
|
||||
type BooleanAnd struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
@@ -33,12 +33,8 @@ func (n *BooleanAnd) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *BooleanAnd) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *BooleanAnd) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *BooleanAnd) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// BooleanOr node
|
||||
type BooleanOr struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
@@ -33,12 +33,8 @@ func (n *BooleanOr) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *BooleanOr) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *BooleanOr) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *BooleanOr) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// Coalesce node
|
||||
type Coalesce struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
@@ -33,12 +33,8 @@ func (n *Coalesce) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Coalesce) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *Coalesce) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *Coalesce) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// Concat node
|
||||
type Concat struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
@@ -33,12 +33,8 @@ func (n *Concat) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Concat) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *Concat) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *Concat) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// Div node
|
||||
type Div struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
@@ -33,12 +33,8 @@ func (n *Div) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Div) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *Div) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *Div) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// Equal node
|
||||
type Equal struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
@@ -33,12 +33,8 @@ func (n *Equal) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Equal) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *Equal) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *Equal) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// Greater node
|
||||
type Greater struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
@@ -33,12 +33,8 @@ func (n *Greater) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Greater) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *Greater) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *Greater) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// GreaterOrEqual node
|
||||
type GreaterOrEqual struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
@@ -33,12 +33,8 @@ func (n *GreaterOrEqual) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *GreaterOrEqual) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *GreaterOrEqual) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *GreaterOrEqual) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// Identical node
|
||||
type Identical struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
@@ -33,12 +33,8 @@ func (n *Identical) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Identical) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *Identical) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *Identical) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// LogicalAnd node
|
||||
type LogicalAnd struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
@@ -33,12 +33,8 @@ func (n *LogicalAnd) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *LogicalAnd) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *LogicalAnd) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *LogicalAnd) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// LogicalOr node
|
||||
type LogicalOr struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
@@ -33,12 +33,8 @@ func (n *LogicalOr) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *LogicalOr) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *LogicalOr) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *LogicalOr) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// LogicalXor node
|
||||
type LogicalXor struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
@@ -33,12 +33,8 @@ func (n *LogicalXor) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *LogicalXor) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *LogicalXor) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *LogicalXor) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// Minus node
|
||||
type Minus struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
@@ -33,12 +33,8 @@ func (n *Minus) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Minus) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *Minus) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *Minus) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// Mod node
|
||||
type Mod struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
@@ -33,12 +33,8 @@ func (n *Mod) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Mod) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *Mod) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *Mod) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// Mul node
|
||||
type Mul struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
@@ -33,12 +33,8 @@ func (n *Mul) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Mul) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *Mul) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *Mul) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// NotEqual node
|
||||
type NotEqual struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
@@ -33,12 +33,8 @@ func (n *NotEqual) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *NotEqual) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *NotEqual) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *NotEqual) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// NotIdentical node
|
||||
type NotIdentical struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
@@ -33,12 +33,8 @@ func (n *NotIdentical) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *NotIdentical) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *NotIdentical) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *NotIdentical) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// Plus node
|
||||
type Plus struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
@@ -33,12 +33,8 @@ func (n *Plus) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Plus) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *Plus) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *Plus) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// Pow node
|
||||
type Pow struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
@@ -33,12 +33,8 @@ func (n *Pow) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Pow) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *Pow) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *Pow) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// ShiftLeft node
|
||||
type ShiftLeft struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
@@ -33,12 +33,8 @@ func (n *ShiftLeft) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *ShiftLeft) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *ShiftLeft) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *ShiftLeft) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// ShiftRight node
|
||||
type ShiftRight struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
@@ -33,12 +33,8 @@ func (n *ShiftRight) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *ShiftRight) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *ShiftRight) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *ShiftRight) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// Smaller node
|
||||
type Smaller struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
@@ -33,12 +33,8 @@ func (n *Smaller) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Smaller) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *Smaller) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *Smaller) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// SmallerOrEqual node
|
||||
type SmallerOrEqual struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
@@ -33,12 +33,8 @@ func (n *SmallerOrEqual) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *SmallerOrEqual) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *SmallerOrEqual) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *SmallerOrEqual) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// Spaceship node
|
||||
type Spaceship struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
@@ -33,12 +33,8 @@ func (n *Spaceship) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Spaceship) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *Spaceship) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *Spaceship) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -41,12 +41,20 @@ var nodes = []node.Node{
|
||||
}
|
||||
|
||||
func TestMeta(t *testing.T) {
|
||||
expected := []meta.Meta{
|
||||
meta.NewComment("//comment\n", nil),
|
||||
meta.NewWhiteSpace(" ", nil),
|
||||
expected := &meta.Collection{
|
||||
&meta.Data{
|
||||
Value: "//comment\n",
|
||||
Type: meta.CommentType,
|
||||
Position: nil,
|
||||
},
|
||||
&meta.Data{
|
||||
Value: " ",
|
||||
Type: meta.WhiteSpaceType,
|
||||
Position: nil,
|
||||
},
|
||||
}
|
||||
for _, n := range nodes {
|
||||
n.AddMeta(expected)
|
||||
n.GetMeta().Push(*expected...)
|
||||
actual := n.GetMeta()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// Array node
|
||||
type Array struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Expr node.Node
|
||||
}
|
||||
@@ -31,12 +31,8 @@ func (n *Array) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Array) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *Array) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *Array) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// Bool node
|
||||
type Bool struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Expr node.Node
|
||||
}
|
||||
@@ -31,12 +31,8 @@ func (n *Bool) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Bool) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *Bool) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *Bool) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// Double node
|
||||
type Double struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Expr node.Node
|
||||
}
|
||||
@@ -31,12 +31,8 @@ func (n *Double) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Double) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *Double) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *Double) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// Int node
|
||||
type Int struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Expr node.Node
|
||||
}
|
||||
@@ -31,12 +31,8 @@ func (n *Int) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Int) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *Int) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *Int) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// Object node
|
||||
type Object struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Expr node.Node
|
||||
}
|
||||
@@ -31,12 +31,8 @@ func (n *Object) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Object) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *Object) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *Object) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// String node
|
||||
type String struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Expr node.Node
|
||||
}
|
||||
@@ -31,12 +31,8 @@ func (n *String) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *String) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *String) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *String) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// Unset node
|
||||
type Unset struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Expr node.Node
|
||||
}
|
||||
@@ -31,12 +31,8 @@ func (n *Unset) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Unset) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *Unset) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *Unset) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -21,12 +21,20 @@ var nodes = []node.Node{
|
||||
}
|
||||
|
||||
func TestMeta(t *testing.T) {
|
||||
expected := []meta.Meta{
|
||||
meta.NewComment("//comment\n", nil),
|
||||
meta.NewWhiteSpace(" ", nil),
|
||||
expected := &meta.Collection{
|
||||
&meta.Data{
|
||||
Value: "//comment\n",
|
||||
Type: meta.CommentType,
|
||||
Position: nil,
|
||||
},
|
||||
&meta.Data{
|
||||
Value: " ",
|
||||
Type: meta.WhiteSpaceType,
|
||||
Position: nil,
|
||||
},
|
||||
}
|
||||
for _, n := range nodes {
|
||||
n.AddMeta(expected)
|
||||
n.GetMeta().Push(*expected...)
|
||||
actual := n.GetMeta()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// Array node
|
||||
type Array struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Items []node.Node
|
||||
}
|
||||
@@ -31,12 +31,8 @@ func (n *Array) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Array) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *Array) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *Array) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// ArrayDimFetch node
|
||||
type ArrayDimFetch struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
Dim node.Node
|
||||
@@ -33,12 +33,8 @@ func (n *ArrayDimFetch) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *ArrayDimFetch) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *ArrayDimFetch) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *ArrayDimFetch) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// ArrayItem node
|
||||
type ArrayItem struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Key node.Node
|
||||
Val node.Node
|
||||
@@ -33,12 +33,8 @@ func (n *ArrayItem) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *ArrayItem) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *ArrayItem) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *ArrayItem) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// BitwiseNot node
|
||||
type BitwiseNot struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Expr node.Node
|
||||
}
|
||||
@@ -31,12 +31,8 @@ func (n *BitwiseNot) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *BitwiseNot) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *BitwiseNot) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *BitwiseNot) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// BooleanNot node
|
||||
type BooleanNot struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Expr node.Node
|
||||
}
|
||||
@@ -31,12 +31,8 @@ func (n *BooleanNot) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *BooleanNot) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *BooleanNot) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *BooleanNot) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// ClassConstFetch node
|
||||
type ClassConstFetch struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Class node.Node
|
||||
ConstantName node.Node
|
||||
@@ -33,12 +33,8 @@ func (n *ClassConstFetch) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *ClassConstFetch) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *ClassConstFetch) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *ClassConstFetch) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// Clone node
|
||||
type Clone struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Expr node.Node
|
||||
}
|
||||
@@ -31,12 +31,8 @@ func (n *Clone) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Clone) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *Clone) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *Clone) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// Closure node
|
||||
type Closure struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
ReturnsRef bool
|
||||
Static bool
|
||||
@@ -43,12 +43,8 @@ func (n *Closure) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Closure) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *Closure) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *Closure) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// ClosureUse node
|
||||
type ClosureUse struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Uses []node.Node
|
||||
}
|
||||
@@ -31,12 +31,8 @@ func (n *ClosureUse) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *ClosureUse) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *ClosureUse) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *ClosureUse) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// ConstFetch node
|
||||
type ConstFetch struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Constant node.Node
|
||||
}
|
||||
@@ -31,12 +31,8 @@ func (n *ConstFetch) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *ConstFetch) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *ConstFetch) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *ConstFetch) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// Empty node
|
||||
type Empty struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Expr node.Node
|
||||
}
|
||||
@@ -31,12 +31,8 @@ func (n *Empty) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Empty) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *Empty) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *Empty) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// ErrorSuppress node
|
||||
type ErrorSuppress struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Expr node.Node
|
||||
}
|
||||
@@ -31,12 +31,8 @@ func (n *ErrorSuppress) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *ErrorSuppress) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *ErrorSuppress) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *ErrorSuppress) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// Eval node
|
||||
type Eval struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Expr node.Node
|
||||
}
|
||||
@@ -31,12 +31,8 @@ func (n *Eval) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Eval) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *Eval) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *Eval) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// Exit node
|
||||
type Exit struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Die bool
|
||||
Position *position.Position
|
||||
Expr node.Node
|
||||
@@ -32,12 +32,8 @@ func (n *Exit) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Exit) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *Exit) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *Exit) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// FunctionCall node
|
||||
type FunctionCall struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Function node.Node
|
||||
ArgumentList *node.ArgumentList
|
||||
@@ -33,12 +33,8 @@ func (n *FunctionCall) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *FunctionCall) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *FunctionCall) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *FunctionCall) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// Include node
|
||||
type Include struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Expr node.Node
|
||||
}
|
||||
@@ -31,12 +31,8 @@ func (n *Include) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Include) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *Include) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *Include) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// IncludeOnce node
|
||||
type IncludeOnce struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Expr node.Node
|
||||
}
|
||||
@@ -31,12 +31,8 @@ func (n *IncludeOnce) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *IncludeOnce) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *IncludeOnce) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *IncludeOnce) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// InstanceOf node
|
||||
type InstanceOf struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Expr node.Node
|
||||
Class node.Node
|
||||
@@ -33,12 +33,8 @@ func (n *InstanceOf) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *InstanceOf) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *InstanceOf) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *InstanceOf) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// Isset node
|
||||
type Isset struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Variables []node.Node
|
||||
}
|
||||
@@ -31,12 +31,8 @@ func (n *Isset) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Isset) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *Isset) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *Isset) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// List node
|
||||
type List struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Items []node.Node
|
||||
}
|
||||
@@ -31,12 +31,8 @@ func (n *List) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *List) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *List) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *List) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// MethodCall node
|
||||
type MethodCall struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
Method node.Node
|
||||
@@ -35,12 +35,8 @@ func (n *MethodCall) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *MethodCall) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *MethodCall) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *MethodCall) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// New node
|
||||
type New struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Class node.Node
|
||||
ArgumentList *node.ArgumentList
|
||||
@@ -33,12 +33,8 @@ func (n *New) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *New) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *New) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *New) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// PostDec node
|
||||
type PostDec struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
}
|
||||
@@ -31,12 +31,8 @@ func (n *PostDec) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *PostDec) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *PostDec) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *PostDec) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// PostInc node
|
||||
type PostInc struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
}
|
||||
@@ -31,12 +31,8 @@ func (n *PostInc) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *PostInc) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *PostInc) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *PostInc) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// PreDec node
|
||||
type PreDec struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
}
|
||||
@@ -31,12 +31,8 @@ func (n *PreDec) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *PreDec) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *PreDec) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *PreDec) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// PreInc node
|
||||
type PreInc struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
}
|
||||
@@ -31,12 +31,8 @@ func (n *PreInc) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *PreInc) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *PreInc) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *PreInc) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// Print node
|
||||
type Print struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Expr node.Node
|
||||
}
|
||||
@@ -31,12 +31,8 @@ func (n *Print) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Print) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *Print) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *Print) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// PropertyFetch node
|
||||
type PropertyFetch struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
Property node.Node
|
||||
@@ -33,12 +33,8 @@ func (n *PropertyFetch) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *PropertyFetch) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *PropertyFetch) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *PropertyFetch) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// Reference node
|
||||
type Reference struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
}
|
||||
@@ -31,12 +31,8 @@ func (n *Reference) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Reference) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *Reference) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *Reference) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// Require node
|
||||
type Require struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Expr node.Node
|
||||
}
|
||||
@@ -31,12 +31,8 @@ func (n *Require) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Require) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *Require) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *Require) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// RequireOnce node
|
||||
type RequireOnce struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Expr node.Node
|
||||
}
|
||||
@@ -31,12 +31,8 @@ func (n *RequireOnce) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *RequireOnce) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *RequireOnce) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *RequireOnce) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// ShellExec node
|
||||
type ShellExec struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Parts []node.Node
|
||||
}
|
||||
@@ -31,12 +31,8 @@ func (n *ShellExec) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *ShellExec) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *ShellExec) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *ShellExec) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// ShortArray node
|
||||
type ShortArray struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Items []node.Node
|
||||
}
|
||||
@@ -31,12 +31,8 @@ func (n *ShortArray) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *ShortArray) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *ShortArray) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *ShortArray) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// ShortList node
|
||||
type ShortList struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Items []node.Node
|
||||
}
|
||||
@@ -31,12 +31,8 @@ func (n *ShortList) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *ShortList) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *ShortList) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *ShortList) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// StaticCall node
|
||||
type StaticCall struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Class node.Node
|
||||
Call node.Node
|
||||
@@ -35,12 +35,8 @@ func (n *StaticCall) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *StaticCall) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *StaticCall) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *StaticCall) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// StaticPropertyFetch node
|
||||
type StaticPropertyFetch struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Class node.Node
|
||||
Property node.Node
|
||||
@@ -33,12 +33,8 @@ func (n *StaticPropertyFetch) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *StaticPropertyFetch) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *StaticPropertyFetch) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *StaticPropertyFetch) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// Ternary node
|
||||
type Ternary struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Condition node.Node
|
||||
IfTrue node.Node
|
||||
@@ -35,12 +35,8 @@ func (n *Ternary) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Ternary) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *Ternary) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *Ternary) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// UnaryMinus node
|
||||
type UnaryMinus struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Expr node.Node
|
||||
}
|
||||
@@ -31,12 +31,8 @@ func (n *UnaryMinus) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *UnaryMinus) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *UnaryMinus) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *UnaryMinus) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// UnaryPlus node
|
||||
type UnaryPlus struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Expr node.Node
|
||||
}
|
||||
@@ -31,12 +31,8 @@ func (n *UnaryPlus) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *UnaryPlus) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *UnaryPlus) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *UnaryPlus) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,9 +9,10 @@ import (
|
||||
|
||||
// Variable node
|
||||
type Variable struct {
|
||||
Meta []meta.Meta
|
||||
Position *position.Position
|
||||
VarName node.Node
|
||||
Meta meta.Collection
|
||||
StringVar bool
|
||||
Position *position.Position
|
||||
VarName node.Node
|
||||
}
|
||||
|
||||
// NewVariable node constructor
|
||||
@@ -31,17 +32,15 @@ func (n *Variable) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Variable) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *Variable) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *Variable) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *Variable) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
return map[string]interface{}{
|
||||
"StringVar": n.StringVar,
|
||||
}
|
||||
}
|
||||
|
||||
// SetVarName reset var name
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// Yield node
|
||||
type Yield struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Key node.Node
|
||||
Value node.Node
|
||||
@@ -33,12 +33,8 @@ func (n *Yield) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Yield) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *Yield) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *Yield) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// YieldFrom node
|
||||
type YieldFrom struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Expr node.Node
|
||||
}
|
||||
@@ -31,12 +31,8 @@ func (n *YieldFrom) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *YieldFrom) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *YieldFrom) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *YieldFrom) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -56,12 +56,20 @@ var nodes = []node.Node{
|
||||
}
|
||||
|
||||
func TestMeta(t *testing.T) {
|
||||
expected := []meta.Meta{
|
||||
meta.NewComment("//comment\n", nil),
|
||||
meta.NewWhiteSpace(" ", nil),
|
||||
expected := &meta.Collection{
|
||||
&meta.Data{
|
||||
Value: "//comment\n",
|
||||
Type: meta.CommentType,
|
||||
Position: nil,
|
||||
},
|
||||
&meta.Data{
|
||||
Value: " ",
|
||||
Type: meta.WhiteSpaceType,
|
||||
Position: nil,
|
||||
},
|
||||
}
|
||||
for _, n := range nodes {
|
||||
n.AddMeta(expected)
|
||||
n.GetMeta().Push(*expected...)
|
||||
actual := n.GetMeta()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@@ -333,7 +333,9 @@ var nodesToTest = []struct {
|
||||
{
|
||||
&expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||
[]string{"VarName"},
|
||||
map[string]interface{}{},
|
||||
map[string]interface{}{
|
||||
"StringVar": false,
|
||||
},
|
||||
},
|
||||
{
|
||||
&expr.YieldFrom{
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
|
||||
// Argument node
|
||||
type Argument struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Variadic bool // if ... before variable
|
||||
IsReference bool // if & before variable
|
||||
@@ -34,12 +34,8 @@ func (n *Argument) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Argument) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *Argument) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *Argument) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
|
||||
// ArgumentList node
|
||||
type ArgumentList struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Arguments []Node
|
||||
}
|
||||
@@ -30,12 +30,8 @@ func (n *ArgumentList) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *ArgumentList) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *ArgumentList) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *ArgumentList) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
|
||||
// Identifier node
|
||||
type Identifier struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Value string
|
||||
}
|
||||
@@ -30,12 +30,8 @@ func (n *Identifier) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Identifier) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *Identifier) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *Identifier) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
|
||||
// Nullable node
|
||||
type Nullable struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
Expr Node
|
||||
}
|
||||
@@ -30,12 +30,8 @@ func (n *Nullable) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Nullable) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *Nullable) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *Nullable) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
|
||||
// Parameter node
|
||||
type Parameter struct {
|
||||
Meta []meta.Meta
|
||||
Meta meta.Collection
|
||||
Position *position.Position
|
||||
ByRef bool
|
||||
Variadic bool
|
||||
@@ -38,12 +38,8 @@ func (n *Parameter) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Parameter) AddMeta(m []meta.Meta) {
|
||||
n.Meta = append(n.Meta, m...)
|
||||
}
|
||||
|
||||
func (n *Parameter) GetMeta() []meta.Meta {
|
||||
return n.Meta
|
||||
func (n *Parameter) GetMeta() *meta.Collection {
|
||||
return &n.Meta
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user