Skip to content

Commit

Permalink
deploy: 8cff0bb
Browse files Browse the repository at this point in the history
  • Loading branch information
raviqqe committed Feb 18, 2024
1 parent 8434e01 commit 6b48778
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 17 deletions.
2 changes: 1 addition & 1 deletion melior/ir/operation/struct.Operation.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
) -&gt; impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = (<a class="struct" href="../struct.Identifier.html" title="struct melior::ir::Identifier">Identifier</a>&lt;'c&gt;, <a class="struct" href="../attribute/struct.Attribute.html" title="struct melior::ir::attribute::Attribute">Attribute</a>&lt;'c&gt;)&gt; + '_</h4></section></summary><div class="docblock"><p>Gets all attributes.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.attribute" class="method"><a class="src rightside" href="../../../src/melior/ir/operation.rs.html#187-195">source</a><h4 class="code-header">pub fn <a href="#method.attribute" class="fn">attribute</a>(&amp;self, name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="../attribute/struct.Attribute.html" title="struct melior::ir::attribute::Attribute">Attribute</a>&lt;'c&gt;, <a class="enum" href="../../enum.Error.html" title="enum melior::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Gets a attribute with the given name.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.has_attribute" class="method"><a class="src rightside" href="../../../src/melior/ir/operation.rs.html#198-200">source</a><h4 class="code-header">pub fn <a href="#method.has_attribute" class="fn">has_attribute</a>(&amp;self, name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Checks if the operation has a attribute with the given name.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_attribute" class="method"><a class="src rightside" href="../../../src/melior/ir/operation.rs.html#203-211">source</a><h4 class="code-header">pub fn <a href="#method.set_attribute" class="fn">set_attribute</a>(&amp;mut self, name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>, attribute: &amp;<a class="struct" href="../attribute/struct.Attribute.html" title="struct melior::ir::attribute::Attribute">Attribute</a>&lt;'c&gt;)</h4></section></summary><div class="docblock"><p>Sets the attribute with the given name to the given attribute.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_attribute" class="method"><a class="src rightside" href="../../../src/melior/ir/operation.rs.html#203-211">source</a><h4 class="code-header">pub fn <a href="#method.set_attribute" class="fn">set_attribute</a>(&amp;mut self, name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>, attribute: <a class="struct" href="../attribute/struct.Attribute.html" title="struct melior::ir::attribute::Attribute">Attribute</a>&lt;'c&gt;)</h4></section></summary><div class="docblock"><p>Sets the attribute with the given name to the given attribute.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.remove_attribute" class="method"><a class="src rightside" href="../../../src/melior/ir/operation.rs.html#214-218">source</a><h4 class="code-header">pub fn <a href="#method.remove_attribute" class="fn">remove_attribute</a>(&amp;mut self, name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.unit.html">()</a>, <a class="enum" href="../../enum.Error.html" title="enum melior::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Removes the attribute with the given name.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.next_in_block" class="method"><a class="src rightside" href="../../../src/melior/ir/operation.rs.html#221-223">source</a><h4 class="code-header">pub fn <a href="#method.next_in_block" class="fn">next_in_block</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="struct.OperationRef.html" title="struct melior::ir::operation::OperationRef">OperationRef</a>&lt;'c, '_&gt;&gt;</h4></section></summary><div class="docblock"><p>Gets the next operation in the same block.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.verify" class="method"><a class="src rightside" href="../../../src/melior/ir/operation.rs.html#226-228">source</a><h4 class="code-header">pub fn <a href="#method.verify" class="fn">verify</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Verifies an operation.</p>
Expand Down
4 changes: 2 additions & 2 deletions src/melior/ir/operation.rs.html
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@
}

<span class="doccomment">/// Sets the attribute with the given name to the given attribute.
</span><span class="kw">pub fn </span>set_attribute(<span class="kw-2">&amp;mut </span><span class="self">self</span>, name: <span class="kw-2">&amp;</span>str, attribute: <span class="kw-2">&amp;</span>Attribute&lt;<span class="lifetime">'c</span>&gt;) {
</span><span class="kw">pub fn </span>set_attribute(<span class="kw-2">&amp;mut </span><span class="self">self</span>, name: <span class="kw-2">&amp;</span>str, attribute: Attribute&lt;<span class="lifetime">'c</span>&gt;) {
<span class="kw">unsafe </span>{
mlirOperationSetAttributeByName(
<span class="self">self</span>.raw,
Expand Down Expand Up @@ -1216,7 +1216,7 @@
);
<span class="macro">assert!</span>(operation.remove_attribute(<span class="string">"foo"</span>).is_ok());
<span class="macro">assert!</span>(operation.remove_attribute(<span class="string">"foo"</span>).is_err());
operation.set_attribute(<span class="string">"foo"</span>, <span class="kw-2">&amp;</span>StringAttribute::new(<span class="kw-2">&amp;</span>context, <span class="string">"foo"</span>).into());
operation.set_attribute(<span class="string">"foo"</span>, StringAttribute::new(<span class="kw-2">&amp;</span>context, <span class="string">"foo"</span>).into());
<span class="macro">assert_eq!</span>(
operation.attribute(<span class="string">"foo"</span>).map(|a| a.to_string()),
<span class="prelude-val">Ok</span>(<span class="string">"\"foo\""</span>.into())
Expand Down
10 changes: 4 additions & 6 deletions src/melior_macro/dialect/generation/attribute_accessor.rs.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@
<a href="#74" id="74">74</a>
<a href="#75" id="75">75</a>
<a href="#76" id="76">76</a>
<a href="#77" id="77">77</a>
</pre></div><pre class="rust"><code><span class="kw">use </span><span class="kw">crate</span>::dialect::operation::{Attribute, OperationField};
<span class="kw">use </span>proc_macro2::TokenStream;
<span class="kw">use </span>quote::quote;
Expand All @@ -100,8 +99,7 @@
<span class="kw">let </span>body = <span class="kw">if </span>attribute.is_unit() {
<span class="macro">quote! </span>{ <span class="self">self</span>.operation.attribute(#name).is_some() }
} <span class="kw">else </span>{
<span class="comment">// TODO Handle returning `melior::Attribute`.
</span><span class="macro">quote! </span>{ <span class="prelude-val">Ok</span>(<span class="self">self</span>.operation.attribute(#name)<span class="question-mark">?</span>.try_into()<span class="question-mark">?</span>) }
<span class="macro">quote! </span>{ <span class="prelude-val">Ok</span>(<span class="self">self</span>.operation.attribute(#name)<span class="question-mark">?</span>.try_into()<span class="question-mark">?</span>) }
};

<span class="macro">quote! </span>{
Expand All @@ -118,14 +116,14 @@
<span class="kw">let </span>body = <span class="kw">if </span>attribute.is_unit() {
<span class="macro">quote! </span>{
<span class="kw">if </span>value {
<span class="self">self</span>.operation.set_attribute(#name, Attribute::unit(<span class="kw-2">&amp;</span><span class="self">self</span>.operation.context()));
<span class="self">self</span>.operation.set_attribute(#name, Attribute::unit(<span class="self">self</span>.operation.context()));
} <span class="kw">else </span>{
<span class="self">self</span>.operation.remove_attribute(#name)
}
}
} <span class="kw">else </span>{
<span class="macro">quote! </span>{
<span class="self">self</span>.operation.set_attribute(#name, <span class="kw-2">&amp;</span>value.into());
<span class="self">self</span>.operation.set_attribute(#name, value.into());
}
};

Expand All @@ -140,7 +138,7 @@
}

<span class="kw">fn </span>generate_remover(attribute: <span class="kw-2">&amp;</span>Attribute) -&gt; <span class="prelude-ty">Option</span>&lt;TokenStream&gt; {
<span class="kw">if </span>attribute.is_unit() || attribute.is_optional() {
<span class="kw">if </span>attribute.is_optional() {
<span class="kw">let </span>name = attribute.name();
<span class="kw">let </span>identifier = attribute.remove_identifier();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
<a href="#25" id="25">25</a>
<a href="#26" id="26">26</a>
<a href="#27" id="27">27</a>
</pre></div><pre class="rust"><code><span class="kw">use </span>quote::{format_ident, quote};
<span class="kw">use </span>syn::GenericArgument;
</pre></div><pre class="rust"><code><span class="kw">use </span>quote::format_ident;
<span class="kw">use </span>syn::{parse_quote, GenericArgument};

<span class="attr">#[derive(Debug)]
</span><span class="kw">pub struct </span>TypeStateItem {
Expand All @@ -40,7 +40,7 @@
<span class="kw">let </span>identifier = <span class="macro">format_ident!</span>(<span class="string">"T{}"</span>, index);

<span class="self">Self </span>{
generic_parameter: syn::parse2(<span class="macro">quote!</span>(#identifier)).expect(<span class="string">"valid GenericArgument"</span>),
generic_parameter: <span class="macro">parse_quote!</span>(#identifier),
field_name,
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,9 @@
<a href="#58" id="58">58</a>
<a href="#59" id="59">59</a>
<a href="#60" id="60">60</a>
<a href="#61" id="61">61</a>
</pre></div><pre class="rust"><code><span class="kw">use </span><span class="kw">super</span>::type_state_item::TypeStateItem;
<span class="kw">use </span>quote::quote;
<span class="kw">use </span>std::iter::repeat;
<span class="kw">use </span>syn::GenericArgument;
<span class="kw">use </span>syn::{parse_quote, GenericArgument};

<span class="attr">#[derive(Debug)]
</span><span class="kw">pub struct </span>TypeStateList {
Expand All @@ -76,8 +74,8 @@
<span class="kw">pub fn </span>new(items: Vec&lt;TypeStateItem&gt;) -&gt; <span class="self">Self </span>{
<span class="self">Self </span>{
items,
unset: syn::parse2(<span class="macro">quote!</span>(::melior::dialect::ods::__private::Unset)).unwrap(),
set: syn::parse2(<span class="macro">quote!</span>(::melior::dialect::ods::__private::Set)).unwrap(),
unset: <span class="macro">parse_quote!</span>(::melior::dialect::ods::__private::Unset),
set: <span class="macro">parse_quote!</span>(::melior::dialect::ods::__private::Set),
}
}

Expand Down

0 comments on commit 6b48778

Please sign in to comment.