Documentation on com.intellij.codeInsight.controlflow.Instruction's implemented classes.

Answered

Hello,

I was exploring python's control flow provider (PyControlFlowProvier). Then I came across com.intellij.codeInsight.controlflow.Instruction interface. The elements of control flow are implemented classes from com.intellij.codeInsight.controlflow.Instruction interface.

The implemented classes of Instruction are:

Now I've come across ReadWriteInstruction, ConditionalInstruction, and InstructionBase classes and understood what these are used for.

I would like to have some insight on TransparentInstruction and DetachedInstructionImpl classes.

Do you guys have any sort of documentation on this?

It would be really helpful to understand.

3 comments
Comment actions Permalink

from com.intellij.codeInsight.controlflow.TransparentInstruction javadoc:

Marker interface for instructions that can be replaced by direct connection between predecessors and successors.

 

TBC

1
Comment actions Permalink

Hi!

Just a small clarification about TransparentInstruction:

>Marker interface for instructions that can be replaced by direct connection between predecessors and successors.

Actually, I think the info isn't clear enough. In fact, such instructions are going to be replaced by direct connection between predecessors and successors. In other word the instructions are temporal and created only for convenience. 

The main idea behind DetachedInstructionImpl is that these instructions can be added to the CF later using DetachedInstructionImpl#addToInstructions(builder) as opposed to regular instructions, that are numerated immediately after creating (see InstructionImpl#num()). The order of instructions is very important in many cases, so sometimes it is very handy to use such kind of instructions in complex CF (branching, try-catch handling).

 

 

1

Please sign in to leave a comment.