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.

2 lines
13 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Struct (infer.IR.Struct)</title><link rel="stylesheet" href="../../../odoc.css"/><meta charset="utf-8"/><meta name="generator" content="odoc 1.5.1"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div class="content"><header><nav><a href="../index.html">Up</a> <a href="../../index.html">infer</a> &#x00BB; <a href="../index.html">IR</a> &#x00BB; Struct</nav><h1>Module <code>IR.Struct</code></h1></header><div class="spec module" id="module-F"><a href="#module-F" class="anchor"></a><code><span class="keyword">module</span> F = Stdlib.Format</code></div><dl><dt class="spec type" id="type-field"><a href="#type-field" class="anchor"></a><code><span class="keyword">type</span> field</code><code> = <a href="../Fieldname/index.html#type-t">Fieldname.t</a> * <a href="../Typ/index.html#type-t">Typ.t</a> * <a href="../Annot/Item/index.html#type-t">Annot.Item.t</a></code></dt></dl><div><div class="spec include"><div class="doc"><dl><dt class="spec value" id="val-compare_field"><a href="#val-compare_field" class="anchor"></a><code><span class="keyword">val</span> compare_field : <a href="index.html#type-field">field</a> <span>&#45;&gt;</span> <a href="index.html#type-field">field</a> <span>&#45;&gt;</span> int</code></dt></dl></div></div></div><dl><dt class="spec type" id="type-fields"><a href="#type-fields" class="anchor"></a><code><span class="keyword">type</span> fields</code><code> = <span><a href="index.html#type-field">field</a> list</span></code></dt><dt class="spec type" id="type-java_class_kind"><a href="#type-java_class_kind" class="anchor"></a><code><span class="keyword">type</span> java_class_kind</code><code> = </code><table class="variant"><tr id="type-java_class_kind.Interface" class="anchored"><td class="def constructor"><a href="#type-java_class_kind.Interface" class="anchor"></a><code>| </code><code><span class="constructor">Interface</span></code></td></tr><tr id="type-java_class_kind.AbstractClass" class="anchored"><td class="def constructor"><a href="#type-java_class_kind.AbstractClass" class="anchor"></a><code>| </code><code><span class="constructor">AbstractClass</span></code></td></tr><tr id="type-java_class_kind.NormalClass" class="anchored"><td class="def constructor"><a href="#type-java_class_kind.NormalClass" class="anchor"></a><code>| </code><code><span class="constructor">NormalClass</span></code></td></tr></table></dt></dl><div><div class="spec include"><div class="doc"><dl><dt class="spec value" id="val-equal_java_class_kind"><a href="#val-equal_java_class_kind" class="anchor"></a><code><span class="keyword">val</span> equal_java_class_kind : <a href="index.html#type-java_class_kind">java_class_kind</a> <span>&#45;&gt;</span> <a href="index.html#type-java_class_kind">java_class_kind</a> <span>&#45;&gt;</span> bool</code></dt></dl></div></div></div><dl><dt class="spec type" id="type-java_class_info"><a href="#type-java_class_info" class="anchor"></a><code><span class="keyword">type</span> java_class_info</code><code> = </code><code>{</code><table class="record"><tr id="type-java_class_info.kind" class="anchored"><td class="def field"><a href="#type-java_class_info.kind" class="anchor"></a><code>kind : <a href="index.html#type-java_class_kind">java_class_kind</a>;</code></td><td class="doc"><p>class kind in Java</p></td></tr><tr id="type-java_class_info.loc" class="anchored"><td class="def field"><a href="#type-java_class_info.loc" class="anchor"></a><code>loc : <span><a href="../../IBase/Location/index.html#type-t">IBase.Location.t</a> option</span>;</code></td><td class="doc"><p>None should correspond to rare cases when it was impossible to fetch the location in source file</p></td></tr></table><code>}</code></dt><dt class="spec type" id="type-t"><a href="#type-t" class="anchor"></a><code><span class="keyword">type</span> t</code><code> = </code><code>{</code><table class="record"><tr id="type-t.fields" class="anchored"><td class="def field"><a href="#type-t.fields" class="anchor"></a><code>fields : <a href="index.html#type-fields">fields</a>;</code></td><td class="doc"><p>non-static fields</p></td></tr><tr id="type-t.statics" class="anchored"><td class="def field"><a href="#type-t.statics" class="anchor"></a><code>statics : <a href="index.html#type-fields">fields</a>;</code></td><td class="doc"><p>static fields</p></td></tr><tr id="type-t.supers" class="anchored"><td class="def field"><a href="#type-t.supers" class="anchor"></a><code>supers : <span><a href="../Typ/Name/index.html#type-t">Typ.Name.t</a> list</span>;</code></td><td class="doc"><p>superclasses</p></td></tr><tr id="type-t.methods" class="anchored"><td class="def field"><a href="#type-t.methods" class="anchor"></a><code>methods : <span><a href="../Procname/index.html#type-t">Procname.t</a> list</span>;</code></td><td class="doc"><p>methods defined</p></td></tr><tr id="type-t.exported_objc_methods" class="anchored"><td class="def field"><a href="#type-t.exported_objc_methods" class="anchor"></a><code>exported_objc_methods : <span><a href="../Procname/index.html#type-t">Procname.t</a> list</span>;</code></td><td class="doc"><p>methods in ObjC interface, subset of <code>methods</code></p></td></tr><tr id="type-t.annots" class="anchored"><td class="def field"><a href="#type-t.annots" class="anchor"></a><code>annots : <a href="../Annot/Item/index.html#type-t">Annot.Item.t</a>;</code></td><td class="doc"><p>annotations</p></td></tr><tr id="type-t.java_class_info" class="anchored"><td class="def field"><a href="#type-t.java_class_info" class="anchor"></a><code>java_class_info : <span><a href="index.html#type-java_class_info">java_class_info</a> option</span>;</code></td><td class="doc"><p>present if and only if the class is Java</p></td></tr><tr id="type-t.dummy" class="anchored"><td class="def field"><a href="#type-t.dummy" class="anchor"></a><code>dummy : bool;</code></td><td class="doc"><p>dummy struct for class including static method</p></td></tr></table><code>}</code></dt><dd><p>Type for a structured value.</p></dd></dl><dl><dt class="spec type" id="type-lookup"><a href="#type-lookup" class="anchor"></a><code><span class="keyword">type</span> lookup</code><code> = <a href="../Typ/Name/index.html#type-t">Typ.Name.t</a> <span>&#45;&gt;</span> <span><a href="index.html#type-t">t</a> option</span></code></dt></dl><dl><dt class="spec value" id="val-pp_field"><a href="#val-pp_field" class="anchor"></a><code><span class="keyword">val</span> pp_field : <a href="../../IStdlib/Pp/index.html#type-env">IStdlib.Pp.env</a> <span>&#45;&gt;</span> <a href="index.html#module-F">F</a>.formatter <span>&#45;&gt;</span> <a href="index.html#type-field">field</a> <span>&#45;&gt;</span> unit</code></dt><dt class="spec value" id="val-pp"><a href="#val-pp" class="anchor"></a><code><span class="keyword">val</span> pp : <a href="../../IStdlib/Pp/index.html#type-env">IStdlib.Pp.env</a> <span>&#45;&gt;</span> <a href="../Typ/Name/index.html#type-t">Typ.Name.t</a> <span>&#45;&gt;</span> <a href="index.html#module-F">F</a>.formatter <span>&#45;&gt;</span> <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> unit</code></dt><dd><p>Pretty print a struct type.</p></dd></dl><dl><dt class="spec value" id="val-internal_mk_struct"><a href="#val-internal_mk_struct" class="anchor"></a><code><span class="keyword">val</span> internal_mk_struct : <span>?&#8288;default:<a href="index.html#type-t">t</a></span> <span>&#45;&gt;</span> <span>?&#8288;fields:<a href="index.html#type-fields">fields</a></span> <span>&#45;&gt;</span> <span>?&#8288;statics:<a href="index.html#type-fields">fields</a></span> <span>&#45;&gt;</span> <span>?&#8288;methods:<span><a href="../Procname/index.html#type-t">Procname.t</a> list</span></span> <span>&#45;&gt;</span> <span>?&#8288;exported_objc_methods:<span><a href="../Procname/index.html#type-t">Procname.t</a> list</span></span> <span>&#45;&gt;</span> <span>?&#8288;supers:<span><a href="../Typ/Name/index.html#type-t">Typ.Name.t</a> list</span></span> <span>&#45;&gt;</span> <span>?&#8288;annots:<a href="../Annot/Item/index.html#type-t">Annot.Item.t</a></span> <span>&#45;&gt;</span> <span>?&#8288;java_class_info:<a href="index.html#type-java_class_info">java_class_info</a></span> <span>&#45;&gt;</span> <span>?&#8288;dummy:bool</span> <span>&#45;&gt;</span> unit <span>&#45;&gt;</span> <a href="index.html#type-t">t</a></code></dt><dd><p>Construct a struct_typ, normalizing field types</p></dd></dl><dl><dt class="spec value" id="val-get_extensible_array_element_typ"><a href="#val-get_extensible_array_element_typ" class="anchor"></a><code><span class="keyword">val</span> get_extensible_array_element_typ : <span>lookup:<a href="index.html#type-lookup">lookup</a></span> <span>&#45;&gt;</span> <a href="../Typ/index.html#type-t">Typ.t</a> <span>&#45;&gt;</span> <span><a href="../Typ/index.html#type-t">Typ.t</a> option</span></code></dt><dd><p>the element typ of the final extensible array in the given typ, if any</p></dd></dl><dl><dt class="spec type" id="type-field_info"><a href="#type-field_info" class="anchor"></a><code><span class="keyword">type</span> field_info</code><code> = </code><code>{</code><table class="record"><tr id="type-field_info.typ" class="anchored"><td class="def field"><a href="#type-field_info.typ" class="anchor"></a><code>typ : <a href="../Typ/index.html#type-t">Typ.t</a>;</code></td></tr><tr id="type-field_info.annotations" class="anchored"><td class="def field"><a href="#type-field_info.annotations" class="anchor"></a><code>annotations : <a href="../Annot/Item/index.html#type-t">Annot.Item.t</a>;</code></td></tr><tr id="type-field_info.is_static" class="anchored"><td class="def field"><a href="#type-field_info.is_static" class="anchor"></a><code>is_static : bool;</code></td></tr></table><code>}</code></dt></dl><dl><dt class="spec value" id="val-get_field_info"><a href="#val-get_field_info" class="anchor"></a><code><span class="keyword">val</span> get_field_info : <span>lookup:<a href="index.html#type-lookup">lookup</a></span> <span>&#45;&gt;</span> <a href="../Fieldname/index.html#type-t">Fieldname.t</a> <span>&#45;&gt;</span> <a href="../Typ/index.html#type-t">Typ.t</a> <span>&#45;&gt;</span> <span><a href="index.html#type-field_info">field_info</a> option</span></code></dt><dd><p>Lookup for info associated with the field <code>fn</code>. None if <code>typ</code> has no field named <code>fn</code></p></dd></dl><dl><dt class="spec value" id="val-fld_typ"><a href="#val-fld_typ" class="anchor"></a><code><span class="keyword">val</span> fld_typ : <span>lookup:<a href="index.html#type-lookup">lookup</a></span> <span>&#45;&gt;</span> <span>default:<a href="../Typ/index.html#type-t">Typ.t</a></span> <span>&#45;&gt;</span> <a href="../Fieldname/index.html#type-t">Fieldname.t</a> <span>&#45;&gt;</span> <a href="../Typ/index.html#type-t">Typ.t</a> <span>&#45;&gt;</span> <a href="../Typ/index.html#type-t">Typ.t</a></code></dt><dd><p>If a struct type with field f, return the type of f. If not, return the default type if given, otherwise raise an exception</p></dd></dl><dl><dt class="spec value" id="val-get_field_type_and_annotation"><a href="#val-get_field_type_and_annotation" class="anchor"></a><code><span class="keyword">val</span> get_field_type_and_annotation : <span>lookup:<a href="index.html#type-lookup">lookup</a></span> <span>&#45;&gt;</span> <a href="../Fieldname/index.html#type-t">Fieldname.t</a> <span>&#45;&gt;</span> <a href="../Typ/index.html#type-t">Typ.t</a> <span>&#45;&gt;</span> <span><span>(<a href="../Typ/index.html#type-t">Typ.t</a> * <a href="../Annot/Item/index.html#type-t">Annot.Item.t</a>)</span> option</span></code></dt><dd><p>Return the type of the field <code>fn</code> and its annotation, None if <code>typ</code> has no field named <code>fn</code></p></dd></dl><dl><dt class="spec value" id="val-merge"><a href="#val-merge" class="anchor"></a><code><span class="keyword">val</span> merge : <a href="../Typ/Name/index.html#type-t">Typ.Name.t</a> <span>&#45;&gt;</span> <span>newer:<a href="index.html#type-t">t</a></span> <span>&#45;&gt;</span> <span>current:<a href="index.html#type-t">t</a></span> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a></code></dt><dd><p>best effort directed merge of two structs for the same typename</p></dd></dl><dl><dt class="spec value" id="val-is_not_java_interface"><a href="#val-is_not_java_interface" class="anchor"></a><code><span class="keyword">val</span> is_not_java_interface : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> bool</code></dt><dd><p>check that a struct either defines a non-java type, or a non-java-interface type (abstract or normal class)</p></dd></dl></div></body></html>