callT(#id, #parent, #encl, #expr, [#arg_1,...], #method, [#type_param_1,...], #type)

Represents a method invocation.

History
  • Removed “name” argument in JTransformer 4.0
  • Renamed from applyT to call T in JTransformer 2.3.1

Arguments

#id: id
the unique ID assigned to this fact.

#parent: id
the ID of the fact that represents the parent of this fact in the prolog AST.

#encl: methodT, constructorT, classInitializerT, fieldT
the ID of the fact that represents the enclosing element.

#receiver: expression, staticTypeRefT, null
the ID of the fact representing the receiver expression on which the method is invoked. If the receiver is an implicit this the value of #receiver is null. In case of static method call #expr is a staticTypeRefT.

[#arg_1,…]: expression
list of IDs of other facts representing the arguments of this method invocation.

#method: methodT, constructorT, annotationMemberT
ID of the methodT, constructorT or annotationMemberT fact that represents the declaration of the invoked method in the static type of the receiver expression. Because of dynamic binding the method actually invoked at run-time might be another one.

[#type_param_1,…]: Type reference, wildcardT
list of IDs of the type parameters of this call.

#type: Type reference, wildcardT, null
type that is returned by the called method (in case of type parameters this might be different from the method's type). The constant 'null' is the return of a constructor (constructorT).

Sample Java Source

m() {                                                             // Enclosing method
  ...
    this.f(1,2+3);                                                // Sample call
}

Its PEF Representation

methodT(#meth, _, 'm', [], #returntype, [], _).   // Enclosing method
...
execT(#parent, V5, #meth, V7).                                    // Parent of the call
callT(#call, #parent, #meth, #recv, [#first, #second], #f, FIXME, FIXME).       // Call
identT(#recv, #call, #meth, this).                                // Call target
literalT(#first, #call, #meth, #literaltype, '1').                // First argument
operationT(#second, #call, #meth, [..., ...], '+', 0).            // Second argument

AST Specification

ast_node_type_spec('Java',callT,[
     ast_arg(id,         mult(1,1,no ),  id,   [callT]), % <-- convention!!!
     ast_arg(parent,     mult(1,1,no ),  id,   [id]),
     ast_arg(encl,       mult(1,1,no ),  id,   [methodT, constructorT, classInitializerT,fieldT]),
     ast_arg(receiver,   mult(0,1,no),   id,   [expressionType, nullType, staticTypeRefT]),
     ast_arg(args,       mult(0,*,ord ), id,   [expressionType]),
     ast_arg(ref,        mult(1,1,no ),  id,   [methodT, constructorT, annotationMemberT]),
     ast_arg(typeParams, mult(0,*,ord), id,  [type_inst, wildcardT]),
     ast_arg(type,       mult(1,1,no ), id,  [type_inst, wildcardT, nullType])
 ]). 
research/jtransformer/api/java/pefs/4.0/callt.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2019