[refactoring] update ast structure of "ClassExtends", "ClassImplements", "InterfaceExtends", "StmtTraitUse" and "StmtTraitUsePrecedence" nodes
This commit is contained in:
parent
fe2e097d8f
commit
4c54c56af5
BIN
internal/php5/php5.go
generated
BIN
internal/php5/php5.go
generated
Binary file not shown.
@ -18,9 +18,6 @@ import (
|
||||
list []ast.Vertex
|
||||
simpleIndirectReference simpleIndirectReference
|
||||
|
||||
ClassExtends *ast.StmtClassExtends
|
||||
ClassImplements *ast.StmtClassImplements
|
||||
InterfaceExtends *ast.StmtInterfaceExtends
|
||||
ClosureUse *ast.ExprClosureUse
|
||||
}
|
||||
|
||||
@ -243,13 +240,12 @@ import (
|
||||
%type <node> ctor_arguments function_call_parameter_list echo_expr_list
|
||||
%type <node> trait_adaptations unset_variables declare_list
|
||||
%type <node> switch_case_list non_empty_function_call_parameter_list
|
||||
%type <node> method_body
|
||||
%type <node> method_body trait_reference_list
|
||||
%type <node> foreach_statement for_statement while_statement
|
||||
%type <node> foreach_variable foreach_optional_arg
|
||||
|
||||
%type <ClassExtends> extends_from
|
||||
%type <ClassImplements> implements_list
|
||||
%type <InterfaceExtends> interface_extends_list
|
||||
%type <node> extends_from interface_list trait_list
|
||||
%type <node> implements_list
|
||||
%type <node> interface_extends_list
|
||||
%type <ClosureUse> lexical_vars
|
||||
|
||||
%type <list> top_statement_list namespace_name use_declarations use_function_declarations use_const_declarations
|
||||
@ -258,8 +254,8 @@ import (
|
||||
%type <list> for_expr case_list catch_statement additional_catches
|
||||
%type <list> non_empty_additional_catches parameter_list non_empty_parameter_list class_statement_list
|
||||
%type <list> class_statement_list variable_modifiers method_modifiers class_variable_declaration
|
||||
%type <list> interface_list trait_list trait_adaptation_list non_empty_trait_adaptation_list
|
||||
%type <list> trait_reference_list non_empty_member_modifiers backticks_expr static_array_pair_list non_empty_static_array_pair_list
|
||||
%type <list> trait_adaptation_list non_empty_trait_adaptation_list
|
||||
%type <list> non_empty_member_modifiers backticks_expr static_array_pair_list non_empty_static_array_pair_list
|
||||
|
||||
%type <list> chaining_dereference chaining_instance_call chaining_method_or_property instance_call variable_property
|
||||
%type <list> method_or_not array_method_dereference object_property object_dim_list dynamic_class_name_variable_property
|
||||
@ -1527,13 +1523,13 @@ extends_from:
|
||||
}
|
||||
| T_EXTENDS fully_qualified_class_name
|
||||
{
|
||||
$$ = &ast.StmtClassExtends{ast.Node{}, $2};
|
||||
|
||||
// save position
|
||||
$$.GetNode().Position = position.NewTokenNodePosition($1, $2)
|
||||
|
||||
// save comments
|
||||
yylex.(*Parser).setFreeFloating($$, token.Start, $1.SkippedTokens)
|
||||
$$ = &ast.StmtClassExtends{
|
||||
Node: ast.Node{
|
||||
Position: position.NewTokenNodePosition($1, $2),
|
||||
},
|
||||
ExtendTkn: $1,
|
||||
ClassName: $2,
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
@ -1551,13 +1547,14 @@ interface_extends_list:
|
||||
}
|
||||
| T_EXTENDS interface_list
|
||||
{
|
||||
$$ = &ast.StmtInterfaceExtends{ast.Node{}, $2};
|
||||
|
||||
// save position
|
||||
$$.GetNode().Position = position.NewTokenNodeListPosition($1, $2)
|
||||
|
||||
// save comments
|
||||
yylex.(*Parser).setFreeFloating($$, token.Start, $1.SkippedTokens)
|
||||
$$ = &ast.StmtInterfaceExtends{
|
||||
Node: ast.Node{
|
||||
Position: position.NewTokenNodeListPosition($1, $2.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
ExtendsTkn: $1,
|
||||
InterfaceNames: $2.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $2.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
};
|
||||
}
|
||||
;
|
||||
|
||||
@ -1568,29 +1565,30 @@ implements_list:
|
||||
}
|
||||
| T_IMPLEMENTS interface_list
|
||||
{
|
||||
$$ = &ast.StmtClassImplements{ast.Node{}, $2};
|
||||
|
||||
// save position
|
||||
$$.GetNode().Position = position.NewTokenNodeListPosition($1, $2)
|
||||
|
||||
// save comments
|
||||
yylex.(*Parser).setFreeFloating($$, token.Start, $1.SkippedTokens)
|
||||
$$ = &ast.StmtClassImplements{
|
||||
Node: ast.Node{
|
||||
Position: position.NewTokenNodeListPosition($1, $2.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
ImplementsTkn: $1,
|
||||
InterfaceNames: $2.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $2.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
};
|
||||
}
|
||||
;
|
||||
|
||||
interface_list:
|
||||
fully_qualified_class_name
|
||||
{
|
||||
$$ = []ast.Vertex{$1}
|
||||
$$ = &ast.ParserSeparatedList{
|
||||
Items: []ast.Vertex{$1},
|
||||
}
|
||||
}
|
||||
| interface_list ',' fully_qualified_class_name
|
||||
{
|
||||
switch n := lastNode($1).(type) {
|
||||
case *ast.NameName: n.ListSeparatorTkn = $2
|
||||
case *ast.NameFullyQualified: n.ListSeparatorTkn = $2
|
||||
case *ast.NameRelative: n.ListSeparatorTkn = $2
|
||||
}
|
||||
$$ = append($1, $3)
|
||||
$1.(*ast.ParserSeparatedList).SeparatorTkns = append($1.(*ast.ParserSeparatedList).SeparatorTkns, $2)
|
||||
$1.(*ast.ParserSeparatedList).Items = append($1.(*ast.ParserSeparatedList).Items, $3)
|
||||
|
||||
$$ = $1
|
||||
}
|
||||
;
|
||||
|
||||
@ -2520,29 +2518,31 @@ class_statement:
|
||||
trait_use_statement:
|
||||
T_USE trait_list trait_adaptations
|
||||
{
|
||||
$$ = &ast.StmtTraitUse{ast.Node{}, $2, $3}
|
||||
|
||||
// save position
|
||||
$$.GetNode().Position = position.NewTokenNodePosition($1, $3)
|
||||
|
||||
// save comments
|
||||
yylex.(*Parser).setFreeFloating($$, token.Start, $1.SkippedTokens)
|
||||
$$ = &ast.StmtTraitUse{
|
||||
Node: ast.Node{
|
||||
Position: position.NewTokenNodePosition($1, $3),
|
||||
},
|
||||
UseTkn: $1,
|
||||
Traits: $2.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $2.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
Adaptations: $3,
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
trait_list:
|
||||
fully_qualified_class_name
|
||||
{
|
||||
$$ = []ast.Vertex{$1}
|
||||
$$ = &ast.ParserSeparatedList{
|
||||
Items: []ast.Vertex{$1},
|
||||
}
|
||||
}
|
||||
| trait_list ',' fully_qualified_class_name
|
||||
{
|
||||
switch n := lastNode($1).(type) {
|
||||
case *ast.NameName: n.ListSeparatorTkn = $2
|
||||
case *ast.NameFullyQualified: n.ListSeparatorTkn = $2
|
||||
case *ast.NameRelative: n.ListSeparatorTkn = $2
|
||||
}
|
||||
$$ = append($1, $3)
|
||||
$1.(*ast.ParserSeparatedList).SeparatorTkns = append($1.(*ast.ParserSeparatedList).SeparatorTkns, $2)
|
||||
$1.(*ast.ParserSeparatedList).Items = append($1.(*ast.ParserSeparatedList).Items, $3)
|
||||
|
||||
$$ = $1
|
||||
}
|
||||
;
|
||||
|
||||
@ -2612,28 +2612,31 @@ trait_adaptation_statement:
|
||||
trait_precedence:
|
||||
trait_method_reference_fully_qualified T_INSTEADOF trait_reference_list
|
||||
{
|
||||
$$ = &ast.StmtTraitUsePrecedence{ast.Node{}, $1, $3}
|
||||
|
||||
// save position
|
||||
$$.GetNode().Position = position.NewNodeNodeListPosition($1, $3)
|
||||
|
||||
// save comments
|
||||
yylex.(*Parser).MoveFreeFloating($1, $$)
|
||||
yylex.(*Parser).setFreeFloating($$, token.Ref, $2.SkippedTokens)
|
||||
$$ = &ast.StmtTraitUsePrecedence{
|
||||
Node: ast.Node{
|
||||
Position: position.NewNodeNodeListPosition($1, $3.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
Ref: $1,
|
||||
InsteadofTkn: $2,
|
||||
Insteadof: $3.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $3.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
trait_reference_list:
|
||||
fully_qualified_class_name
|
||||
{
|
||||
$$ = []ast.Vertex{$1}
|
||||
$$ = &ast.ParserSeparatedList{
|
||||
Items: []ast.Vertex{$1},
|
||||
}
|
||||
}
|
||||
| trait_reference_list ',' fully_qualified_class_name
|
||||
{
|
||||
$$ = append($1, $3)
|
||||
$1.(*ast.ParserSeparatedList).SeparatorTkns = append($1.(*ast.ParserSeparatedList).SeparatorTkns, $2)
|
||||
$1.(*ast.ParserSeparatedList).Items = append($1.(*ast.ParserSeparatedList).Items, $3)
|
||||
|
||||
// save comments
|
||||
yylex.(*Parser).setFreeFloating(lastNode($1), token.End, $2.SkippedTokens)
|
||||
$$ = $1
|
||||
}
|
||||
;
|
||||
|
||||
|
BIN
internal/php7/php7.go
generated
BIN
internal/php7/php7.go
generated
Binary file not shown.
@ -18,9 +18,6 @@ import (
|
||||
tkn *token.Token
|
||||
list []ast.Vertex
|
||||
|
||||
ClassExtends *ast.StmtClassExtends
|
||||
ClassImplements *ast.StmtClassImplements
|
||||
InterfaceExtends *ast.StmtInterfaceExtends
|
||||
ClosureUse *ast.ExprClosureUse
|
||||
}
|
||||
|
||||
@ -249,7 +246,7 @@ import (
|
||||
%type <node> exit_expr scalar lexical_var function_call member_name property_name
|
||||
%type <node> variable_class_name dereferencable_scalar constant dereferencable
|
||||
%type <node> callable_expr callable_variable static_member new_variable
|
||||
%type <node> encaps_var encaps_var_offset echo_expr_list catch_name_list
|
||||
%type <node> encaps_var encaps_var_offset echo_expr_list catch_name_list name_list
|
||||
%type <node> if_stmt const_list non_empty_argument_list
|
||||
%type <node> alt_if_stmt
|
||||
%type <node> if_stmt_without_else
|
||||
@ -265,9 +262,9 @@ import (
|
||||
%type <node> foreach_statement for_statement while_statement
|
||||
%type <node> inline_function
|
||||
%type <node> unset_variables
|
||||
%type <ClassExtends> extends_from
|
||||
%type <ClassImplements> implements_list
|
||||
%type <InterfaceExtends> interface_extends_list
|
||||
%type <node> extends_from
|
||||
%type <node> implements_list
|
||||
%type <node> interface_extends_list
|
||||
%type <ClosureUse> lexical_vars
|
||||
|
||||
%type <node> member_modifier
|
||||
@ -283,7 +280,7 @@ import (
|
||||
%type <list> array_pair_list top_statement_list
|
||||
%type <list> inner_statement_list parameter_list non_empty_parameter_list class_statement_list
|
||||
%type <list> method_modifiers variable_modifiers
|
||||
%type <list> non_empty_member_modifiers name_list class_modifiers
|
||||
%type <list> non_empty_member_modifiers class_modifiers
|
||||
|
||||
%%
|
||||
|
||||
@ -1399,13 +1396,13 @@ extends_from:
|
||||
}
|
||||
| T_EXTENDS name
|
||||
{
|
||||
$$ = &ast.StmtClassExtends{ast.Node{}, $2};
|
||||
|
||||
// save position
|
||||
$$.GetNode().Position = position.NewTokenNodePosition($1, $2)
|
||||
|
||||
// save comments
|
||||
yylex.(*Parser).setFreeFloating($$, token.Start, $1.SkippedTokens)
|
||||
$$ = &ast.StmtClassExtends{
|
||||
Node: ast.Node{
|
||||
Position: position.NewTokenNodePosition($1, $2),
|
||||
},
|
||||
ExtendTkn: $1,
|
||||
ClassName: $2,
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
@ -1416,13 +1413,14 @@ interface_extends_list:
|
||||
}
|
||||
| T_EXTENDS name_list
|
||||
{
|
||||
$$ = &ast.StmtInterfaceExtends{ast.Node{}, $2};
|
||||
|
||||
// save position
|
||||
$$.GetNode().Position = position.NewTokenNodeListPosition($1, $2)
|
||||
|
||||
// save comments
|
||||
yylex.(*Parser).setFreeFloating($$, token.Start, $1.SkippedTokens)
|
||||
$$ = &ast.StmtInterfaceExtends{
|
||||
Node: ast.Node{
|
||||
Position: position.NewTokenNodeListPosition($1, $2.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
ExtendsTkn: $1,
|
||||
InterfaceNames: $2.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $2.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
};
|
||||
}
|
||||
;
|
||||
|
||||
@ -1433,13 +1431,14 @@ implements_list:
|
||||
}
|
||||
| T_IMPLEMENTS name_list
|
||||
{
|
||||
$$ = &ast.StmtClassImplements{ast.Node{}, $2};
|
||||
|
||||
// save position
|
||||
$$.GetNode().Position = position.NewTokenNodeListPosition($1, $2)
|
||||
|
||||
// save comments
|
||||
yylex.(*Parser).setFreeFloating($$, token.Start, $1.SkippedTokens)
|
||||
$$ = &ast.StmtClassImplements{
|
||||
Node: ast.Node{
|
||||
Position: position.NewTokenNodeListPosition($1, $2.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
ImplementsTkn: $1,
|
||||
InterfaceNames: $2.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $2.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
};
|
||||
}
|
||||
;
|
||||
|
||||
@ -2223,13 +2222,15 @@ class_statement:
|
||||
}
|
||||
| T_USE name_list trait_adaptations
|
||||
{
|
||||
$$ = &ast.StmtTraitUse{ast.Node{}, $2, $3}
|
||||
|
||||
// save position
|
||||
$$.GetNode().Position = position.NewTokenNodePosition($1, $3)
|
||||
|
||||
// save comments
|
||||
yylex.(*Parser).setFreeFloating($$, token.Start, $1.SkippedTokens)
|
||||
$$ = &ast.StmtTraitUse{
|
||||
Node: ast.Node{
|
||||
Position: position.NewTokenNodePosition($1, $3),
|
||||
},
|
||||
UseTkn: $1,
|
||||
Traits: $2.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $2.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
Adaptations: $3,
|
||||
}
|
||||
}
|
||||
| method_modifiers T_FUNCTION returns_ref identifier backup_doc_comment '(' parameter_list ')' return_type method_body
|
||||
{
|
||||
@ -2269,16 +2270,16 @@ class_statement:
|
||||
name_list:
|
||||
name
|
||||
{
|
||||
$$ = []ast.Vertex{$1}
|
||||
$$ = &ast.ParserSeparatedList{
|
||||
Items: []ast.Vertex{$1},
|
||||
}
|
||||
}
|
||||
| name_list ',' name
|
||||
{
|
||||
switch n := lastNode($1).(type) {
|
||||
case *ast.NameName: n.ListSeparatorTkn = $2
|
||||
case *ast.NameFullyQualified: n.ListSeparatorTkn = $2
|
||||
case *ast.NameRelative: n.ListSeparatorTkn = $2
|
||||
}
|
||||
$$ = append($1, $3)
|
||||
$1.(*ast.ParserSeparatedList).SeparatorTkns = append($1.(*ast.ParserSeparatedList).SeparatorTkns, $2)
|
||||
$1.(*ast.ParserSeparatedList).Items = append($1.(*ast.ParserSeparatedList).Items, $3)
|
||||
|
||||
$$ = $1
|
||||
}
|
||||
;
|
||||
|
||||
@ -2347,14 +2348,15 @@ trait_adaptation:
|
||||
trait_precedence:
|
||||
absolute_trait_method_reference T_INSTEADOF name_list
|
||||
{
|
||||
$$ = &ast.StmtTraitUsePrecedence{ast.Node{}, $1, $3}
|
||||
|
||||
// save position
|
||||
$$.GetNode().Position = position.NewNodeNodeListPosition($1, $3)
|
||||
|
||||
// save comments
|
||||
yylex.(*Parser).MoveFreeFloating($1, $$)
|
||||
yylex.(*Parser).setFreeFloating($$, token.Ref, $2.SkippedTokens)
|
||||
$$ = &ast.StmtTraitUsePrecedence{
|
||||
Node: ast.Node{
|
||||
Position: position.NewNodeNodeListPosition($1, $3.(*ast.ParserSeparatedList).Items),
|
||||
},
|
||||
Ref: $1,
|
||||
InsteadofTkn: $2,
|
||||
Insteadof: $3.(*ast.ParserSeparatedList).Items,
|
||||
SeparatorTkns: $3.(*ast.ParserSeparatedList).SeparatorTkns,
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
|
@ -242,8 +242,8 @@ type StmtClass struct {
|
||||
ClassTkn *token.Token
|
||||
ClassName Vertex
|
||||
ArgumentList Vertex
|
||||
Extends *StmtClassExtends
|
||||
Implements *StmtClassImplements
|
||||
Extends Vertex
|
||||
Implements Vertex
|
||||
OpenCurlyBracket *token.Token
|
||||
Stmts []Vertex
|
||||
CloseCurlyBracket *token.Token
|
||||
@ -269,6 +269,7 @@ func (n *StmtClassConstList) Accept(v NodeVisitor) {
|
||||
// StmtClassExtends node
|
||||
type StmtClassExtends struct {
|
||||
Node
|
||||
ExtendTkn *token.Token
|
||||
ClassName Vertex
|
||||
}
|
||||
|
||||
@ -279,7 +280,9 @@ func (n *StmtClassExtends) Accept(v NodeVisitor) {
|
||||
// StmtClassImplements node
|
||||
type StmtClassImplements struct {
|
||||
Node
|
||||
ImplementsTkn *token.Token
|
||||
InterfaceNames []Vertex
|
||||
SeparatorTkns []*token.Token
|
||||
}
|
||||
|
||||
func (n *StmtClassImplements) Accept(v NodeVisitor) {
|
||||
@ -582,7 +585,7 @@ func (n *StmtInlineHtml) Accept(v NodeVisitor) {
|
||||
type StmtInterface struct {
|
||||
Node
|
||||
InterfaceName Vertex
|
||||
Extends *StmtInterfaceExtends
|
||||
Extends Vertex
|
||||
Stmts []Vertex
|
||||
}
|
||||
|
||||
@ -593,7 +596,9 @@ func (n *StmtInterface) Accept(v NodeVisitor) {
|
||||
// StmtInterfaceExtends node
|
||||
type StmtInterfaceExtends struct {
|
||||
Node
|
||||
ExtendsTkn *token.Token
|
||||
InterfaceNames []Vertex
|
||||
SeparatorTkns []*token.Token
|
||||
}
|
||||
|
||||
func (n *StmtInterfaceExtends) Accept(v NodeVisitor) {
|
||||
@ -746,8 +751,8 @@ type StmtTrait struct {
|
||||
Node
|
||||
TraitTkn *token.Token
|
||||
TraitName Vertex
|
||||
Extends *StmtClassExtends
|
||||
Implements *StmtClassImplements
|
||||
Extends Vertex
|
||||
Implements Vertex
|
||||
OpenCurlyBracket *token.Token
|
||||
Stmts []Vertex
|
||||
CloseCurlyBracket *token.Token
|
||||
@ -781,8 +786,10 @@ func (n *StmtTraitMethodRef) Accept(v NodeVisitor) {
|
||||
// StmtTraitUse node
|
||||
type StmtTraitUse struct {
|
||||
Node
|
||||
Traits []Vertex
|
||||
TraitAdaptationList Vertex
|
||||
UseTkn *token.Token
|
||||
Traits []Vertex
|
||||
SeparatorTkns []*token.Token
|
||||
Adaptations Vertex
|
||||
}
|
||||
|
||||
func (n *StmtTraitUse) Accept(v NodeVisitor) {
|
||||
@ -804,8 +811,10 @@ func (n *StmtTraitUseAlias) Accept(v NodeVisitor) {
|
||||
// StmtTraitUsePrecedence node
|
||||
type StmtTraitUsePrecedence struct {
|
||||
Node
|
||||
Ref Vertex
|
||||
Insteadof []Vertex
|
||||
Ref Vertex
|
||||
InsteadofTkn *token.Token
|
||||
Insteadof []Vertex
|
||||
SeparatorTkns []*token.Token
|
||||
}
|
||||
|
||||
func (n *StmtTraitUsePrecedence) Accept(v NodeVisitor) {
|
||||
|
@ -893,10 +893,10 @@ func (t *DFS) Traverse(n ast.Vertex) {
|
||||
}
|
||||
t.visitor.Leave("Traits", false)
|
||||
}
|
||||
if nn.TraitAdaptationList != nil {
|
||||
t.visitor.Enter("TraitAdaptationList", true)
|
||||
t.Traverse(nn.TraitAdaptationList)
|
||||
t.visitor.Leave("TraitAdaptationList", true)
|
||||
if nn.Adaptations != nil {
|
||||
t.visitor.Enter("Adaptations", true)
|
||||
t.Traverse(nn.Adaptations)
|
||||
t.visitor.Leave("Adaptations", true)
|
||||
}
|
||||
case *ast.StmtTraitUseAlias:
|
||||
if nn == nil {
|
||||
|
@ -73,11 +73,11 @@ func (nsr *NamespaceResolver) StmtGroupUse(n *ast.StmtGroupUse) {
|
||||
|
||||
func (nsr *NamespaceResolver) StmtClass(n *ast.StmtClass) {
|
||||
if n.Extends != nil {
|
||||
nsr.ResolveName(n.Extends.ClassName, "")
|
||||
nsr.ResolveName(n.Extends.(*ast.StmtClassExtends).ClassName, "")
|
||||
}
|
||||
|
||||
if n.Implements != nil {
|
||||
for _, interfaceName := range n.Implements.InterfaceNames {
|
||||
for _, interfaceName := range n.Implements.(*ast.StmtClassImplements).InterfaceNames {
|
||||
nsr.ResolveName(interfaceName, "")
|
||||
}
|
||||
}
|
||||
@ -89,7 +89,7 @@ func (nsr *NamespaceResolver) StmtClass(n *ast.StmtClass) {
|
||||
|
||||
func (nsr *NamespaceResolver) StmtInterface(n *ast.StmtInterface) {
|
||||
if n.Extends != nil {
|
||||
for _, interfaceName := range n.Extends.InterfaceNames {
|
||||
for _, interfaceName := range n.Extends.(*ast.StmtInterfaceExtends).InterfaceNames {
|
||||
nsr.ResolveName(interfaceName, "")
|
||||
}
|
||||
}
|
||||
@ -184,7 +184,7 @@ func (nsr *NamespaceResolver) StmtTraitUse(n *ast.StmtTraitUse) {
|
||||
nsr.ResolveName(t, "")
|
||||
}
|
||||
|
||||
if adaptationList, ok := n.TraitAdaptationList.(*ast.StmtTraitAdaptationList); ok {
|
||||
if adaptationList, ok := n.Adaptations.(*ast.StmtTraitAdaptationList); ok {
|
||||
for _, a := range adaptationList.Adaptations {
|
||||
switch aa := a.(type) {
|
||||
case *ast.StmtTraitUsePrecedence:
|
||||
|
@ -1482,12 +1482,12 @@ func (p *PrettyPrinter) printStmtClass(n ast.Vertex) {
|
||||
|
||||
if nn.Extends != nil {
|
||||
io.WriteString(p.w, " extends ")
|
||||
p.Print(nn.Extends.ClassName)
|
||||
p.Print(nn.Extends.(*ast.StmtClassExtends).ClassName)
|
||||
}
|
||||
|
||||
if nn.Implements != nil {
|
||||
io.WriteString(p.w, " implements ")
|
||||
p.joinPrint(", ", nn.Implements.InterfaceNames)
|
||||
p.joinPrint(", ", nn.Implements.(*ast.StmtClassImplements).InterfaceNames)
|
||||
}
|
||||
|
||||
io.WriteString(p.w, "\n")
|
||||
@ -1888,7 +1888,7 @@ func (p *PrettyPrinter) printStmtInterface(n ast.Vertex) {
|
||||
|
||||
if nn.Extends != nil {
|
||||
io.WriteString(p.w, " extends ")
|
||||
p.joinPrint(", ", nn.Extends.InterfaceNames)
|
||||
p.joinPrint(", ", nn.Extends.(*ast.StmtInterfaceExtends).InterfaceNames)
|
||||
}
|
||||
|
||||
io.WriteString(p.w, "\n")
|
||||
@ -2073,7 +2073,7 @@ func (p *PrettyPrinter) printStmtTraitUse(n ast.Vertex) {
|
||||
io.WriteString(p.w, "use ")
|
||||
p.joinPrint(", ", nn.Traits)
|
||||
|
||||
if adaptationList, ok := nn.TraitAdaptationList.(*ast.StmtTraitAdaptationList); ok {
|
||||
if adaptationList, ok := nn.Adaptations.(*ast.StmtTraitAdaptationList); ok {
|
||||
adaptations := adaptationList.Adaptations
|
||||
io.WriteString(p.w, " {\n")
|
||||
p.printNodes(adaptations)
|
||||
|
@ -2108,7 +2108,7 @@ func (p *Printer) printStmtClass(n ast.Vertex) {
|
||||
}
|
||||
p.write([]byte("extends"))
|
||||
p.bufStart = " "
|
||||
p.Print(nn.Extends.ClassName)
|
||||
p.Print(nn.Extends.(*ast.StmtClassExtends).ClassName)
|
||||
}
|
||||
|
||||
if nn.Implements != nil {
|
||||
@ -2118,7 +2118,7 @@ func (p *Printer) printStmtClass(n ast.Vertex) {
|
||||
}
|
||||
p.write([]byte("implements"))
|
||||
p.bufStart = " "
|
||||
p.joinPrintRefactored(",", nn.Implements.InterfaceNames)
|
||||
p.joinPrintRefactored(",", nn.Implements.(*ast.StmtClassImplements).InterfaceNames)
|
||||
|
||||
}
|
||||
|
||||
@ -2503,7 +2503,7 @@ func (p *Printer) printStmtInterface(n ast.Vertex) {
|
||||
}
|
||||
p.write([]byte("extends"))
|
||||
p.bufStart = " "
|
||||
p.joinPrintRefactored(",", nn.Extends.InterfaceNames)
|
||||
p.joinPrintRefactored(",", nn.Extends.(*ast.StmtInterfaceExtends).InterfaceNames)
|
||||
}
|
||||
|
||||
p.printFreeFloating(nn, token.Name)
|
||||
@ -2755,7 +2755,7 @@ func (p *Printer) printStmtTraitUse(n ast.Vertex) {
|
||||
p.bufStart = " "
|
||||
p.joinPrintRefactored(",", nn.Traits)
|
||||
|
||||
p.Print(nn.TraitAdaptationList)
|
||||
p.Print(nn.Adaptations)
|
||||
|
||||
p.printFreeFloating(nn, token.End)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user