This repository was archived by the owner on Sep 12, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +41
-1
lines changed
Expand file tree Collapse file tree 3 files changed +41
-1
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ module PHP
1212 autoload :Interface , 'php/syntax/interface'
1313 autoload :Literal , 'php/syntax/literal'
1414 autoload :Loop , 'php/syntax/loop'
15+ autoload :Method , 'php/syntax/method'
1516 autoload :Namespace , 'php/syntax/namespace'
1617 autoload :Node , 'php/syntax/node'
1718 autoload :Operator , 'php/syntax/operator'
Original file line number Diff line number Diff line change @@ -213,7 +213,7 @@ def process_call(exp) # FIXME
213213 if op = Operator . for ( method )
214214 op . new ( process ( receiver ) , *process ( arglist ) )
215215 else
216- raise NotImplementedError . new ( exp . inspect ) # TODO: Method::Call.new(receiver, method, *arglist)
216+ Method ::Call . new ( process ( receiver ) , method , *process ( arglist ) )
217217 end
218218 end
219219 end
Original file line number Diff line number Diff line change 1+ module PHP
2+ ##
3+ # @see http://www.php.net/manual/en/language.oop5.php
4+ class Method < Expression
5+ ##
6+ # @see http://www.php.net/manual/en/language.oop5.php
7+ class Call < Expression
8+ ##
9+ # @return [Expression]
10+ attr_accessor :receiver
11+
12+ ##
13+ # @return [Symbol]
14+ attr_accessor :method
15+
16+ ##
17+ # @return [Array<Expression>]
18+ attr_accessor :arguments
19+
20+ ##
21+ # @param [Expression] receiver
22+ # @param [Symbol, #to_s] method
23+ # @param [Array<Expression>] arguments
24+ def initialize ( receiver , method , *arguments )
25+ @receiver = receiver
26+ @method = Identifier . new ( method ) . to_sym
27+ @arguments = arguments
28+ end
29+
30+ ##
31+ # Returns the PHP representation of this method call.
32+ #
33+ # @return [String]
34+ def to_php
35+ "#{ receiver } ->#{ method } (#{ arguments . join ( ', ' ) } )"
36+ end
37+ end
38+ end
39+ end
You can’t perform that action at this time.
0 commit comments