= Function entity = Function entities correspond to Erlang functions. Function entities come from two sources: they are either defined in a source file that is loaded into the database, or they are referred in the loaded code, but their definition is not known. In the latter case, some information about the function is not available. == Initial selector == * {{{@fun}}} at the start of a query, this selector can be used to refer to the current function (either the function called by the selected expression, or the function being defined at the current selection). == Selectors == ''After the name of the selector between parentheses you can find the type of the elements in the resulted set.'' * {{{refs}}} (''expression''): returns every expression that refers to the function. These references can be function applications, import/export directives and implicit function expressions. * {{{dynref}}} (''expression''): returns every expression that refers to the function through a dynamic function call (e.g. an {{{apply}}} call, for details see [wiki:DynFunAnal]. We note here, that you should run the dynamic call analysis at first, otherwise the result will be empty. * {{{calls}}} (''function''): returns the set of function entities called in the body of the function. * {{{dyncalls}}} (''function''): returns the set of functions called in body of the function dynamically (for details, see [wiki:DynFunAnal]). * {{{called_by}}} (''function''): returns every function that refers to the specific function, either by application or implicit call. * {{{dyn_calledby}}} (''function''): returns the set of functions that calls the given function dynamically (for details, see [wiki:DynFunAnal]). * {{{args}}} (''expression''): gives the function arguments as a list of expression entities. * {{{body}}} (''expression''): returns the top-level expressions of each clause body. * {{{exprs}}} (''expression''): returns the top-level argument, guard, and body expressions of each clause. * {{{vars}}} (''variable''): returns the set of variable entities defined (binded) in the bodies of the function. * {{{file}}} (''file''): returns the file entity that the given function is defined in. == Properties == The following properties are defined on function entities: * {{{name}}} (''atom, string''): gives the name of the function. * {{{exported}}} (''bool''): returns true if the function is exported. * {{{arity}}} (''int''): gives the arity (number of arguments). * {{{bif}}} (''bool''): returns true if the function is an auto-imported built-in function. * {{{pure}}} (''bool''): returns true if the function is free of [wiki:SideEffect side-effects]. We have to mention here, that those functions that are not loaded into the database of !RefactorErl (for example, library functions) are considered as impure. If you need a more precise analysis, you should add the affected files to the database of !RefactorErl. The knowledge about the BIF-s is built into the tool. * {{{dirty}}} (''bool''): returns true if the function has [wiki:SideEffect side-effect]. * {{{defined}}} (''bool''): returns true if the definition of the function is loaded into the refactoring software. * {{{module}}} (''atom''): returns the name of the containing module. * {{{spec}}} (''string''): returns the specification of the function (If it is not available in the source code, !RefactorErl calculates it.)