|
|
Re: ExtendedVariableReference and CallHolder vs. CallExpression and MethodCallExpression [message #26218 is a reply to message #26177] |
Thu, 19 June 2008 08:29 |
Alex Panchenko Messages: 342 Registered: July 2009 |
Senior Member |
|
|
Hi Chuck,
CallExpression is part of the dltk.core, but ExtendedVariableReference
and CallHolder are specific to the python.
The framework declare base classes for the AST to allow core support for
common functionality - search, outline, call & type hierarchies, etc.
In case of the CallExpression the implicit "this" parameter is usually
stored as null to the receiver. In scripting languages it is usually
impossible to distinguish instance vs static methods during parsing
phase, so it is implemented that way.
For example, the expression
print("hello")
will have:
receiver=null
name=SimpleReference("print")
args=[StringLiteral("hello")]
and the expression
output.print("hello")
will be
receiver=VariableReference("output")
name=SimpleReference("print")
args=[StringLiteral("hello")]
The receiver is declared as ASTNode because it is the base case in the
hierarchy. The situation with Statement/Expression is complex because
various languages have different notions of what an 'expression' and a
'statement' are. Probably we will merge this classes in the future. The
ASTNode is the most general case. The future of the AST class hierarchy
is often discussed, so this is not the "final" solution, it can (and
most probably will) be changed at some time.
Regards,
Alex
Chuck Doucette wrote:
> Also, if I do try to use CallExpression instead of CallHolder (which only
> holds the arguments),
> what is the receiver - is it the object that you are operating on, i.e.
> this, whose type defines the method? In CallExpression, it is an ASTNode. I
> would have thought it would be an expression instead.
>
> Chuck
>
> "Chuck Doucette" <cdoucette@vaultus.com> wrote in message
> news:g3bc5r$u8c$1@build.eclipse.org...
>> Your full sample editor uses ExtendedVariableReference and CallHolder,
>> but other internal code appears to use CallExpression and
>> MethodCallExpression instead.
>> Should I switch my code to be using CallExpression/MethodCallExpression
>> instead?
>>
>> Chuck
|
|
|
Powered by
FUDForum. Page generated in 0.02987 seconds