refactoring: remove StmtTraitAdaptationList node

This commit is contained in:
Vadym Slizov 2020-12-20 23:04:23 +02:00
parent 74b0949255
commit 03c7979ccd
No known key found for this signature in database
GPG Key ID: AEA2A9388EF42A4A
17 changed files with 1221 additions and 1413 deletions

View File

@ -23235,13 +23235,6 @@ func TestStmtTraitUse(t *testing.T) {
},
},
},
Adaptations: &ast.StmtNop{
Position: &position.Position{
StartLine: 1,
EndLine: 1,
StartPos: 22,
EndPos: 23,
},
SemiColonTkn: &token.Token{
ID: token.ID(59),
Value: []byte(";"),
@ -23254,7 +23247,6 @@ func TestStmtTraitUse(t *testing.T) {
},
},
},
},
CloseCurlyBracketTkn: &token.Token{
ID: token.ID(125),
Value: []byte("}"),
@ -23518,13 +23510,6 @@ func TestStmtTraitUse_Uses(t *testing.T) {
},
},
},
Adaptations: &ast.StmtNop{
Position: &position.Position{
StartLine: 1,
EndLine: 1,
StartPos: 27,
EndPos: 28,
},
SemiColonTkn: &token.Token{
ID: token.ID(59),
Value: []byte(";"),
@ -23537,7 +23522,6 @@ func TestStmtTraitUse_Uses(t *testing.T) {
},
},
},
},
CloseCurlyBracketTkn: &token.Token{
ID: token.ID(125),
Value: []byte("}"),
@ -23801,13 +23785,6 @@ func TestStmtTraitUse_EmptyAdaptations(t *testing.T) {
},
},
},
Adaptations: &ast.StmtTraitAdaptationList{
Position: &position.Position{
StartLine: 1,
EndLine: 1,
StartPos: 28,
EndPos: 30,
},
OpenCurlyBracketTkn: &token.Token{
ID: token.ID(123),
Value: []byte("{"),
@ -23842,7 +23819,6 @@ func TestStmtTraitUse_EmptyAdaptations(t *testing.T) {
},
},
},
},
CloseCurlyBracketTkn: &token.Token{
ID: token.ID(125),
Value: []byte("}"),
@ -24106,13 +24082,6 @@ func TestStmtTraitUse_Modifier(t *testing.T) {
},
},
},
Adaptations: &ast.StmtTraitAdaptationList{
Position: &position.Position{
StartLine: 1,
EndLine: 1,
StartPos: 28,
EndPos: 46,
},
OpenCurlyBracketTkn: &token.Token{
ID: token.ID(123),
Value: []byte("{"),
@ -24271,7 +24240,6 @@ func TestStmtTraitUse_Modifier(t *testing.T) {
},
},
},
},
CloseCurlyBracketTkn: &token.Token{
ID: token.ID(125),
Value: []byte("}"),
@ -24535,13 +24503,6 @@ func TestStmtTraitUse_AliasModifier(t *testing.T) {
},
},
},
Adaptations: &ast.StmtTraitAdaptationList{
Position: &position.Position{
StartLine: 1,
EndLine: 1,
StartPos: 28,
EndPos: 50,
},
OpenCurlyBracketTkn: &token.Token{
ID: token.ID(123),
Value: []byte("{"),
@ -24731,7 +24692,6 @@ func TestStmtTraitUse_AliasModifier(t *testing.T) {
},
},
},
},
CloseCurlyBracketTkn: &token.Token{
ID: token.ID(125),
Value: []byte("}"),
@ -24995,13 +24955,6 @@ func TestStmtTraitUse_Adaptions(t *testing.T) {
},
},
},
Adaptations: &ast.StmtTraitAdaptationList{
Position: &position.Position{
StartLine: 1,
EndLine: 1,
StartPos: 28,
EndPos: 78,
},
OpenCurlyBracketTkn: &token.Token{
ID: token.ID(123),
Value: []byte("{"),
@ -25413,7 +25366,6 @@ func TestStmtTraitUse_Adaptions(t *testing.T) {
},
},
},
},
CloseCurlyBracketTkn: &token.Token{
ID: token.ID(125),
Value: []byte("}"),

BIN
internal/php5/php5.go generated

Binary file not shown.

View File

@ -2150,13 +2150,23 @@ class_statement:
trait_use_statement:
T_USE trait_list trait_adaptations
{
$$ = &ast.StmtTraitUse{
traitUse := &ast.StmtTraitUse{
Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $3),
UseTkn: $1,
Traits: $2.(*ast.ParserSeparatedList).Items,
SeparatorTkns: $2.(*ast.ParserSeparatedList).SeparatorTkns,
Adaptations: $3,
}
switch n := $3.(type) {
case *ast.TraitAdaptationList :
traitUse.OpenCurlyBracketTkn = n.OpenCurlyBracketTkn
traitUse.Adaptations = n.Adaptations
traitUse.CloseCurlyBracketTkn = n.CloseCurlyBracketTkn
case *ast.StmtNop :
traitUse.SemiColonTkn = n.SemiColonTkn
};
$$ = traitUse
}
;
@ -2186,7 +2196,7 @@ trait_adaptations:
}
| '{' trait_adaptation_list '}'
{
$$ = &ast.StmtTraitAdaptationList{
$$ = &ast.TraitAdaptationList{
Position: yylex.(*Parser).builder.NewTokensPosition($1, $3),
OpenCurlyBracketTkn: $1,
Adaptations: $2,

View File

@ -25219,13 +25219,6 @@ func TestStmtTraitUse(t *testing.T) {
},
},
},
Adaptations: &ast.StmtNop{
Position: &position.Position{
StartLine: 1,
EndLine: 1,
StartPos: 22,
EndPos: 23,
},
SemiColonTkn: &token.Token{
ID: token.ID(59),
Value: []byte(";"),
@ -25238,7 +25231,6 @@ func TestStmtTraitUse(t *testing.T) {
},
},
},
},
CloseCurlyBracketTkn: &token.Token{
ID: token.ID(125),
Value: []byte("}"),
@ -25502,13 +25494,6 @@ func TestStmtTraitUse_Uses(t *testing.T) {
},
},
},
Adaptations: &ast.StmtNop{
Position: &position.Position{
StartLine: 1,
EndLine: 1,
StartPos: 27,
EndPos: 28,
},
SemiColonTkn: &token.Token{
ID: token.ID(59),
Value: []byte(";"),
@ -25521,7 +25506,6 @@ func TestStmtTraitUse_Uses(t *testing.T) {
},
},
},
},
CloseCurlyBracketTkn: &token.Token{
ID: token.ID(125),
Value: []byte("}"),
@ -25785,13 +25769,6 @@ func TestStmtTraitUse_EmptyAdaptations(t *testing.T) {
},
},
},
Adaptations: &ast.StmtTraitAdaptationList{
Position: &position.Position{
StartLine: 1,
EndLine: 1,
StartPos: 28,
EndPos: 30,
},
OpenCurlyBracketTkn: &token.Token{
ID: token.ID(123),
Value: []byte("{"),
@ -25826,7 +25803,6 @@ func TestStmtTraitUse_EmptyAdaptations(t *testing.T) {
},
},
},
},
CloseCurlyBracketTkn: &token.Token{
ID: token.ID(125),
Value: []byte("}"),
@ -26090,13 +26066,6 @@ func TestStmtTraitUse_Modifier(t *testing.T) {
},
},
},
Adaptations: &ast.StmtTraitAdaptationList{
Position: &position.Position{
StartLine: 1,
EndLine: 1,
StartPos: 28,
EndPos: 46,
},
OpenCurlyBracketTkn: &token.Token{
ID: token.ID(123),
Value: []byte("{"),
@ -26255,7 +26224,6 @@ func TestStmtTraitUse_Modifier(t *testing.T) {
},
},
},
},
CloseCurlyBracketTkn: &token.Token{
ID: token.ID(125),
Value: []byte("}"),
@ -26519,13 +26487,6 @@ func TestStmtTraitUse_AliasModifier(t *testing.T) {
},
},
},
Adaptations: &ast.StmtTraitAdaptationList{
Position: &position.Position{
StartLine: 1,
EndLine: 1,
StartPos: 28,
EndPos: 50,
},
OpenCurlyBracketTkn: &token.Token{
ID: token.ID(123),
Value: []byte("{"),
@ -26715,7 +26676,6 @@ func TestStmtTraitUse_AliasModifier(t *testing.T) {
},
},
},
},
CloseCurlyBracketTkn: &token.Token{
ID: token.ID(125),
Value: []byte("}"),
@ -26979,13 +26939,6 @@ func TestStmtTraitUse_Adaptions(t *testing.T) {
},
},
},
Adaptations: &ast.StmtTraitAdaptationList{
Position: &position.Position{
StartLine: 1,
EndLine: 1,
StartPos: 28,
EndPos: 78,
},
OpenCurlyBracketTkn: &token.Token{
ID: token.ID(123),
Value: []byte("{"),
@ -27397,7 +27350,6 @@ func TestStmtTraitUse_Adaptions(t *testing.T) {
},
},
},
},
CloseCurlyBracketTkn: &token.Token{
ID: token.ID(125),
Value: []byte("}"),

BIN
internal/php7/php7.go generated

Binary file not shown.

View File

@ -1970,13 +1970,23 @@ class_statement:
}
| T_USE name_list trait_adaptations
{
$$ = &ast.StmtTraitUse{
traitUse := &ast.StmtTraitUse{
Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $3),
UseTkn: $1,
Traits: $2.(*ast.ParserSeparatedList).Items,
SeparatorTkns: $2.(*ast.ParserSeparatedList).SeparatorTkns,
Adaptations: $3,
}
switch n := $3.(type) {
case *ast.TraitAdaptationList :
traitUse.OpenCurlyBracketTkn = n.OpenCurlyBracketTkn
traitUse.Adaptations = n.Adaptations
traitUse.CloseCurlyBracketTkn = n.CloseCurlyBracketTkn
case *ast.StmtNop :
traitUse.SemiColonTkn = n.SemiColonTkn
};
$$ = traitUse
}
| method_modifiers T_FUNCTION returns_ref identifier backup_doc_comment '(' parameter_list ')' return_type method_body
{
@ -2032,7 +2042,7 @@ trait_adaptations:
}
| '{' '}'
{
$$ = &ast.StmtTraitAdaptationList{
$$ = &ast.TraitAdaptationList{
Position: yylex.(*Parser).builder.NewTokensPosition($1, $2),
OpenCurlyBracketTkn: $1,
CloseCurlyBracketTkn: $2,
@ -2040,7 +2050,7 @@ trait_adaptations:
}
| '{' trait_adaptation_list '}'
{
$$ = &ast.StmtTraitAdaptationList{
$$ = &ast.TraitAdaptationList{
Position: yylex.(*Parser).builder.NewTokensPosition($1, $3),
OpenCurlyBracketTkn: $1,
Adaptations: $2,

View File

@ -67,7 +67,6 @@ type NodeVisitor interface {
StmtSwitch(n *StmtSwitch)
StmtThrow(n *StmtThrow)
StmtTrait(n *StmtTrait)
StmtTraitAdaptationList(n *StmtTraitAdaptationList)
StmtTraitMethodRef(n *StmtTraitMethodRef)
StmtTraitUse(n *StmtTraitUse)
StmtTraitUseAlias(n *StmtTraitUseAlias)

View File

@ -945,22 +945,6 @@ func (n *StmtTrait) GetPosition() *position.Position {
return n.Position
}
// StmtTraitAdaptationList node
type StmtTraitAdaptationList struct {
Position *position.Position
OpenCurlyBracketTkn *token.Token
Adaptations []Vertex
CloseCurlyBracketTkn *token.Token
}
func (n *StmtTraitAdaptationList) Accept(v NodeVisitor) {
v.StmtTraitAdaptationList(n)
}
func (n *StmtTraitAdaptationList) GetPosition() *position.Position {
return n.Position
}
// StmtTraitMethodRef node
type StmtTraitMethodRef struct {
Position *position.Position
@ -983,7 +967,10 @@ type StmtTraitUse struct {
UseTkn *token.Token
Traits []Vertex
SeparatorTkns []*token.Token
Adaptations Vertex
OpenCurlyBracketTkn *token.Token
Adaptations []Vertex
CloseCurlyBracketTkn *token.Token
SemiColonTkn *token.Token
}
func (n *StmtTraitUse) Accept(v NodeVisitor) {
@ -2699,6 +2686,22 @@ func (n *ParserSeparatedList) GetPosition() *position.Position {
return n.Position
}
// TraitAdaptationList node
type TraitAdaptationList struct {
Position *position.Position
OpenCurlyBracketTkn *token.Token
Adaptations []Vertex
CloseCurlyBracketTkn *token.Token
}
func (n *TraitAdaptationList) Accept(v NodeVisitor) {
// do nothing
}
func (n *TraitAdaptationList) GetPosition() *position.Position {
return n.Position
}
// ArgumentList node
type ArgumentList struct {
Position *position.Position

View File

@ -812,20 +812,6 @@ func (t *DFS) Traverse(n ast.Vertex) {
}
t.visitor.Leave("Stmts", false)
}
case *ast.StmtTraitAdaptationList:
if nn == nil {
return
}
if !t.visitor.EnterNode(nn) {
return
}
if nn.Adaptations != nil {
t.visitor.Enter("Adaptations", false)
for _, c := range nn.Adaptations {
t.Traverse(c)
}
t.visitor.Leave("Adaptations", false)
}
case *ast.StmtTraitMethodRef:
if nn == nil {
return
@ -858,9 +844,11 @@ func (t *DFS) Traverse(n ast.Vertex) {
t.visitor.Leave("Traits", false)
}
if nn.Adaptations != nil {
t.visitor.Enter("Adaptations", true)
t.Traverse(nn.Adaptations)
t.visitor.Leave("Adaptations", true)
t.visitor.Enter("Adaptations", false)
for _, c := range nn.Adaptations {
t.Traverse(c)
}
t.visitor.Leave("Adaptations", false)
}
case *ast.StmtTraitUseAlias:
if nn == nil {

View File

@ -858,19 +858,6 @@ func (v *Dumper) StmtTrait(n *ast.StmtTrait) {
v.print(v.indent, "},\n")
}
func (v *Dumper) StmtTraitAdaptationList(n *ast.StmtTraitAdaptationList) {
v.print(0, "&ast.StmtTraitAdaptationList{\n")
v.indent++
v.dumpPosition(n.Position)
v.dumpToken("OpenCurlyBracketTkn", n.OpenCurlyBracketTkn)
v.dumpVertexList("Adaptations", n.Adaptations)
v.dumpToken("CloseCurlyBracketTkn", n.CloseCurlyBracketTkn)
v.indent--
v.print(v.indent, "},\n")
}
func (v *Dumper) StmtTraitMethodRef(n *ast.StmtTraitMethodRef) {
v.print(0, "&ast.StmtTraitMethodRef{\n")
v.indent++
@ -892,7 +879,10 @@ func (v *Dumper) StmtTraitUse(n *ast.StmtTraitUse) {
v.dumpToken("UseTkn", n.UseTkn)
v.dumpVertexList("Traits", n.Traits)
v.dumpTokenList("SeparatorTkns", n.SeparatorTkns)
v.dumpVertex("Adaptations", n.Adaptations)
v.dumpToken("OpenCurlyBracketTkn", n.OpenCurlyBracketTkn)
v.dumpVertexList("Adaptations", n.Adaptations)
v.dumpToken("CloseCurlyBracketTkn", n.CloseCurlyBracketTkn)
v.dumpToken("SemiColonTkn", n.SemiColonTkn)
v.indent--
v.print(v.indent, "},\n")

View File

@ -886,21 +886,6 @@ func (f *formatter) StmtTrait(n *ast.StmtTrait) {
n.CloseCurlyBracketTkn = f.newToken('}', []byte("}"))
}
func (f *formatter) StmtTraitAdaptationList(n *ast.StmtTraitAdaptationList) {
n.OpenCurlyBracketTkn = f.newToken('{', []byte("{"))
if len(n.Adaptations) > 0 {
f.indent++
f.formatStmts(&n.Adaptations)
f.indent--
f.addFreeFloating(token.T_WHITESPACE, []byte("\n"))
f.addIndent()
}
n.CloseCurlyBracketTkn = f.newToken('}', []byte("}"))
}
func (f *formatter) StmtTraitMethodRef(n *ast.StmtTraitMethodRef) {
if n.Trait != nil {
n.Trait.Accept(f)
@ -916,11 +901,27 @@ func (f *formatter) StmtTraitUse(n *ast.StmtTraitUse) {
n.SeparatorTkns = f.formatList(n.Traits, ',')
if _, ok := n.Adaptations.(*ast.StmtTraitAdaptationList); ok {
n.OpenCurlyBracketTkn = nil
n.CloseCurlyBracketTkn = nil
n.SemiColonTkn = nil
if len(n.Adaptations) > 0 {
f.addFreeFloating(token.T_WHITESPACE, []byte(" "))
n.OpenCurlyBracketTkn = f.newToken('{', []byte("{"))
if len(n.Adaptations) > 0 {
f.indent++
f.formatStmts(&n.Adaptations)
f.indent--
f.addFreeFloating(token.T_WHITESPACE, []byte("\n"))
f.addIndent()
}
n.Adaptations.Accept(f)
n.CloseCurlyBracketTkn = f.newToken('}', []byte("}"))
} else {
n.SemiColonTkn = f.newToken(';', []byte(";"))
}
}
func (f *formatter) StmtTraitUseAlias(n *ast.StmtTraitUseAlias) {

View File

@ -2503,76 +2503,6 @@ func TestFormatter_StmtTrait_Implements(t *testing.T) {
}
}
func TestFormatter_StmtTraitAdaptationList(t *testing.T) {
o := bytes.NewBufferString("")
n := &ast.StmtTraitAdaptationList{}
f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1)
n.Accept(f)
p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP)
n.Accept(p)
expected := `{}`
actual := o.String()
if expected != actual {
t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual)
}
}
func TestFormatter_StmtTraitAdaptationList_List(t *testing.T) {
o := bytes.NewBufferString("")
n := &ast.StmtTraitAdaptationList{
Adaptations: []ast.Vertex{
&ast.StmtTraitUseAlias{
Ref: &ast.StmtTraitMethodRef{
Method: &ast.Identifier{
Value: []byte("foo"),
},
},
Alias: &ast.Identifier{
Value: []byte("bar"),
},
},
&ast.StmtTraitUsePrecedence{
Ref: &ast.StmtTraitMethodRef{
Method: &ast.Identifier{
Value: []byte("foo"),
},
},
Insteadof: []ast.Vertex{
&ast.NameName{
Parts: []ast.Vertex{
&ast.NameNamePart{
Value: []byte("bar"),
},
},
},
},
},
},
}
f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1)
n.Accept(f)
p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP)
n.Accept(p)
expected := `{
foo as bar;
foo insteadof bar;
}`
actual := o.String()
if expected != actual {
t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual)
}
}
func TestFormatter_StmtTraitMethodRef(t *testing.T) {
o := bytes.NewBufferString("")
@ -2646,7 +2576,6 @@ func TestFormatter_StmtTraitUse(t *testing.T) {
},
},
},
Adaptations: &ast.StmtNop{},
}
f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1)
@ -2683,7 +2612,18 @@ func TestFormatter_StmtTraitUse_Adaptations(t *testing.T) {
},
},
},
Adaptations: &ast.StmtTraitAdaptationList{},
Adaptations: []ast.Vertex{
&ast.StmtTraitUseAlias{
Ref: &ast.StmtTraitMethodRef{
Method: &ast.Identifier{
Value: []byte("foo"),
},
},
Alias: &ast.Identifier{
Value: []byte("baz"),
},
},
},
}
f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1)
@ -2692,7 +2632,9 @@ func TestFormatter_StmtTraitUse_Adaptations(t *testing.T) {
p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP)
n.Accept(p)
expected := `use foo, bar {}`
expected := `use foo, bar {
foo as baz;
}`
actual := o.String()
if expected != actual {

View File

@ -184,8 +184,7 @@ func (nsr *NamespaceResolver) StmtTraitUse(n *ast.StmtTraitUse) {
nsr.ResolveName(t, "")
}
if adaptationList, ok := n.Adaptations.(*ast.StmtTraitAdaptationList); ok {
for _, a := range adaptationList.Adaptations {
for _, a := range n.Adaptations {
switch aa := a.(type) {
case *ast.StmtTraitUsePrecedence:
refTrait := aa.Ref.(*ast.StmtTraitMethodRef).Trait
@ -204,7 +203,6 @@ func (nsr *NamespaceResolver) StmtTraitUse(n *ast.StmtTraitUse) {
}
}
}
}
// LeaveNode is invoked after node process
func (nsr *NamespaceResolver) LeaveNode(n ast.Vertex) {

View File

@ -354,7 +354,6 @@ func TestResolveTraitUse(t *testing.T) {
nameB,
relativeNameB,
},
Adaptations: &ast.StmtTraitAdaptationList{
Adaptations: []ast.Vertex{
&ast.StmtTraitUsePrecedence{
Ref: &ast.StmtTraitMethodRef{
@ -372,7 +371,6 @@ func TestResolveTraitUse(t *testing.T) {
},
},
},
},
&ast.StmtTraitUse{
Traits: []ast.Vertex{
nameD,

View File

@ -206,10 +206,6 @@ func (v *Null) StmtTrait(_ *ast.StmtTrait) {
// do nothing
}
func (v *Null) StmtTraitAdaptationList(_ *ast.StmtTraitAdaptationList) {
// do nothing
}
func (v *Null) StmtTraitMethodRef(_ *ast.StmtTraitMethodRef) {
// do nothing
}

View File

@ -531,12 +531,6 @@ func (p *printer) StmtTrait(n *ast.StmtTrait) {
p.printToken(n.CloseCurlyBracketTkn, []byte("}"))
}
func (p *printer) StmtTraitAdaptationList(n *ast.StmtTraitAdaptationList) {
p.printToken(n.OpenCurlyBracketTkn, []byte("{"))
p.printList(n.Adaptations)
p.printToken(n.CloseCurlyBracketTkn, []byte("}"))
}
func (p *printer) StmtTraitMethodRef(n *ast.StmtTraitMethodRef) {
p.printNode(n.Trait)
p.printToken(n.DoubleColonTkn, p.ifNode(n.Trait, []byte("::")))
@ -546,7 +540,10 @@ func (p *printer) StmtTraitMethodRef(n *ast.StmtTraitMethodRef) {
func (p *printer) StmtTraitUse(n *ast.StmtTraitUse) {
p.printToken(n.UseTkn, []byte("use"))
p.printSeparatedList(n.Traits, n.SeparatorTkns, []byte(","))
p.printNode(n.Adaptations)
p.printToken(n.OpenCurlyBracketTkn, p.ifNodeList(n.Adaptations, []byte("{")))
p.printList(n.Adaptations)
p.printToken(n.CloseCurlyBracketTkn, p.ifNodeList(n.Adaptations, []byte("}")))
p.printToken(n.SemiColonTkn, p.ifNotToken(n.OpenCurlyBracketTkn, p.ifNotNodeList(n.Adaptations, []byte(";"))))
}
func (p *printer) StmtTraitUseAlias(n *ast.StmtTraitUseAlias) {

View File

@ -4339,31 +4339,6 @@ func TestPrinterPrintStmtThrow(t *testing.T) {
}
}
func TestPrinterPrintStmtTraitAdaptationList(t *testing.T) {
o := bytes.NewBufferString("")
p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP)
n := &ast.StmtTraitAdaptationList{
Adaptations: []ast.Vertex{
&ast.StmtTraitUseAlias{
Ref: &ast.StmtTraitMethodRef{
Trait: &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("Foo")}}},
Method: &ast.Identifier{Value: []byte("a")},
},
Alias: &ast.Identifier{Value: []byte("b")},
},
},
}
n.Accept(p)
expected := `{Foo::a as b;}`
actual := o.String()
if expected != actual {
t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual)
}
}
func TestPrinterPrintStmtTraitMethodRef(t *testing.T) {
o := bytes.NewBufferString("")
@ -4454,7 +4429,6 @@ func TestPrinterPrintStmtTraitUse(t *testing.T) {
&ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("Foo")}}},
&ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("Bar")}}},
},
Adaptations: &ast.StmtNop{},
}
n.Accept(p)
@ -4475,7 +4449,6 @@ func TestPrinterPrintStmtTraitAdaptations(t *testing.T) {
&ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("Foo")}}},
&ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("Bar")}}},
},
Adaptations: &ast.StmtTraitAdaptationList{
Adaptations: []ast.Vertex{
&ast.StmtTraitUseAlias{
Ref: &ast.StmtTraitMethodRef{
@ -4485,7 +4458,6 @@ func TestPrinterPrintStmtTraitAdaptations(t *testing.T) {
Alias: &ast.Identifier{Value: []byte("b")},
},
},
},
}
n.Accept(p)