static_call node
This commit is contained in:
parent
f0e3206c18
commit
0751859395
45
node/expr/static_call.go
Normal file
45
node/expr/static_call.go
Normal file
@ -0,0 +1,45 @@
|
||||
package expr
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
type StaticCall struct {
|
||||
node.SimpleNode
|
||||
class node.Node
|
||||
name node.Node
|
||||
arguments []node.Node
|
||||
}
|
||||
|
||||
func NewStaticCall(class node.Node, name node.Node, arguments []node.Node) node.Node {
|
||||
return StaticCall{
|
||||
node.SimpleNode{Name: "StaticCall", Attributes: make(map[string]string)},
|
||||
class,
|
||||
name,
|
||||
arguments,
|
||||
}
|
||||
}
|
||||
|
||||
func (n StaticCall) Print(out io.Writer, indent string) {
|
||||
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name)
|
||||
|
||||
if n.class != nil {
|
||||
fmt.Fprintf(out, "\n%vclass:", indent+" ")
|
||||
n.class.Print(out, indent+" ")
|
||||
}
|
||||
|
||||
if n.name != nil {
|
||||
fmt.Fprintf(out, "\n%vname:", indent+" ")
|
||||
n.name.Print(out, indent+" ")
|
||||
}
|
||||
|
||||
if n.arguments != nil {
|
||||
fmt.Fprintf(out, "\n%varguments:", indent+" ")
|
||||
for _, nn := range n.arguments {
|
||||
nn.Print(out, indent+" ")
|
||||
}
|
||||
}
|
||||
}
|
@ -4311,13 +4311,13 @@ yydefault:
|
||||
yyDollar = yyS[yypt-4 : yypt+1]
|
||||
//line parser/parser.y:931
|
||||
{
|
||||
yyVAL.node = node.NewSimpleNode("StaticCall").Append(yyDollar[1].node).Append(yyDollar[3].node).Append(yyDollar[4].node)
|
||||
yyVAL.node = expr.NewStaticCall(yyDollar[1].node, yyDollar[3].node, yyDollar[4].node.(node.SimpleNode).Children)
|
||||
}
|
||||
case 379:
|
||||
yyDollar = yyS[yypt-4 : yypt+1]
|
||||
//line parser/parser.y:933
|
||||
{
|
||||
yyVAL.node = node.NewSimpleNode("StaticCall").Append(yyDollar[1].node).Append(yyDollar[3].node).Append(yyDollar[4].node)
|
||||
yyVAL.node = expr.NewStaticCall(yyDollar[1].node, yyDollar[3].node, yyDollar[4].node.(node.SimpleNode).Children)
|
||||
}
|
||||
case 380:
|
||||
yyDollar = yyS[yypt-2 : yypt+1]
|
||||
|
@ -928,9 +928,9 @@ lexical_var:
|
||||
function_call:
|
||||
name argument_list { $$ = expr.NewFunctionCall($1, $2.(node.SimpleNode).Children) }
|
||||
| class_name T_PAAMAYIM_NEKUDOTAYIM member_name argument_list
|
||||
{ $$ = node.NewSimpleNode("StaticCall").Append($1).Append($3).Append($4) }
|
||||
{ $$ = expr.NewStaticCall($1, $3, $4.(node.SimpleNode).Children) }
|
||||
| variable_class_name T_PAAMAYIM_NEKUDOTAYIM member_name argument_list
|
||||
{ $$ = node.NewSimpleNode("StaticCall").Append($1).Append($3).Append($4) }
|
||||
{ $$ = expr.NewStaticCall($1, $3, $4.(node.SimpleNode).Children) }
|
||||
| callable_expr argument_list { $$ = expr.NewFunctionCall($1, $2.(node.SimpleNode).Children) }
|
||||
;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user