1
0
mirror of https://github.com/danog/PHP-Parser.git synced 2025-01-20 12:46:47 +01:00

Move Node_Expr_FuncCallArg to Node_Arg (just like Node_Param)

This commit is contained in:
nikic 2011-09-22 20:34:35 +02:00
parent 06b7d63406
commit ee4e55dc75
9 changed files with 28 additions and 28 deletions

View File

@ -125,7 +125,7 @@ This script will have an output similar to the following:
)
)
args: array(
0: Expr_FuncCallArg(
0: Arg(
value: Scalar_String(
value: Hallo World!!!
)

View File

@ -351,12 +351,12 @@ function_call_argument_list:
;
non_empty_function_call_argument_list:
expr { init(Expr_FuncCallArg[$1, false]); }
| '&' variable { init(Expr_FuncCallArg[$2, true]); }
expr { init(Arg[$1, false]); }
| '&' variable { init(Arg[$2, true]); }
| non_empty_function_call_argument_list ',' expr
{ push($1, Expr_FuncCallArg[$3, false]); }
{ push($1, Arg[$3, false]); }
| non_empty_function_call_argument_list ',' '&' variable
{ push($1, Expr_FuncCallArg[$4, true]); }
{ push($1, Arg[$4, true]); }
;
global_var_list:

View File

@ -4,7 +4,7 @@
* @property PHPParser_Node_Expr $value Value to pass
* @property bool $byRef Whether to pass by ref
*/
class PHPParser_Node_Expr_FuncCallArg extends PHPParser_Node_Expr
class PHPParser_Node_Arg extends PHPParser_NodeAbstract
{
/**
* Constructs a function call argument node.

View File

@ -2,7 +2,7 @@
/**
* @property PHPParser_Node_Name|PHPParser_Node_Expr $name Function name
* @property PHPParser_Node_Expr_FuncCallArg[] $args Arguments
* @property PHPParser_Node_Arg[] $args Arguments
*/
class PHPParser_Node_Expr_FuncCall extends PHPParser_Node_Expr
{
@ -10,7 +10,7 @@ class PHPParser_Node_Expr_FuncCall extends PHPParser_Node_Expr
* Constructs a function call node.
*
* @param PHPParser_Node_Name|PHPParser_Node_Expr $name Function name
* @param PHPParser_Node_Expr_FuncCallArg[] $args Arguments
* @param PHPParser_Node_Arg[] $args Arguments
* @param int $line Line
* @param null|string $docComment Nearest doc comment
*/

View File

@ -1,20 +1,20 @@
<?php
/**
* @property PHPParser_Node_Expr $var Variable holding object
* @property string|PHPParser_Node_Expr $name Method name
* @property PHPParser_Node_Expr_FuncCallArg[] $args Arguments
* @property PHPParser_Node_Expr $var Variable holding object
* @property string|PHPParser_Node_Expr $name Method name
* @property PHPParser_Node_Arg[] $args Arguments
*/
class PHPParser_Node_Expr_MethodCall extends PHPParser_Node_Expr
{
/**
* Constructs a function call node.
*
* @param PHPParser_Node_Expr $var Variable holding object
* @param string|PHPParser_Node_Expr $name Method name
* @param PHPParser_Node_Expr_FuncCallArg[] $args Arguments
* @param int $line Line
* @param null|string $docComment Nearest doc comment
* @param PHPParser_Node_Expr $var Variable holding object
* @param string|PHPParser_Node_Expr $name Method name
* @param PHPParser_Node_Arg[] $args Arguments
* @param int $line Line
* @param null|string $docComment Nearest doc comment
*/
public function __construct(PHPParser_Node_Expr $var, $name, array $args = array(), $line = -1, $docComment = null) {
parent::__construct(

View File

@ -2,7 +2,7 @@
/**
* @property PHPParser_Node_Name|PHPParser_Node_Expr $class Class name
* @property PHPParser_Node_Expr_FuncCallArg[] $args Arguments
* @property PHPParser_Node_Arg[] $args Arguments
*/
class PHPParser_Node_Expr_New extends PHPParser_Node_Expr
{
@ -10,7 +10,7 @@ class PHPParser_Node_Expr_New extends PHPParser_Node_Expr
* Constructs a function call node.
*
* @param PHPParser_Node_Name|PHPParser_Node_Expr $class Class name
* @param PHPParser_Node_Expr_FuncCallArg[] $args Arguments
* @param PHPParser_Node_Arg[] $args Arguments
* @param int $line Line
* @param null|string $docComment Nearest doc comment
*/

View File

@ -3,7 +3,7 @@
/**
* @property PHPParser_Node_Name|PHPParser_Node_Expr $class Class name
* @property string|PHPParser_Node_Expr $name Method name
* @property PHPParser_Node_Expr_FuncCallArg[] $args Arguments
* @property PHPParser_Node_Arg[] $args Arguments
*/
class PHPParser_Node_Expr_StaticCall extends PHPParser_Node_Expr
{
@ -12,7 +12,7 @@ class PHPParser_Node_Expr_StaticCall extends PHPParser_Node_Expr
*
* @param PHPParser_Node_Name|PHPParser_Node_Expr $class Class name
* @param string|PHPParser_Node_Expr $name Method name
* @param PHPParser_Node_Expr_FuncCallArg[] $args Arguments
* @param PHPParser_Node_Arg[] $args Arguments
* @param int $line Line
* @param null|string $docComment Nearest doc comment
*/

View File

@ -1448,19 +1448,19 @@ class PHPParser_Parser
}
protected function yyn117($line, $docComment) {
$this->yyval = array(new PHPParser_Node_Expr_FuncCallArg($this->yyastk[$this->yysp-(1-1)], false, $line, $docComment));
$this->yyval = array(new PHPParser_Node_Arg($this->yyastk[$this->yysp-(1-1)], false, $line, $docComment));
}
protected function yyn118($line, $docComment) {
$this->yyval = array(new PHPParser_Node_Expr_FuncCallArg($this->yyastk[$this->yysp-(2-2)], true, $line, $docComment));
$this->yyval = array(new PHPParser_Node_Arg($this->yyastk[$this->yysp-(2-2)], true, $line, $docComment));
}
protected function yyn119($line, $docComment) {
$this->yyastk[$this->yysp-(3-1)][] = new PHPParser_Node_Expr_FuncCallArg($this->yyastk[$this->yysp-(3-3)], false, $line, $docComment); $this->yyval = $this->yyastk[$this->yysp-(3-1)];
$this->yyastk[$this->yysp-(3-1)][] = new PHPParser_Node_Arg($this->yyastk[$this->yysp-(3-3)], false, $line, $docComment); $this->yyval = $this->yyastk[$this->yysp-(3-1)];
}
protected function yyn120($line, $docComment) {
$this->yyastk[$this->yysp-(4-1)][] = new PHPParser_Node_Expr_FuncCallArg($this->yyastk[$this->yysp-(4-4)], true, $line, $docComment); $this->yyval = $this->yyastk[$this->yysp-(4-1)];
$this->yyastk[$this->yysp-(4-1)][] = new PHPParser_Node_Arg($this->yyastk[$this->yysp-(4-4)], true, $line, $docComment); $this->yyval = $this->yyastk[$this->yysp-(4-1)];
}
protected function yyn121($line, $docComment) {

View File

@ -16,6 +16,10 @@ class PHPParser_PrettyPrinter_Zend extends PHPParser_PrettyPrinterAbstract
. ($node->default ? ' = ' . $this->p($node->default) : '');
}
public function pArg(PHPParser_Node_Arg $node) {
return ($node->byRef ? '&' : '') . $this->p($node->value);
}
// Magic Constants
public function pScalar_ClassConst(PHPParser_Node_Scalar_ClassConst $node) {
@ -309,10 +313,6 @@ class PHPParser_PrettyPrinter_Zend extends PHPParser_PrettyPrinterAbstract
return $this->p($node->name) . '(' . $this->pCommaSeparated($node->args) . ')';
}
public function pExpr_FuncCallArg(PHPParser_Node_Expr_FuncCallArg $node) {
return ($node->byRef ? '&' : '') . $this->p($node->value);
}
public function pExpr_MethodCall(PHPParser_Node_Expr_MethodCall $node) {
return $this->p($node->var) . '->' . $this->pObjectProperty($node->name)
. '(' . $this->pCommaSeparated($node->args) . ')';