Differences

This shows you the differences between two versions of the page.

Link to this comparison view

research:jtransformer:api:java:pefs:4.2:methodt [2018/05/09 01:59] (current)
Line 1: Line 1:
 +{{page>​prologast_bodypef_index&​fullpage&​nofooter}}
 +----
 +
 +=== methodT(#​id,​ #class, '​name',​ [#​param_1,​...],​ #type, [#​exception_1,​...],​ [#​typeparam_1,​...],​ #​body) ​ ===
 +
 +Represents the declaration of a method. Static methods have an additional fact ''​[[modifiert|modifierT]](ID,​ MethodId, '​static'​)''​. Note that (since JT 2.8) constructors are represented separately by [[constructort|constructorT]] facts and static initializers are represented by [[classinitializert|classInitializerT]] ​ facts (see [[..:​..:​migration:​start|migration]] tips).
 +
 +Changed in JT 2.8: Up to 2.8.0 it was part of [[..:​old:​methoddeft|methodDefT]].
 +
 +=== Arguments ===
 +== ==
 +**#id:** id\\ 
 +the unique ID of this method.
 +
 +**#class:** [[classt|classT]]\\ ​
 +the ID of the class containing this method. ​
 +
 +**'​name':​** atom\\ ​
 +the name of the declared method
 +
 +**[#​param_1,​...]:​** [[paramt|paramT]]\\ ​
 +the list of IDs of the method parameters. ​
 +
 +**#type:** a [[typeinst]]\\ ​
 +the id of the return type of the method
 +
 +**[#​exception_1,​...]:​** [[classt|classT]],​ [[typeparamt|typeParamT]]\\ ​
 +list of IDs of checked exceptions thrown by this method.
 +
 +**[#​typeparam_1,​...]:​** [[typeparamt|typeParamT]]\\ ​
 +the list of IDs of the type parameters. ​
 +
 +**#body:** [[blockt|blockT]] or '​null'​\\ ​
 +ID of the block containing the method body
 +
 +=== Sample Java Source ===
 +== ==
 +<Code lang-java>​
 +class HelloWorld ​ {                        // -> classT below
 +  public static void main(String[] args)   // -> methodT and modifierT below
 +  {                                        // -> blockT below
 +    System.out.println("​Hello World!"​); ​   // omitted below
 +  }
 +}
 +</​Code>​
 +
 +
 +=== Its PEF Representation ===
 +==  ==
 +<Code lang-prolog>​
 +classT(#​class,​ #​compilationUnit,​ '​HelloWorld',​ [..., #​meth]). ​
 +methodT(#​meth,​ #class, '​main',​ [#param], #type, [], [], #body).
 +modifierT(#​meth,'​static'​).
 +paramT(#​param,​ ...).
 +blockT(#​body,​ #meth, #meth, [#​printStatement]).
 +...
 +
 +</​Code>​
 +
 +=== AST Specification ===
 +== ==
 +<​Code>​
 +ast_node_type_spec(methodT,​[
 +     ​ast_arg(id, ​     mult(1,1,no ), id,  [methodT]),
 +     ​ast_arg(parent, ​ mult(1,1,no ), id,  [classT]), ​
 +     ​ast_arg(name, ​   mult(1,1,no ), attr,​[atomic]),​
 +     ​ast_arg(params, ​ mult(0,​*,​ord),​ id,  [paramT]),
 +     ​ast_arg(type, ​   mult(1,​1,​no), ​ id,  [type_inst]),  ​
 +     ​ast_arg(excepts,​ mult(0,​*,​ord),​ id,  [classT, typeParamT]),​
 +     ​ast_arg(paramRef,​mult(1,​*,​ord ),id,  [typeParamT]),​
 +     ​ast_arg(body, ​   mult(0,​1,​no), ​ id,  [blockT,​nullType])
 +]).
 +</​Code>​
  
research/jtransformer/api/java/pefs/4.2/methodt.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2019