You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12 lines
16 KiB

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>InferIR__AccessPath (InferIR.InferIR__AccessPath)</title><link rel="stylesheet" href="../../odoc.css"/><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><meta name="generator" content="doc-ock-html v1.0.0-1-g1fc9bf0"/></head><body><nav id="top"><a href="../index.html">Up</a> &mdash; <span class="package">package <a href="../index.html">InferIR</a></span></nav><header><h1><span class="keyword">Module</span> <span class="module-path">InferIR__AccessPath</span></h1></header><p>Module for naming heap locations via the path used to access them (e.g., x.f.g, y<code class="code">a</code>.b)</p><div class="spec type" id="type-base"><a href="#type-base" class="anchor"></a><div class="def type"><code><span class="keyword">type </span>base</code><code><span class="keyword"> = </span><a href="../InferIR/Var/index.html#type-t">InferIR.Var.t</a><span class="keyword"> * </span><a href="../InferIR/Typ/index.html#type-t">InferIR.Typ.t</a></code><code></code></div><div class="doc"></div></div><div class="spec include"><div class="doc"></div><details open="open"><summary><span class="def"><code><span class="keyword">include </span><span class="keyword">sig</span> ... <span class="keyword">end</span></code></span></summary><div class="spec val" id="val-compare_base"><a href="#val-compare_base" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>compare_base : <a href="index.html#type-base">base</a> <span class="keyword">&#8209;&gt;</span> <a href="index.html#type-base">base</a> <span class="keyword">&#8209;&gt;</span> int</code></div><div class="doc"></div></div></details></div><div class="spec type" id="type-access"><a href="#type-access" class="anchor"></a><div class="def type"><code><span class="keyword">type </span>access</code><code></code><code><span class="keyword"> = </span></code><table class="variant"><tr id="type-access.ArrayAccess" class="anchored"><td class="def constructor"><a href="#type-access.ArrayAccess" class="anchor"></a><code><span class="keyword">| </span></code><code><span class="constructor">ArrayAccess</span><span class="keyword"> of </span><a href="../InferIR/Typ/index.html#type-t">InferIR.Typ.t</a><span class="keyword"> * </span><a href="index.html#type-t">t</a> list</code></td><td class="doc"><p>(** array element type with list of access paths in index *)</p></td></tr><tr id="type-access.FieldAccess" class="anchored"><td class="def constructor"><a href="#type-access.FieldAccess" class="anchor"></a><code><span class="keyword">| </span></code><code><span class="constructor">FieldAccess</span><span class="keyword"> of </span><a href="../InferIR/Typ/Fieldname/index.html#type-t">InferIR.Typ.Fieldname.t</a></code></td><td class="doc"><p>(** field name *)</p></td></tr></table><code></code></div><div class="doc"></div></div><div class="spec type" id="type-t"><a href="#type-t" class="anchor"></a><div class="def type"><code><span class="keyword">type </span>t</code><code><span class="keyword"> = </span><a href="index.html#type-base">base</a><span class="keyword"> * </span><a href="index.html#type-access">access</a> list</code><code></code></div><div class="doc"><p>root var, and a list of accesses. closest to the root var is first that is, x.f.g is
representedas (x, <code class="code">f; g</code>)</p></div></div><div class="spec include"><div class="doc"></div><details open="open"><summary><span class="def"><code><span class="keyword">include </span><span class="keyword">sig</span> ... <span class="keyword">end</span></code></span></summary><div class="spec val" id="val-compare_access"><a href="#val-compare_access" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>compare_access : <a href="index.html#type-access">access</a> <span class="keyword">&#8209;&gt;</span> <a href="index.html#type-access">access</a> <span class="keyword">&#8209;&gt;</span> int</code></div><div class="doc"></div></div><div class="spec val" id="val-compare"><a href="#val-compare" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>compare : <a href="index.html#type-t">t</a> <span class="keyword">&#8209;&gt;</span> <a href="index.html#type-t">t</a> <span class="keyword">&#8209;&gt;</span> int</code></div><div class="doc"></div></div><div class="spec val" id="val-compare_access"><a href="#val-compare_access" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>compare_access : <a href="index.html#type-access">access</a> <span class="keyword">&#8209;&gt;</span> <a href="index.html#type-access">access</a> <span class="keyword">&#8209;&gt;</span> int</code></div><div class="doc"></div></div><div class="spec val" id="val-compare"><a href="#val-compare" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>compare : <a href="index.html#type-t">t</a> <span class="keyword">&#8209;&gt;</span> <a href="index.html#type-t">t</a> <span class="keyword">&#8209;&gt;</span> int</code></div><div class="doc"></div></div></details></div><div class="spec val" id="val-truncate"><a href="#val-truncate" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>truncate : <a href="index.html#type-t">t</a> <span class="keyword">&#8209;&gt;</span> <a href="index.html#type-t">t</a><span class="keyword"> * </span><a href="index.html#type-access">access</a> option</code></div><div class="doc"><p>remove and return the last access of the access path if the access list is non-empty. returns
the original access path * None if the access list is empty</p></div></div><div class="spec val" id="val-get_last_access"><a href="#val-get_last_access" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>get_last_access : <a href="index.html#type-t">t</a> <span class="keyword">&#8209;&gt;</span> <a href="index.html#type-access">access</a> option</code></div><div class="doc"><p>get the last access in the list. returns None if the list is empty</p></div></div><div class="spec val" id="val-get_field_and_annotation"><a href="#val-get_field_and_annotation" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>get_field_and_annotation : <a href="index.html#type-t">t</a> <span class="keyword">&#8209;&gt;</span> <a href="../InferIR/Tenv/index.html#type-t">InferIR.Tenv.t</a> <span class="keyword">&#8209;&gt;</span> (<a href="../InferIR/Typ/Fieldname/index.html#type-t">InferIR.Typ.Fieldname.t</a><span class="keyword"> * </span><a href="../InferIR/Annot/Item/index.html#type-t">InferIR.Annot.Item.t</a>) option</code></div><div class="doc"><p>get the field name and the annotation of the last access in the list of accesses if
the list is non-empty and the last access is a field access</p></div></div><div class="spec val" id="val-get_typ"><a href="#val-get_typ" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>get_typ : <a href="index.html#type-t">t</a> <span class="keyword">&#8209;&gt;</span> <a href="../InferIR/Tenv/index.html#type-t">InferIR.Tenv.t</a> <span class="keyword">&#8209;&gt;</span> <a href="../InferIR/Typ/index.html#type-t">InferIR.Typ.t</a> option</code></div><div class="doc"><p>get the typ of the last access in the list of accesses if the list is non-empty, or the base
if the list is empty. that is, for x.f.g, return typ(g), and for x, return typ(x)</p></div></div><div class="spec val" id="val-base_of_pvar"><a href="#val-base_of_pvar" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>base_of_pvar : <a href="../InferIR/Pvar/index.html#type-t">InferIR.Pvar.t</a> <span class="keyword">&#8209;&gt;</span> <a href="../InferIR/Typ/index.html#type-t">InferIR.Typ.t</a> <span class="keyword">&#8209;&gt;</span> <a href="index.html#type-base">base</a></code></div><div class="doc"><p>create a base from a pvar</p></div></div><div class="spec val" id="val-of_pvar"><a href="#val-of_pvar" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>of_pvar : <a href="../InferIR/Pvar/index.html#type-t">InferIR.Pvar.t</a> <span class="keyword">&#8209;&gt;</span> <a href="../InferIR/Typ/index.html#type-t">InferIR.Typ.t</a> <span class="keyword">&#8209;&gt;</span> <a href="index.html#type-t">t</a></code></div><div class="doc"><p>create an access path from a pvar</p></div></div><div class="spec val" id="val-of_id"><a href="#val-of_id" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>of_id : <a href="../InferIR/Ident/index.html#type-t">InferIR.Ident.t</a> <span class="keyword">&#8209;&gt;</span> <a href="../InferIR/Typ/index.html#type-t">InferIR.Typ.t</a> <span class="keyword">&#8209;&gt;</span> <a href="index.html#type-t">t</a></code></div><div class="doc"><p>create an access path from an ident</p></div></div><div class="spec val" id="val-of_exp"><a href="#val-of_exp" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>of_exp : include_array_indexes:bool <span class="keyword">&#8209;&gt;</span> <a href="../InferIR/Exp/index.html#type-t">InferIR.Exp.t</a> <span class="keyword">&#8209;&gt;</span> <a href="../InferIR/Typ/index.html#type-t">InferIR.Typ.t</a> <span class="keyword">&#8209;&gt;</span> f_resolve_id:(<a href="../InferIR/Var/index.html#type-t">InferIR.Var.t</a> <span class="keyword">&#8209;&gt;</span> <a href="index.html#type-t">t</a> option) <span class="keyword">&#8209;&gt;</span> <a href="index.html#type-t">t</a> list</code></div><div class="doc"><p>extract the access paths that occur in <code class="code">exp</code>, resolving identifiers using <code class="code">f_resolve_id</code>. don't include index expressions in array accesses if <code class="code">include_array_indexes</code> is false</p></div></div><div class="spec val" id="val-of_lhs_exp"><a href="#val-of_lhs_exp" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>of_lhs_exp : include_array_indexes:bool <span class="keyword">&#8209;&gt;</span> <a href="../InferIR/Exp/index.html#type-t">InferIR.Exp.t</a> <span class="keyword">&#8209;&gt;</span> <a href="../InferIR/Typ/index.html#type-t">InferIR.Typ.t</a> <span class="keyword">&#8209;&gt;</span> f_resolve_id:(<a href="../InferIR/Var/index.html#type-t">InferIR.Var.t</a> <span class="keyword">&#8209;&gt;</span> <a href="index.html#type-t">t</a> option) <span class="keyword">&#8209;&gt;</span> <a href="index.html#type-t">t</a> option</code></div><div class="doc"><p>convert <code class="code">lhs_exp</code> to an access path, resolving identifiers using <code class="code">f_resolve_id</code></p></div></div><div class="spec val" id="val-append"><a href="#val-append" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>append : <a href="index.html#type-t">t</a> <span class="keyword">&#8209;&gt;</span> <a href="index.html#type-access">access</a> list <span class="keyword">&#8209;&gt;</span> <a href="index.html#type-t">t</a></code></div><div class="doc"><p>append new accesses to an existing access path; e.g., `append_access x.f <code class="code">g, h</code>` produces
`x.f.g.h`</p></div></div><div class="spec val" id="val-is_prefix"><a href="#val-is_prefix" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>is_prefix : <a href="index.html#type-t">t</a> <span class="keyword">&#8209;&gt;</span> <a href="index.html#type-t">t</a> <span class="keyword">&#8209;&gt;</span> bool</code></div><div class="doc"><p>return true if <code class="code">ap1</code> is a prefix of <code class="code">ap2</code>. returns true for equal access paths</p></div></div><div class="spec val" id="val-inner_class_normalize"><a href="#val-inner_class_normalize" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>inner_class_normalize : <a href="index.html#type-t">t</a> <span class="keyword">&#8209;&gt;</span> <a href="index.html#type-t">t</a></code></div><div class="doc"><p>transform an access path that starts on &quot;this&quot; of an inner class but which breaks out to
access outer class fields to the outermost one.
Cases handled (recursively):
</p><ul><li>(this:InnerClass* ).(this$n:OuterClassAccessor).f. ... -&gt; (this:OuterClass* ).f . ...</li><li>this$n.(this$m:OuterClassAccessor).f ... -&gt; (this$m:OuterClass* ).f . ...
(happens in ctrs only)</li><li>this$n.f ... -&gt; this.f . ...
(happens in ctrs only)</li></ul></div></div><div class="spec val" id="val-equal"><a href="#val-equal" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>equal : <a href="index.html#type-t">t</a> <span class="keyword">&#8209;&gt;</span> <a href="index.html#type-t">t</a> <span class="keyword">&#8209;&gt;</span> bool</code></div><div class="doc"></div></div><div class="spec val" id="val-equal_base"><a href="#val-equal_base" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>equal_base : <a href="index.html#type-base">base</a> <span class="keyword">&#8209;&gt;</span> <a href="index.html#type-base">base</a> <span class="keyword">&#8209;&gt;</span> bool</code></div><div class="doc"></div></div><div class="spec val" id="val-equal_access"><a href="#val-equal_access" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>equal_access : <a href="index.html#type-access">access</a> <span class="keyword">&#8209;&gt;</span> <a href="index.html#type-access">access</a> <span class="keyword">&#8209;&gt;</span> bool</code></div><div class="doc"></div></div><div class="spec val" id="val-equal_access_list"><a href="#val-equal_access_list" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>equal_access_list : <a href="index.html#type-access">access</a> list <span class="keyword">&#8209;&gt;</span> <a href="index.html#type-access">access</a> list <span class="keyword">&#8209;&gt;</span> bool</code></div><div class="doc"></div></div><div class="spec val" id="val-pp"><a href="#val-pp" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>pp : Format.formatter <span class="keyword">&#8209;&gt;</span> <a href="index.html#type-t">t</a> <span class="keyword">&#8209;&gt;</span> unit</code></div><div class="doc"></div></div><div class="spec val" id="val-pp_base"><a href="#val-pp_base" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>pp_base : Format.formatter <span class="keyword">&#8209;&gt;</span> <a href="index.html#type-base">base</a> <span class="keyword">&#8209;&gt;</span> unit</code></div><div class="doc"></div></div><div class="spec val" id="val-pp_access"><a href="#val-pp_access" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>pp_access : Format.formatter <span class="keyword">&#8209;&gt;</span> <a href="index.html#type-access">access</a> <span class="keyword">&#8209;&gt;</span> unit</code></div><div class="doc"></div></div><div class="spec module" id="module-Abs"><a href="#module-Abs" class="anchor"></a><div class="def module"><code><span class="keyword">module </span><a href="Abs/index.html">Abs</a> : <span class="keyword">sig</span> ... <span class="keyword">end</span></code></div><div class="doc"></div></div><div class="spec module" id="module-BaseMap"><a href="#module-BaseMap" class="anchor"></a><div class="def module"><code><span class="keyword">module </span>BaseMap : <a href="../../InferStdlib/InferStdlib/PrettyPrintable/index.html#module-type-PPMap">InferStdlib.PrettyPrintable.PPMap</a><span class="keyword"> with </span><span class="keyword">type </span><a href="../../InferStdlib/InferStdlib/PrettyPrintable/index.html#module-type-PPMap">PPMap</a>.key<span class="keyword"> = </span><a href="index.html#type-base">base</a></code></div><div class="doc"></div></div></body></html>