<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="generator" content="ExDoc v0.19.1"> <title>Macro.Env – Elixir v1.7.2</title> <link rel="stylesheet" href="dist/app-240d7fc7e5.css" /> <link rel="canonical" href="https://hexdocs.pm/elixir/v1.7/Macro.Env.html" /> <script src="dist/sidebar_items-cdf4e58b19.js"></script> </head> <body data-type="modules"> <script>try { if(localStorage.getItem('night-mode')) document.body.className += ' night-mode'; } catch (e) { }</script> <div class="main"> <button class="sidebar-button sidebar-toggle"> <span class="icon-menu" aria-hidden="true"></span> <span class="sr-only">Toggle Sidebar</span> </button> <button class="sidebar-button night-mode-toggle"> <span class="icon-theme" aria-hidden="true"></span> <span class="sr-only">Toggle Theme</span> </button> <section class="sidebar"> <a href="http://elixir-lang.org/docs.html" class="sidebar-projectLink"> <div class="sidebar-projectDetails"> <h1 class="sidebar-projectName"> Elixir </h1> <h2 class="sidebar-projectVersion"> v1.7.2 </h2> </div> <img src="assets/logo.png" alt="Elixir" class="sidebar-projectImage"> </a> <form class="sidebar-search" action="search.html"> <button type="submit" class="search-button"> <span class="icon-search" aria-hidden="true"></span> </button> <input name="q" type="text" id="search-list" class="search-input" placeholder="Search" aria-label="Search" autocomplete="off" /> </form> <ul class="sidebar-listNav"> <li><a id="extras-list" href="#full-list">Pages</a></li> <li><a id="modules-list" href="#full-list">Modules</a></li> <li><a id="exceptions-list" href="#full-list">Exceptions</a></li> </ul> <div class="gradient"></div> <ul id="full-list" class="sidebar-fullList"></ul> </section> <section class="content"> <div class="content-outer"> <div id="content" class="content-inner"> <h1> <small class="visible-xs">Elixir v1.7.2</small> Macro.Env <a href="https://github.com/elixir-lang/elixir/blob/v1.7.2/lib/elixir/lib/macro/env.ex#L1" title="View Source" class="view-source" rel="help"> <span class="icon-code" aria-hidden="true"></span> <span class="sr-only">View Source</span> </a> </h1> <section id="moduledoc"> <p>A struct that holds compile time environment information.</p> <p>The current environment can be accessed at any time as <a href="Kernel.SpecialForms.html#__ENV__/0"><code class="inline">__ENV__/0</code></a>. Inside macros, the caller environment can be accessed as <a href="Kernel.SpecialForms.html#__CALLER__/0"><code class="inline">__CALLER__/0</code></a>.</p> <p>An instance of <a href="Macro.Env.html#content"><code class="inline">Macro.Env</code></a> must not be modified by hand. If you need to create a custom environment to pass to <a href="Code.html#eval_quoted/3"><code class="inline">Code.eval_quoted/3</code></a>, use the following trick:</p> <pre><code class="nohighlight makeup elixir"><span class="kd">def</span><span class="w"> </span><span class="nf">make_custom_env</span><span class="w"> </span><span class="k" data-group-id="5351214627-1">do</span><span class="w"> </span><span class="kn">import</span><span class="w"> </span><span class="nc">SomeModule</span><span class="p">,</span><span class="w"> </span><span class="ss">only</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="5351214627-2">[</span><span class="ss">some_function</span><span class="p">:</span><span class="w"> </span><span class="mi">2</span><span class="p" data-group-id="5351214627-2">]</span><span class="w"> </span><span class="kn">alias</span><span class="w"> </span><span class="nc">A.B.C</span><span class="w"> </span><span class="bp">__ENV__</span><span class="w"> </span><span class="k" data-group-id="5351214627-1">end</span></code></pre> <p>You may then call <code class="inline">make_custom_env()</code> to get a struct with the desired imports and aliases included.</p> <p>It contains the following fields:</p> <ul> <li><code class="inline">module</code> - the current module name </li> <li><code class="inline">file</code> - the current file name as a binary </li> <li><code class="inline">line</code> - the current line as an integer </li> <li><code class="inline">function</code> - a tuple as <code class="inline">{atom, integer}</code>, where the first element is the function name and the second its arity; returns <code class="inline">nil</code> if not inside a function </li> <li><code class="inline">context</code> - the context of the environment; it can be <code class="inline">nil</code> (default context), inside a guard or inside a match </li> <li><code class="inline">aliases</code> - a list of two-element tuples, where the first element is the aliased name and the second one the actual name </li> <li><code class="inline">requires</code> - the list of required modules </li> <li><code class="inline">functions</code> - a list of functions imported from each module </li> <li><code class="inline">macros</code> - a list of macros imported from each module </li> <li><code class="inline">macro_aliases</code> - a list of aliases defined inside the current macro </li> <li><code class="inline">context_modules</code> - a list of modules defined in the current context </li> <li><code class="inline">lexical_tracker</code> - PID of the lexical tracker which is responsible for keeping user info </li> </ul> <p>The following fields pertain to variable handling and must not be accessed or relied on. To get a list of all variables, see <a href="#vars/1"><code class="inline">vars/1</code></a>:</p> <ul> <li><code class="inline">current_vars</code> </li> <li><code class="inline">unused_vars</code> </li> <li><code class="inline">prematch_vars</code> </li> <li><code class="inline">contextual_vars</code> </li> </ul> <p>The following fields are deprecated and must not be accessed or relied on:</p> <ul> <li><code class="inline">vars</code> - a list keeping all defined variables as <code class="inline">{var, context}</code> </li> </ul> </section> <section id="summary" class="details-list"> <h1 class="section-heading"> <a class="hover-link" href="#summary"> <span class="icon-link" aria-hidden="true"></span> <span class="sr-only">Link to this section</span> </a> Summary </h1> <div class="summary-types summary"> <h2> <a href="#types">Types</a> </h2> <div class="summary-row"> <div class="summary-signature"> <a href="#t:aliases/0">aliases()</a> </div> </div> <div class="summary-row"> <div class="summary-signature"> <a href="#t:context/0">context()</a> </div> </div> <div class="summary-row"> <div class="summary-signature"> <a href="#t:context_modules/0">context_modules()</a> </div> </div> <div class="summary-row"> <div class="summary-signature"> <a href="#t:file/0">file()</a> </div> </div> <div class="summary-row"> <div class="summary-signature"> <a href="#t:functions/0">functions()</a> </div> </div> <div class="summary-row"> <div class="summary-signature"> <a href="#t:lexical_tracker/0">lexical_tracker()</a> </div> </div> <div class="summary-row"> <div class="summary-signature"> <a href="#t:line/0">line()</a> </div> </div> <div class="summary-row"> <div class="summary-signature"> <a href="#t:macro_aliases/0">macro_aliases()</a> </div> </div> <div class="summary-row"> <div class="summary-signature"> <a href="#t:macros/0">macros()</a> </div> </div> <div class="summary-row"> <div class="summary-signature"> <a href="#t:name_arity/0">name_arity()</a> </div> </div> <div class="summary-row"> <div class="summary-signature"> <a href="#t:requires/0">requires()</a> </div> </div> <div class="summary-row"> <div class="summary-signature"> <a href="#t:t/0">t()</a> </div> </div> <div class="summary-row"> <div class="summary-signature"> <a href="#t:var/0">var()</a> </div> </div> </div> <div class="summary-functions summary"> <h2> <a href="#functions">Functions</a> </h2> <div class="summary-row"> <div class="summary-signature"> <a href="#has_var?/2">has_var?(env, var)</a> </div> <div class="summary-synopsis"><p>Checks if a variable belongs to the environment</p> </div> </div> <div class="summary-row"> <div class="summary-signature"> <a href="#in_guard?/1">in_guard?(env)</a> </div> <div class="summary-synopsis"><p>Returns whether the compilation environment is currently inside a guard</p> </div> </div> <div class="summary-row"> <div class="summary-signature"> <a href="#in_match?/1">in_match?(env)</a> </div> <div class="summary-synopsis"><p>Returns whether the compilation environment is currently inside a match clause</p> </div> </div> <div class="summary-row"> <div class="summary-signature"> <a href="#location/1">location(env)</a> </div> <div class="summary-synopsis"><p>Returns a keyword list containing the file and line information as keys</p> </div> </div> <div class="summary-row"> <div class="summary-signature"> <a href="#stacktrace/1">stacktrace(env)</a> </div> <div class="summary-synopsis"><p>Returns the environment stacktrace</p> </div> </div> <div class="summary-row"> <div class="summary-signature"> <a href="#to_match/1">to_match(env)</a> </div> <div class="summary-synopsis"><p>Returns a <a href="Macro.Env.html#content"><code class="inline">Macro.Env</code></a> in the match context</p> </div> </div> <div class="summary-row"> <div class="summary-signature"> <a href="#vars/1">vars(env)</a> </div> <div class="summary-synopsis"><p>Returns a list of variables in the current environment</p> </div> </div> </div> </section> <section id="types" class="details-list"> <h1 class="section-heading"> <a class="hover-link" href="#types"> <span class="icon-link" aria-hidden="true"></span> <span class="sr-only">Link to this section</span> </a> Types </h1> <div class="types-list"> <div class="detail" id="t:aliases/0"> <div class="detail-header"> <a href="#t:aliases/0" class="detail-link" title="Link to this type"> <span class="icon-link" aria-hidden="true"></span> <span class="sr-only">Link to this type</span> </a> <span class="signature">aliases()</span> <a href="https://github.com/elixir-lang/elixir/blob/v1.7.2/lib/elixir/lib/macro/env.ex#L59" class="view-source" rel="help" title="View Source"> <span class="icon-code" aria-hidden="true"></span> <span class="sr-only">View Source</span> </a> <div class="specs"> <pre>aliases() :: [{<a href="typespecs.html#built-in-types">module</a>(), <a href="typespecs.html#built-in-types">module</a>()}]</pre> </div> </div> <section class="docstring"> </section> </div> <div class="detail" id="t:context/0"> <div class="detail-header"> <a href="#t:context/0" class="detail-link" title="Link to this type"> <span class="icon-link" aria-hidden="true"></span> <span class="sr-only">Link to this type</span> </a> <span class="signature">context()</span> <a href="https://github.com/elixir-lang/elixir/blob/v1.7.2/lib/elixir/lib/macro/env.ex#L61" class="view-source" rel="help" title="View Source"> <span class="icon-code" aria-hidden="true"></span> <span class="sr-only">View Source</span> </a> <div class="specs"> <pre>context() :: :match | :guard | nil</pre> </div> </div> <section class="docstring"> </section> </div> <div class="detail" id="t:context_modules/0"> <div class="detail-header"> <a href="#t:context_modules/0" class="detail-link" title="Link to this type"> <span class="icon-link" aria-hidden="true"></span> <span class="sr-only">Link to this type</span> </a> <span class="signature">context_modules()</span> <a href="https://github.com/elixir-lang/elixir/blob/v1.7.2/lib/elixir/lib/macro/env.ex#L65" class="view-source" rel="help" title="View Source"> <span class="icon-code" aria-hidden="true"></span> <span class="sr-only">View Source</span> </a> <div class="specs"> <pre>context_modules() :: [<a href="typespecs.html#built-in-types">module</a>()]</pre> </div> </div> <section class="docstring"> </section> </div> <div class="detail" id="t:file/0"> <div class="detail-header"> <a href="#t:file/0" class="detail-link" title="Link to this type"> <span class="icon-link" aria-hidden="true"></span> <span class="sr-only">Link to this type</span> </a> <span class="signature">file()</span> <a href="https://github.com/elixir-lang/elixir/blob/v1.7.2/lib/elixir/lib/macro/env.ex#L57" class="view-source" rel="help" title="View Source"> <span class="icon-code" aria-hidden="true"></span> <span class="sr-only">View Source</span> </a> <div class="specs"> <pre>file() :: <a href="typespecs.html#built-in-types">binary</a>()</pre> </div> </div> <section class="docstring"> </section> </div> <div class="detail" id="t:functions/0"> <div class="detail-header"> <a href="#t:functions/0" class="detail-link" title="Link to this type"> <span class="icon-link" aria-hidden="true"></span> <span class="sr-only">Link to this type</span> </a> <span class="signature">functions()</span> <a href="https://github.com/elixir-lang/elixir/blob/v1.7.2/lib/elixir/lib/macro/env.ex#L63" class="view-source" rel="help" title="View Source"> <span class="icon-code" aria-hidden="true"></span> <span class="sr-only">View Source</span> </a> <div class="specs"> <pre>functions() :: [{<a href="typespecs.html#built-in-types">module</a>(), [<a href="#t:name_arity/0">name_arity</a>()]}]</pre> </div> </div> <section class="docstring"> </section> </div> <div class="detail" id="t:lexical_tracker/0"> <div class="detail-header"> <a href="#t:lexical_tracker/0" class="detail-link" title="Link to this type"> <span class="icon-link" aria-hidden="true"></span> <span class="sr-only">Link to this type</span> </a> <span class="signature">lexical_tracker()</span> <a href="https://github.com/elixir-lang/elixir/blob/v1.7.2/lib/elixir/lib/macro/env.ex#L66" class="view-source" rel="help" title="View Source"> <span class="icon-code" aria-hidden="true"></span> <span class="sr-only">View Source</span> </a> <div class="specs"> <pre>lexical_tracker() :: <a href="typespecs.html#basic-types">pid</a>() | nil</pre> </div> </div> <section class="docstring"> </section> </div> <div class="detail" id="t:line/0"> <div class="detail-header"> <a href="#t:line/0" class="detail-link" title="Link to this type"> <span class="icon-link" aria-hidden="true"></span> <span class="sr-only">Link to this type</span> </a> <span class="signature">line()</span> <a href="https://github.com/elixir-lang/elixir/blob/v1.7.2/lib/elixir/lib/macro/env.ex#L58" class="view-source" rel="help" title="View Source"> <span class="icon-code" aria-hidden="true"></span> <span class="sr-only">View Source</span> </a> <div class="specs"> <pre>line() :: <a href="typespecs.html#basic-types">non_neg_integer</a>()</pre> </div> </div> <section class="docstring"> </section> </div> <div class="detail" id="t:macro_aliases/0"> <div class="detail-header"> <a href="#t:macro_aliases/0" class="detail-link" title="Link to this type"> <span class="icon-link" aria-hidden="true"></span> <span class="sr-only">Link to this type</span> </a> <span class="signature">macro_aliases()</span> <a href="https://github.com/elixir-lang/elixir/blob/v1.7.2/lib/elixir/lib/macro/env.ex#L60" class="view-source" rel="help" title="View Source"> <span class="icon-code" aria-hidden="true"></span> <span class="sr-only">View Source</span> </a> <div class="specs"> <pre>macro_aliases() :: [{<a href="typespecs.html#built-in-types">module</a>(), {<a href="typespecs.html#basic-types">integer</a>(), <a href="typespecs.html#built-in-types">module</a>()}}]</pre> </div> </div> <section class="docstring"> </section> </div> <div class="detail" id="t:macros/0"> <div class="detail-header"> <a href="#t:macros/0" class="detail-link" title="Link to this type"> <span class="icon-link" aria-hidden="true"></span> <span class="sr-only">Link to this type</span> </a> <span class="signature">macros()</span> <a href="https://github.com/elixir-lang/elixir/blob/v1.7.2/lib/elixir/lib/macro/env.ex#L64" class="view-source" rel="help" title="View Source"> <span class="icon-code" aria-hidden="true"></span> <span class="sr-only">View Source</span> </a> <div class="specs"> <pre>macros() :: [{<a href="typespecs.html#built-in-types">module</a>(), [<a href="#t:name_arity/0">name_arity</a>()]}]</pre> </div> </div> <section class="docstring"> </section> </div> <div class="detail" id="t:name_arity/0"> <div class="detail-header"> <a href="#t:name_arity/0" class="detail-link" title="Link to this type"> <span class="icon-link" aria-hidden="true"></span> <span class="sr-only">Link to this type</span> </a> <span class="signature">name_arity()</span> <a href="https://github.com/elixir-lang/elixir/blob/v1.7.2/lib/elixir/lib/macro/env.ex#L56" class="view-source" rel="help" title="View Source"> <span class="icon-code" aria-hidden="true"></span> <span class="sr-only">View Source</span> </a> <div class="specs"> <pre>name_arity() :: {<a href="typespecs.html#basic-types">atom</a>(), <a href="typespecs.html#built-in-types">arity</a>()}</pre> </div> </div> <section class="docstring"> </section> </div> <div class="detail" id="t:requires/0"> <div class="detail-header"> <a href="#t:requires/0" class="detail-link" title="Link to this type"> <span class="icon-link" aria-hidden="true"></span> <span class="sr-only">Link to this type</span> </a> <span class="signature">requires()</span> <a href="https://github.com/elixir-lang/elixir/blob/v1.7.2/lib/elixir/lib/macro/env.ex#L62" class="view-source" rel="help" title="View Source"> <span class="icon-code" aria-hidden="true"></span> <span class="sr-only">View Source</span> </a> <div class="specs"> <pre>requires() :: [<a href="typespecs.html#built-in-types">module</a>()]</pre> </div> </div> <section class="docstring"> </section> </div> <div class="detail" id="t:t/0"> <div class="detail-header"> <a href="#t:t/0" class="detail-link" title="Link to this type"> <span class="icon-link" aria-hidden="true"></span> <span class="sr-only">Link to this type</span> </a> <span class="signature">t()</span> <a href="https://github.com/elixir-lang/elixir/blob/v1.7.2/lib/elixir/lib/macro/env.ex#L77" class="view-source" rel="help" title="View Source"> <span class="icon-code" aria-hidden="true"></span> <span class="sr-only">View Source</span> </a> <div class="specs"> <pre>t() :: %Macro.Env{ module: <a href="typespecs.html#basic-types">atom</a>(), file: <a href="#t:file/0">file</a>(), line: <a href="#t:line/0">line</a>(), function: <a href="#t:name_arity/0">name_arity</a>() | nil, context: <a href="#t:context/0">context</a>(), requires: <a href="#t:requires/0">requires</a>(), aliases: <a href="#t:aliases/0">aliases</a>(), functions: <a href="#t:functions/0">functions</a>(), macros: <a href="#t:macros/0">macros</a>(), macro_aliases: <a href="#t:aliases/0">aliases</a>(), context_modules: <a href="#t:context_modules/0">context_modules</a>(), vars: vars(), unused_vars: unused_vars(), current_vars: current_vars(), prematch_vars: prematch_vars(), lexical_tracker: <a href="#t:lexical_tracker/0">lexical_tracker</a>(), contextual_vars: contextual_vars() }</pre> </div> </div> <section class="docstring"> </section> </div> <div class="detail" id="t:var/0"> <div class="detail-header"> <a href="#t:var/0" class="detail-link" title="Link to this type"> <span class="icon-link" aria-hidden="true"></span> <span class="sr-only">Link to this type</span> </a> <span class="signature">var()</span> <a href="https://github.com/elixir-lang/elixir/blob/v1.7.2/lib/elixir/lib/macro/env.ex#L67" class="view-source" rel="help" title="View Source"> <span class="icon-code" aria-hidden="true"></span> <span class="sr-only">View Source</span> </a> <div class="specs"> <pre>var() :: {<a href="typespecs.html#basic-types">atom</a>(), <a href="typespecs.html#basic-types">atom</a>() | <a href="typespecs.html#basic-types">non_neg_integer</a>()}</pre> </div> </div> <section class="docstring"> </section> </div> </div> </section> <section id="functions" class="details-list"> <h1 class="section-heading"> <a class="hover-link" href="#functions"> <span class="icon-link" aria-hidden="true"></span> <span class="sr-only">Link to this section</span> </a> Functions </h1> <div class="detail" id="has_var?/2"> <div class="detail-header"> <a href="#has_var?/2" class="detail-link" title="Link to this function"> <span class="icon-link" aria-hidden="true"></span> <span class="sr-only">Link to this function</span> </a> <span class="signature">has_var?(env, var)</span> <a href="https://github.com/elixir-lang/elixir/blob/v1.7.2/lib/elixir/lib/macro/env.ex#L149" class="view-source" rel="help" title="View Source"> <span class="icon-code" aria-hidden="true"></span> <span class="sr-only">View Source</span> </a> <span class="note">(since 1.7.0)</span> <div class="specs"> <pre>has_var?(<a href="#t:t/0">t</a>(), <a href="#t:var/0">var</a>()) :: <a href="typespecs.html#built-in-types">boolean</a>()</pre> </div> </div> <section class="docstring"> <p>Checks if a variable belongs to the environment.</p> </section> </div> <div class="detail" id="in_guard?/1"> <div class="detail-header"> <a href="#in_guard?/1" class="detail-link" title="Link to this function"> <span class="icon-link" aria-hidden="true"></span> <span class="sr-only">Link to this function</span> </a> <span class="signature">in_guard?(env)</span> <a href="https://github.com/elixir-lang/elixir/blob/v1.7.2/lib/elixir/lib/macro/env.ex#L182" class="view-source" rel="help" title="View Source"> <span class="icon-code" aria-hidden="true"></span> <span class="sr-only">View Source</span> </a> <div class="specs"> <pre>in_guard?(<a href="#t:t/0">t</a>()) :: <a href="typespecs.html#built-in-types">boolean</a>()</pre> </div> </div> <section class="docstring"> <p>Returns whether the compilation environment is currently inside a guard.</p> </section> </div> <div class="detail" id="in_match?/1"> <div class="detail-header"> <a href="#in_match?/1" class="detail-link" title="Link to this function"> <span class="icon-link" aria-hidden="true"></span> <span class="sr-only">Link to this function</span> </a> <span class="signature">in_match?(env)</span> <a href="https://github.com/elixir-lang/elixir/blob/v1.7.2/lib/elixir/lib/macro/env.ex#L190" class="view-source" rel="help" title="View Source"> <span class="icon-code" aria-hidden="true"></span> <span class="sr-only">View Source</span> </a> <div class="specs"> <pre>in_match?(<a href="#t:t/0">t</a>()) :: <a href="typespecs.html#built-in-types">boolean</a>()</pre> </div> </div> <section class="docstring"> <p>Returns whether the compilation environment is currently inside a match clause.</p> </section> </div> <div class="detail" id="location/1"> <div class="detail-header"> <a href="#location/1" class="detail-link" title="Link to this function"> <span class="icon-link" aria-hidden="true"></span> <span class="sr-only">Link to this function</span> </a> <span class="signature">location(env)</span> <a href="https://github.com/elixir-lang/elixir/blob/v1.7.2/lib/elixir/lib/macro/env.ex#L160" class="view-source" rel="help" title="View Source"> <span class="icon-code" aria-hidden="true"></span> <span class="sr-only">View Source</span> </a> <div class="specs"> <pre>location(<a href="#t:t/0">t</a>()) :: <a href="typespecs.html#built-in-types">keyword</a>()</pre> </div> </div> <section class="docstring"> <p>Returns a keyword list containing the file and line information as keys.</p> </section> </div> <div class="detail" id="stacktrace/1"> <div class="detail-header"> <a href="#stacktrace/1" class="detail-link" title="Link to this function"> <span class="icon-link" aria-hidden="true"></span> <span class="sr-only">Link to this function</span> </a> <span class="signature">stacktrace(env)</span> <a href="https://github.com/elixir-lang/elixir/blob/v1.7.2/lib/elixir/lib/macro/env.ex#L196" class="view-source" rel="help" title="View Source"> <span class="icon-code" aria-hidden="true"></span> <span class="sr-only">View Source</span> </a> <div class="specs"> <pre>stacktrace(<a href="#t:t/0">t</a>()) :: <a href="typespecs.html#built-in-types">list</a>()</pre> </div> </div> <section class="docstring"> <p>Returns the environment stacktrace.</p> </section> </div> <div class="detail" id="to_match/1"> <div class="detail-header"> <a href="#to_match/1" class="detail-link" title="Link to this function"> <span class="icon-link" aria-hidden="true"></span> <span class="sr-only">Link to this function</span> </a> <span class="signature">to_match(env)</span> <a href="https://github.com/elixir-lang/elixir/blob/v1.7.2/lib/elixir/lib/macro/env.ex#L172" class="view-source" rel="help" title="View Source"> <span class="icon-code" aria-hidden="true"></span> <span class="sr-only">View Source</span> </a> <div class="specs"> <pre>to_match(<a href="#t:t/0">t</a>()) :: <a href="#t:t/0">t</a>()</pre> </div> </div> <section class="docstring"> <p>Returns a <a href="Macro.Env.html#content"><code class="inline">Macro.Env</code></a> in the match context.</p> </section> </div> <div class="detail" id="vars/1"> <div class="detail-header"> <a href="#vars/1" class="detail-link" title="Link to this function"> <span class="icon-link" aria-hidden="true"></span> <span class="sr-only">Link to this function</span> </a> <span class="signature">vars(env)</span> <a href="https://github.com/elixir-lang/elixir/blob/v1.7.2/lib/elixir/lib/macro/env.ex#L138" class="view-source" rel="help" title="View Source"> <span class="icon-code" aria-hidden="true"></span> <span class="sr-only">View Source</span> </a> <span class="note">(since 1.7.0)</span> <div class="specs"> <pre>vars(<a href="#t:t/0">t</a>()) :: [<a href="#t:var/0">var</a>()]</pre> </div> </div> <section class="docstring"> <p>Returns a list of variables in the current environment.</p> <p>Each variable is identified by a tuple of two elements, where the first element is the variable name as an atom and the second element is its context, which may be an atom or an integer.</p> </section> </div> </section> <footer class="footer"> <p> <span class="line"> Built using <a href="https://github.com/elixir-lang/ex_doc" title="ExDoc" target="_blank" rel="help noopener">ExDoc</a> (v0.19.1), </span> <span class="line"> designed by <a href="https://twitter.com/dignifiedquire" target="_blank" rel="noopener" title="@dignifiedquire">Friedel Ziegelmayer</a>. </span> </p> </footer> </div> </div> </section> </div> <script src="dist/app-a0c90688fa.js"></script> </body> </html>