[phc-general] added constructor for AST_method_invocation

Satyam Satyam at satyam.com.ar
Sat Aug 5 17:04:13 CEST 2006

I added one constructor to AST_method_invocation:

 AST_method_invocation(const char* target, const char* name, AST_expr* arg)
  this->target = new Token_class_name(new String(target));
  this->method_name = new Token_method_name(new String(name));
  this->actual_parameters = new AST_actual_parameter_list;
  this->actual_parameters->push_back(new AST_actual_parameter(false, arg));

Actually, I thought about changing the other constructors so that instead of 
assigning NULL to the target, they would have:

  this->target = new Token_class_name(new String("%STDLIB%"));

but I wasn't sure what this could break elsewhere, specifically when 
building patterns for match() and, after all, the target might be %MAIN%.

I add a lots of calls to PHP's echo() and it is a drag to have first to 
assign almost all of the method invocation node to a variable to be able to 
set the target separately, and then create an eval_expr with it to 
push_back() to the output statement list.  In this way, I can create a 
complete simple method_invocation.

I must add that leaving target with NULL gave me Segmentation fault errors, 
that's how it all started.

Since I have a different phc.tea and php_parser.ypp due to my extended 
instructions, I still have to keep my copy different from that of the 
release, but I think it might not be a bad addition.


More information about the phc-general mailing list