This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.
<!DOCTYPE html>
<htmlxmlns="http://www.w3.org/1999/xhtml"><head><title>JContext (infer.InferModules.JContext)</title><linkrel="stylesheet"href="../../../odoc.css"/><metacharset="utf-8"/><metaname="viewport"content="width=device-width,initial-scale=1.0"/><metaname="generator"content="doc-ock-html v1.0.0-1-g1fc9bf0"/></head><body><navid="top"><ahref="../index.html">Up</a>—<spanclass="package">package <ahref="../../index.html">infer</a></span></nav><header><h1><spanclass="keyword">Module</span><spanclass="module-path">InferModules.JContext</span></h1></header><divclass="spec type"id="type-jump_kind"><ahref="#type-jump_kind"class="anchor"></a><divclass="def type"><code><spanclass="keyword">type </span>jump_kind</code><code></code><code><spanclass="keyword"> = </span></code><tableclass="variant"><trid="type-jump_kind.Next"class="anchored"><tdclass="def constructor"><ahref="#type-jump_kind.Next"class="anchor"></a><code><spanclass="keyword">| </span></code><code><spanclass="constructor">Next</span></code></td></tr><trid="type-jump_kind.Jump"class="anchored"><tdclass="def constructor"><ahref="#type-jump_kind.Jump"class="anchor"></a><code><spanclass="keyword">| </span></code><code><spanclass="constructor">Jump</span><spanclass="keyword"> of </span>int</code></td></tr><trid="type-jump_kind.Exit"class="anchored"><tdclass="def constructor"><ahref="#type-jump_kind.Exit"class="anchor"></a><code><spanclass="keyword">| </span></code><code><spanclass="constructor">Exit</span></code></td></tr></table><code></code></div><divclass="doc"><p>data structure for representing whether an instruction is a goto, a return or a standard instruction.</p></div></div><divclass="spec module"id="module-NodeTbl"><ahref="#module-NodeTbl"class="anchor"></a><divclass="def module"><code><spanclass="keyword">module </span>NodeTbl : <ahref="../../../InferStdlib/InferStdlib/index.html#module-IStd">InferStdlib.IStd</a>.Caml.Hashtbl.S<spanclass="keyword"> with </span><spanclass="keyword">type </span><ahref="index.html#module-NodeTbl">NodeTbl</a>.key<spanclass="keyword"> = </span><ahref="../../../InferIR/InferIR/Procdesc/Node/index.html#type-t">InferIR.Procdesc.Node.t</a></code></div><divclass="doc"><p>Hastable for storing nodes that correspond to if-instructions. These are
used when adding the edges in the contrl flow graph.</p></div></div><divclass="spec type"id="type-icfg"><ahref="#type-icfg"class="anchor"></a><divclass="def type"><code><spanclass="keyword">type </span>icfg</code><code></code><code><spanclass="keyword"> = </span></code><code>{</code><tableclass="record"><trid="type-icfg.tenv"class="anchored"><tdclass="def field"><ahref="#type-icfg.tenv"class="anchor"></a><code>tenv : <ahref="../../../InferIR/InferIR/Tenv/index.html#type-t">InferIR.Tenv.t</a>;</code></td></tr><trid="type-icfg.cfg"class="anchored"><tdclass="def field"><ahref="#type-icfg.cfg"class="anchor"></a><code>cfg : <ahref="../../../InferIR/InferIR/Cfg/index.html#type-t">InferIR.Cfg.t</a>;</code></td></tr></table><code>}</code><code></code></div><divclass="doc"><p>data structure for saving the three structures tht contain the intermediate
representation of a file: the type environment, the control graph and the control
flow graph</p></div></div><divclass="spec type"id="type-t"><ahref="#type-t"class="anchor"></a><divclass="def type"><code><spanclass="keyword">type </span>t</code><code></code><code><spanclass="keyword"> = </span><spanclass="keyword">private </span></code><code>{</code><tableclass="record"><trid="type-t.icfg"class="anchored"><tdclass="def field"><ahref="#type-t.icfg"class="anchor"></a><code>icfg : <ahref="index.html#type-icfg">icfg</a>;</code></td></tr><trid="type-t.procdesc"class="anchored"><tdclass="def field"><ahref="#type-t.procdesc"class="anchor"></a><code>procdesc : <ahref="../../../InferIR/InferIR/Procdesc/index.html#type-t">InferIR.Procdesc.t</a>;</code></td></tr><trid="type-t.impl"class="anchored"><tdclass="def field"><ahref="#type-t.impl"class="anchor"></a><code>impl : Sawja_pack.JBir.t;</code></td></tr><trid="type-t.var_map"class="anchored"><tdclass="def field"><ahref="#type-t.var_map"class="anchor"></a><code><spanclass="keyword">mutable </span>var_map : (<ahref="../../../InferIR/InferIR/Pvar/index.html#type-t">InferIR.Pvar.t</a><spanclass="keyword"> * </span><ahref="../../../InferIR/InferIR/Typ/index.html#type-t">InferIR.Typ.t</a><spanclass="keyword"> * </span><ahref="../../../InferIR/InferIR/Typ/index.html#type-t">InferIR.Typ.t</a>) Sawja_pack.JBir.VarMap.t;</code></td></tr><trid="type-t.if_jumps"class="anchored"><tdclass="def field"><ahref="#type-t.if_jumps"class="anchor"></a><code>if_jumps : int <ahref="index.html#module-NodeTbl">NodeTbl</a>.t;</code></td></tr><trid="type-t.goto_jumps"class="anchored"><tdclass="def field"><ahref="#type-t.goto_jumps"class="anchor"></a><code>goto_jumps : (int,<ahref="index.html#type-jump_kind">jump_kind</a>)<ahref="../../../InferStdlib/InferStdlib/index.html#module-IStd">InferStdlib.IStd</a>.Caml.Hashtbl.t;</code></td></tr><trid="type-t.cn"class="anchored"><tdclass="def field"><ahref="#type-t.cn"class="anchor"></a><code>cn : Javalib_pack.JBasics.class_name;</code></td></tr><trid="type-t.source_file"class="anchored"><tdclass="def field"><ahref="#type-t.source_file"class="anchor"></a><code>source_file : <ahref="../../../InferBase/InferBase/SourceFile/index.html#type-t">InferBase.SourceFile.t</a>;</code></td></tr><trid="type-t.program"class="anchored"><tdclass="def field"><ahref="#type-t.program"class="anchor"></a><code>program : <ahref="../JClasspath/index.html#type-program">JClasspath.program</a>;</code></td></tr></table><code>}</code><code></code></div><divclass="doc"><p>data structure for storing the context elements.</p></div></div><divclass="spec val"id="val-create_context"><ahref="#val-create_context"class="anchor"></a><divclass="def val"><code><spanclass="keyword">val </span>create_context : <ahref="index.html#type-icfg">icfg</a><spanclass="keyword">‑></span><ahref="../../../InferIR/InferIR/Procdesc/index.html#type-t">InferIR.Procdesc.t</a><spanclass="keyword">‑></span> Sawja_pack.JBir.t <spanclass="keyword">‑></span> Javalib_pack.JBasics.class_name <spanclass="keyword">‑></span><ahref="../../../InferBase/InferBase/SourceFile/index.html#type-t">InferBase.SourceFile.t</a><spanclass="keyword">‑></span><ahref="../JClasspath/index.html#type-program">JClasspath.program</a><spanclass="keyword">‑></span><ahref="index.html#type-t">t</a></code></div><divclass="doc"><p>cretes a context for a given method.</p></div></div><divclass="spec val"id="val-get_tenv"><ahref="#val-get_tenv"class="anchor"></a><divclass="def val"><code><spanclass="keyword">val </span>get_tenv : <ahref="index.html#type-t">t</a><spanclass="keyword">‑></span><ahref="../../../InferIR/InferIR/Tenv/index.html#type-t">InferIR.Tenv.t</a></code></div><divclass="doc"><p>returns the type environment that corresponds to the current file.</p></div></div><divclass="spec val"id="val-add_if_jump"><ahref="#val-add_if_jump"class="anchor"></a><divclass="def val"><code><spanclass="keyword">val </span>add_if_jump : <ahref="index.html#type-t">t</a><spanclass="keyword">‑></span><ahref="../../../InferIR/InferIR/Procdesc/Node/index.html#type-t">InferIR.Procdesc.Node.t</a><spanclass="keyword">‑></span> int <spanclass="keyword">‑></span> unit</code></div><divclass="doc"><p>adds to the context the line that an if-node will jump to</p></div></div><divclass="spec val"id="val-get_if_jump"><ahref="#val-get_if_jump"class="anchor"></a><divclass="def val"><code><spanclass="keyword">val </span>get_if_jump : <ahref="index.html#type-t">t</a><spanclass="keyword">‑></span><ahref="../../../InferIR/InferIR/Procdesc/Node/index.html#type-t">InferIR.Procdesc.Node.t</a><spanclass="keyword">‑></span> int option</code></div><divclass="doc"><p>returns whether the given node corresponds to an if-instruction</p></div></div><divclass="spec val"id="val-add_goto_jump"><ahref="#val-add_goto_jump"class="anchor"></a><divclass="def val"><code><spanclass="keyword">val </span>add_goto_jump : <ahref="index.html#type-t">t</a><spanclass="keyword">‑></span> int <spanclass="keyword">‑></span><ahref="index.html#type-jump_kind">jump_kind</a><spanclass="keyword">‑></span> unit</code></div><divclass="doc"><p>adds to the context the line that the node in the given line will jump to.</p></div></div><divclass="spec val"id="val-get_goto_jump"><ahref="#val-get_goto_jump"class="anchor"></a><divclass="def val"><code><spanclass="keyword">val </span>get_goto_jump : <ahref="index.html#type-t">t</a><spanclass="keyword">‑></span> int <spanclass="keyword">‑></span><ahref="index.html#type-jump_kind">jump_kind</a></code></div><divclass="doc"><p>if the given line corresponds to a goto instruction, then returns the
line where it jumps to, otherwise returns the next line.</p></div></div><divclass="spec val"id="val-is_goto_jump"><ahref="#val-is_goto_jump"class="anchor"></a><divclass="def val"><code><spanclass="keyword">val </span>is_goto_jump : <ahref="index.html#type-t">t</a><spanclass="keyword">‑></span> int <spanclass="keyword">‑></span> bool</code></div><divclass="doc"><p>returns whether the given line corresponds to a goto instruction.</p></div></div><divclass="spec val"id="val-set_pvar"><ahref="#val-set_pvar"class="anchor"></a><divclass="def val"><code><spanclass="keyword">val </span>set_pvar : <ahref="index.html#type-t">t</a><spanclass="keyword">‑></span> Sawja_pack.JBir.var <spanclass="keyword">‑></span><ahref="../../../InferIR/InferIR/Typ/index.html#type-t">InferIR.Typ.t</a><spanclass="keyword">‑></span><ahref="../../../InferIR/InferIR/Pvar/index.html#type-t">InferIR.Pvar.t</a></code></div><divclass="doc"><p><codeclass="code">set_pvar context var type</code> adds a variable with a type to the context</p></div></div><divclass="spec val"id="val-get_var_type"><ahref="#val-get_var_type"class="anchor"></a><divclass="def val"><code><spanclass="keyword">val </span>get_var_type : <ahref="index.html#type-t">t</a><spanclass="keyword">‑></span> Sawja_pack.JBir.var <spanclass="keyword">‑></span><ahref="../../../InferIR/InferIR/Typ/index.html#type-t">InferIR.Typ.t</a> option</code></div><divclass="doc"><p><codeclass="code">get_var_type context var</code> returns the type of the variable, if the variable is in the context</p></div></div><divclass="spec val"id="val-reset_pvar_type"><ahref="#val-reset_pvar_type"class="anchor"></a><divclass="def val"><code><spanclass="keyword">val </span>reset_pvar_type : <ahref="index.html#type-t">t</a><spanclass="keyword">‑></span> unit</code></div><divclass="doc"><p>resets the dynamic type of the variables in the context.</p></div></div><divclass="spec val"id="val-reset_exn_node_table"><ahref="#val-reset_exn_node_table"class="anchor"></a><divclass="def val"><code><spanclass="keyword">val </span>reset_exn_node_table : unit <spanclass="keyword">‑></span> unit</code></div><divclass="doc"><p>resets the hashtable mapping methods to their exception nodes</p></div></div><divclass="spec val"id="val-add_exn_node"><ahref="#val-add_exn_node"class="anchor"></a><divclass="def val"><code><spanclass="keyword">val </span>add_exn_node : <ahref="../../../InferIR/InferIR/Typ/Procname/index.html#type-t">InferIR.Typ.Procname.t</a><spanclass="keyword">‑></span><ahref="../../../InferIR/InferIR/Procdesc/Node/index.html#type-t">InferIR.Procdesc.Node.t</a><spanclass="keyword">‑></span> unit</code></div><divclass="doc"><p>adds the exception node for a given method</p></div></div></body></html>