SDA SE Wiki

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

User Tools

Site Tools



lambdaT(#id, #parent, #encl, [#param_1,...], #body)

Represents a lambda expression. See the Java Language Specification. This PEF has two optional flags: omit_lambdaParameterParenthesesT and omit_lambdaParameterTypesT used for preserving syntactic suggar when regenerating source code after transformations.

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: Method declaration type, fieldT
the ID of the fact that represents the enclosing element.

[#param_1,…]: paramT
list of this lambda expression's parameters

#body: expression, blockT
ID of the expression or block element for this lambda expression

Sample Java Source

JButton button = new JButton();
button.addActionListener((ActionEvent e) -> System.out.println("button pressed"));

Its PEF Representation

localT(#Button, ..., 'button', ...).
...
callT(#Parent, ..., [#Lambda], #RefToAddActionListener, [], ...).
lambdaT(#Lambda, #Parent, #Enclosing, [#Parameter], #Body).
paramT(#Parameter, #Lambda, #RefToActionEvent 'e').             // Paramter of the lambda expression
callT(#Body, #Lambda, #Lambda, ...).                            // Sysout call (Body of the lambda expression)

AST Specification

ast_node_type_spec(lambdaT,[
	ast_arg(id,	 mult(1,1,no ), id, [lambdaT]),
	ast_arg(parent,  mult(1,1,no ), id, [id]),
	ast_arg(encl,    mult(1,1,no ), id, [method_declaration_type, fieldT]),
	ast_arg(params,  mult(0,*,ord), id, [paramT]),
	ast_arg(body,    mult(1,1,no),  id, [blockT, expressionType])
]). 
research/jtransformer/api/java/pefs/4.2/lambdat.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2019