Added explicit IndexRegister-PSI-Element. Major rework to support new DocumentationProvider on registers.
When asking for documentation on registers, a code flow analysis is done.
This commit is contained in:
+31
-7
@@ -17,8 +17,10 @@ internal class M68kInstructionDocumentationProviderTest : AbstractDocumentationP
|
||||
mo<caret>veq.l #40,d0
|
||||
"""
|
||||
)
|
||||
assertThat(generateDocumentation(myFixture)).isEqualTo(
|
||||
"""<div class="definition"><pre><b>Move Quick</b></pre></div><div class="content"><table class="sections"><tr><td class="section" valign="top">Mnemonic</td><td class="section" valign="top">Op1</td><td class="section" valign="top">Op2</td></tr><tr><td valign="top"><p>moveq.l</p></td><td valign="top"><p>#<xxx></p></td><td valign="top"><p>Dn</p></td></tr><br/></table></div>"""
|
||||
assertThat(generateDocumentation(myFixture)).isEqualToIgnoringWhitespace(
|
||||
"""
|
||||
<div class="definition"><pre><b>Move Quick</b></pre></div><div class="content"><table class="sections"><tr><td class="section" valign="top">Mnemonic</td><td class="section" valign="top">Op1</td><td class="section" valign="top">Op2</td></tr><tr><td valign="top"><div>moveq.l</div></td><td valign="top"><div>#<xxx></div></td><td valign="top"><div>Dn</div></td></tr></table></div>
|
||||
"""
|
||||
)
|
||||
}
|
||||
|
||||
@@ -29,8 +31,32 @@ internal class M68kInstructionDocumentationProviderTest : AbstractDocumentationP
|
||||
bra.<caret>s label
|
||||
"""
|
||||
)
|
||||
assertThat(generateDocumentation(myFixture)).isEqualTo(
|
||||
"""<div class="definition"><pre><b>Branch</b></pre></div><div class="content"><table class="sections"><tr><td class="section" valign="top">Mnemonic</td><td class="section" valign="top">Op1</td><td class="section" valign="top">Op2</td></tr><tr><td valign="top"><p>bra.s</p><p>bra.b</p><p>bra.w</p></td><td valign="top"><p>(xxx).w|l</p></td><td valign="top"></td></tr><br/></table></div>"""
|
||||
assertThat(generateDocumentation(myFixture)).isEqualToIgnoringWhitespace(
|
||||
"""
|
||||
<div class="definition">
|
||||
<pre><b>Branch</b></pre>
|
||||
</div>
|
||||
<div class="content">
|
||||
<table class="sections">
|
||||
<tr>
|
||||
<td class="section" valign="top">Mnemonic</td>
|
||||
<td class="section" valign="top">Op1</td>
|
||||
<td class="section" valign="top">Op2</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">
|
||||
<div>bra.s</div>
|
||||
<div>bra.b</div>
|
||||
<div>bra.w</div>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<div>(xxx).w|l</div>
|
||||
</td>
|
||||
<td valign="top"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
"""
|
||||
)
|
||||
}
|
||||
|
||||
@@ -41,9 +67,7 @@ internal class M68kInstructionDocumentationProviderTest : AbstractDocumentationP
|
||||
<caret>reset
|
||||
"""
|
||||
)
|
||||
assertThat(generateDocumentation(myFixture)).isEqualTo(
|
||||
"""<div class="definition"><pre><b>Reset External Devices</b></pre><p><font color="red">(privileged)</font></p></div><div class="content"><table class="sections"><tr><td class="section" valign="top">Mnemonic</td><td class="section" valign="top">Op1</td><td class="section" valign="top">Op2</td></tr><tr><td valign="top"><p>reset</p></td><td valign="top"></td><td valign="top"></td></tr><br/></table></div>"""
|
||||
)
|
||||
assertThat(generateDocumentation(myFixture)).contains("Reset External Devices", "(privileged)")
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+74
-2
@@ -11,21 +11,93 @@ import org.junit.jupiter.api.extension.ExtendWith
|
||||
internal class M68kRegisterFlowDocumentationProviderTest : AbstractDocumentationProviderTest() {
|
||||
|
||||
@Test
|
||||
internal fun check_documentation_for_a_symbol_definition(@MyFixture myFixture: CodeInsightTestFixture) {
|
||||
internal fun check_documentation_for_a_register_in_code_flow(@MyFixture myFixture: CodeInsightTestFixture) {
|
||||
myFixture.configureByText(
|
||||
"documentme.asm", """
|
||||
label
|
||||
moveq.l #0,d0
|
||||
add.w #1,d0
|
||||
move.l d1,-(sp)
|
||||
move.w d0,d1
|
||||
move.b d2,d0
|
||||
addq.b #1,d0
|
||||
move.w d<caret>0,d1
|
||||
move.l d0,d2
|
||||
move.w d1,d2
|
||||
clr.b d0
|
||||
moveq.l #0,d0
|
||||
move.l (sp)+,d1
|
||||
rts
|
||||
nextlabel
|
||||
"""
|
||||
)
|
||||
assertThat(generateDocumentation(myFixture)).isEqualTo("d0")
|
||||
assertThat(generateDocumentation(myFixture))
|
||||
.isEqualToIgnoringWhitespace(
|
||||
"""
|
||||
<div class="definition">move instruction reads d0.w</div>
|
||||
<table class="sections" style="padding-left: 8pt; padding-right: 8pt">
|
||||
<tr>
|
||||
<td valign="top"></td>
|
||||
<td valign="top"><code>moveq.l #0,<font color="red">d0</font></code></td>
|
||||
<td valign="top"> ; <i>sets d0.l</i></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top"></td>
|
||||
<td valign="top"><code>add.w #1,<font color="red">d0</font></code></td>
|
||||
<td valign="top"> ; <i>modifies d0.w</i></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top"> </td>
|
||||
<td valign="top">
|
||||
<div class="grayed">[...]</div>
|
||||
</td>
|
||||
<td valign="top"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top"></td>
|
||||
<td valign="top"><code>move.w <font color="red">d0</font>,d1</code></td>
|
||||
<td valign="top"> ; <i>reads d0.w</i></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top"></td>
|
||||
<td valign="top"><code>move.b d2,<font color="red">d0</font></code></td>
|
||||
<td valign="top"> ; <i>sets d0.b</i></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top"></td>
|
||||
<td valign="top"><code>addq.b #1,<font color="red">d0</font></code></td>
|
||||
<td valign="top"> ; <i>modifies d0.b</i></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top"></td>
|
||||
<td valign="top"><b><code>move.w <font color="red">d0</font>,d1</code></b></td>
|
||||
<td valign="top"> ; <--</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top"></td>
|
||||
<td valign="top"><code>move.l <font color="red">d0</font>,d2</code></td>
|
||||
<td valign="top"> ; <i>reads d0.l</i></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top"> </td>
|
||||
<td valign="top">
|
||||
<div class="grayed">[...]</div>
|
||||
</td>
|
||||
<td valign="top"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top"></td>
|
||||
<td valign="top"><code>clr.b <font color="red">d0</font></code></td>
|
||||
<td valign="top"> ; <i>sets d0.b</i></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top"></td>
|
||||
<td valign="top"><code>moveq.l #0,<font color="red">d0</font></code></td>
|
||||
<td valign="top"> ; <i>sets d0.l</i></td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="content"/>
|
||||
""".trimIndent()
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user