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