identT(#id, #parent, #encl, 'name', #symbol)

Represents an access to

  1. a simple name (local variable or parameter) or
  2. 'this' or
  3. 'super' or
  4. 'null'.

in JTransformer versions < 2.6.0 identT also represented class literals, and qualified type names. Class literals are now modeled with selectT and qualified type names in static method calls and static field accesses with the new PEF typeRefT.

Arguments

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

#parent: id
ID of the parent node.

#encl: methodT, constructorT, classInitializerT, fieldT
ID of the fact that represents the method, constructor, class initializer or field definition that contains this (pseudo-)variable access.

'name': atom
'this', 'super', 'null' or any other legal identifier name

#symbol: 'null', localT, paramT, classT
'null' or ID of the referenced local variable, parameter or class. The access to 'super' references as symbol the ID of the superclass, the access to 'this' references the ID of the class of which 'this' is an instance. The access to the 'null' literal references the symbol 'null':

 identT(..., ..., ..., 'nameOfParameter', #idOfParamT). % access to parameter
 identT(..., ..., ..., 'nameOfLocalVar',  #idOfLocalT). % access to local var
 identT(..., ..., ..., 'super',       #idOfSuperclass). % access to 'super'
 identT(..., ..., ..., 'this',          #idOfOwnClass). % access to 'this'
 identT(..., ..., ..., 'null',                 'null'). % access to 'null'

Remark

Note that identT represents no field accesses. Field accesses are represented by getFieldT(#id, #parent, #encl, #receiver, 'name', #field).

Sample Java Code

public Object m(int i) {
	int j=0;
        ...
        x = i + j;
        ...
        Object o = super.abc;
        ...
        return this;
}

Its PEF Representation

For better readability IDs are represented by symbolic constants prefixed with #.

methodT(#encl, ..., 'm', [], type(basic, void, 0), [], ...).
  paramT(#symbol1, ..., type(basic, int, 0), 'i').
  localT(#symbol2, ..., #encl, type(basic, int, 0), 'j', ...).
...
operationT(#parent, ..., #encl, [#id1, #id2], '+', 0).
  identT(#id1, #parent, #encl, 'i', #symbol1).
  identT(#id2, #parent, #encl, 'j', #symbol2).
...
localT(#symbol3, ..., #encl, type(class,10001,0), 'o', #get).
  getFieldT(#get, #symbol3, #encl, #id3, abc, #abc).
    identT(#id3, #get, #encl, super, #superclass).
 
...
returnT(#retid, ..., #encl, #ident).
  identT(#ident, #retid, #encl, 'this', #classOfThis).

AST Specification

ast_node_def('Java',identT,[
     ast_arg(id,      mult(1,1,no ), id,  [identT]),
     ast_arg(parent,  mult(1,1,no ), id,  [id]),
     ast_arg(encl,    mult(1,1,no ), id,  [methodT, constructorT, classInitializerT, fieldT]),
     ast_arg(name,    mult(1,1,no ), attr,[atom]),
     ast_arg(ref,     mult(1,1,no ), id,  [classT,localT,paramT,nullType])
]).
Last modified: 2014/04/14 05:29
 
*