Conversation
|
|
||
| namespace TypeCobol.Analysis.Graph | ||
| { | ||
| public partial class ControlFlowGraph<N, D> |
There was a problem hiding this comment.
I think partial class are harder to read.
As this class and some others are moving to another source file, isn't not possible to declare them as top class rather than under public partial class ControlFlowGraph<N, D> ?
There was a problem hiding this comment.
I tried at first to turn them into regular classes but I stopped because of the generic parameters. As nested classes of ControlFlowGraph<N, D> they are implicitly generic. Sentence references BasicBlock<N, D> so all inheritors and users of Sentence must be generic too at this point.
| /// </summary> | ||
| public class JumpTarget | ||
| { | ||
| private readonly List<Sentence> _sentences; |
There was a problem hiding this comment.
Why do we need to store sentences ?
The target of a perform or a go to is a paragraph, a section or a range of paragraph/section. So the references to procedure(s) should be enough.
There was a problem hiding this comment.
The sentence accumulation mechanism in case of a range is not trivial, as we need to compute the sentence list for the perform block cloning, we compute the list here and store for re-use. Also the listing of procedure themselves is done through this accumulation process so we get both sentences and procedure in one go.
Cancels and replaces #2052.
The cycle detection will be done outside of the parser but now we build a
JumpTargetfor eachPERFORMorGO TOinstruction. Targets for these jump instructions are stored in the resulting graph object and publicly accessible.