tryT (#id, #parent, #encl, [#resource_1,...], #body, [#catcher_1,...], #finalizer)

Represents the try statement.

Arguments

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

#parent: id
ID of the parent node.

#encl: methodT, constructorT, classInitializerT
ID of the enclosing method declaration.

[#resource_1,…]: localT
list of the initializations for a try-with-resources.

#body: blockT
ID of the body, guarded by the try-catch statement.

[#catcher_1,…]: catchT
list of the exception catchers.

#finalizer: blockT,null
ID of the block containing the statements of the finally part.

Sample Java Source

void myTryCatch() {
	String filename = "/Users/myfilename";
	try { // corresponding code line to tryT
		new File(filename).createNewFile();
	} catch (IOException e) {//catchT
		System.out.println("Unable to create " + filename + ": "+ e.getMessage());
	}
}

Its PEF Representation

tryT(#id, #parent, #enclMethod, #body, [#catcher_1], 'null').
blockT(#parent, #enclMethod, #enclMethod, [..., #id]).
methodT(#enclMethod, ..., 'myTryCatch', [], type(basic, void, 0), [], #parent).
blockT(#body, #id, #enclMethod, [...]).
catchT(#catcher_1, #id, #enclMethod, ..., ...).

AST Specification

ast_node_type_spec(tryT,[
     ast_arg(id,     mult(1,1,no ), id, [tryT]),
     ast_arg(parent, mult(1,1,no ), id, [id]),
     ast_arg(encl,   mult(1,1,no ), id, [methodT, constructorT, classInitializerT]),
     ast_arg(inits,  mult(0,*,ord), id, [localT]),
     ast_arg(block,  mult(1,1,no ), id, [blockT]),
     ast_arg(catchers,mult(1,*,ord), id, [catchT]),
     ast_arg(finalize,mult(0,1,no), id, [blockT, nullType])
]).
research/jtransformer/api/java/pefs/4.2/tryt.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2019