SDA SE Wiki

Software Engineering for Smart Data Analytics & Smart Data Analytics for Software Engineering

User Tools

Site Tools



newArrayT (#id, #parent, #encl, [#dim_1,...], [#elem_1,...], #type)

Represents the array creation expression.
Optionally marked with an preserve_omitArrayDeclarationT.

Arguments

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

#parent: id
ID of the parent node.

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

[#dim_1,…]: expression
list of dimension expressions.

[#elem_1,…]: expression, annotationExpressionType
list of initial elements of this array.

#type: Type reference
the id of the type of this array.

Sample Java Code

void myArrayAcces(){
	int[] array = {1, 3, 8};//corresponding code line to newArrayt
	array[0]= 9;
}

Its PEF Representation

methodDefT(#encl, ..., 'myArrayAcces', [], #returntype, [], ...).
localDefT(#parent, ..., #encl, type(basic, int, 1), 'array', #id).
newArrayT(#id, #parent, #encl, [], [#elem_1, #elem_2, #elem_3], #newarraytype).
omitArrayDeclarationT(#id).
literalT(#elem_1, #id, #encl, #literal1type, '1').
literalT(#elem_2, #id, #encl, #literal2type, '3').
literalT(#elem_3, #id, #encl, #literal3type, '8').

AST Specification

ast_node_type_spec(newArrayT,[
     ast_arg(id,      mult(1,1,no ), id,  [newArrayT]),
     ast_arg(parent,  mult(1,1,no ), id,  [id]),
     ast_arg(encl,    mult(1,1,no ), id,  [methodT, constructorT, classInitializerT, fieldT, classT, annotationMemberT, packageT]),
     ast_arg(dims,    mult(1,*,ord), id,  [expressionType]),
     ast_arg(elems,   mult(0,*,ord), id,  [expressionType,annotationExpressionType]),
     ast_arg(type,    mult(1,1,no ), id,  [type_inst])
]).
research/jtransformer/api/java/pefs/4.0/newarrayt.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2025