wiki:SemanticQuery/FileEntity

File (or module) entity

A file entity corresponds to an Erlang source file. This entity represents the module concept of Erlang, as modules are mapped to files, but header files also fall into this category.

Initial selectors

File entities can be referred at the start of a query by two selectors:

  • files (or modules) yields every file (or module) loaded into the refactoring database
  • @file (or @module) yields the current file (or module)

Selectors

The following selectors can be used on file entities. Note that every selector can be used on either module or header files, but some of them will give no results for headers (e.g. a header file can't export functions).

In parentheses you find the type of the result elements.

  • funs (function): returns the set of function entities defined in the file.
  • records (record): returns every record entity defined in the file.
  • macros (macro): returns the macro entities introduced in the file.
  • includes (file): returns all the file entities included in the file, either directly with a -include directive, or indirectly through an include chain.
  • included_by (file): using this selector on a particular file entity gives all the file entities that include the previous file.
  • imports (function): returns the set of function entities that are referred with an import directive in the file.
  • exports (function): returns the set of functions exported in the file.
  • specs (spec): returns the specs defined in the file.
  • typerefs (type): returns types used in the file.
  • types (type): returns types defined in the file.

Properties

These properties are defined for file entities:

  • module (boolean): gives true if the file is a module.
  • header (boolean): returns true if the file is a header (.hrl).
  • name (atom, string): gives the name of the file. In case of modules it does not contain the .erl extension to make it easier to work with module names.
  • filename (string): returns the file name as a string with the .erl extension.
  • dir (string): returns the directory containing the file.
  • path (string): returns the absolute path of the file (the directory and the complete file name).
Last modified 9 years ago Last modified on Feb 27, 2015, 1:59:51 PM