Beispiel #1
0
        private static PCNode GeneratePCStructureForMethodWithBody(MethodInfo methodInfo, HashSet <ArmadaPC> loopHeads)
        {
            ArmadaStatement parsedBody = methodInfo.ParsedBody;
            PCNode          endNode    = new ReturningPCNode(parsedBody.EndPC);
            PCNode          startNode  = parsedBody.GeneratePCStructureForStatement(endNode, null, null, loopHeads);

            return(new StartingPCNode(parsedBody.StartPC, startNode));
        }
Beispiel #2
0
        private static PCNode GeneratePCStructureForMethodWithNoBody(ArmadaSymbolTable symbols, MethodInfo methodInfo, HashSet <ArmadaPC> loopHeads)
        {
            Method method = methodInfo.method;

            var startPC = new ArmadaPC(symbols, method.Name, 0);
            var midPC   = new ArmadaPC(symbols, method.Name, 1);
            var endPC   = new ArmadaPC(symbols, method.Name, 2);

            PCNode endNode         = new ReturningPCNode(endPC);
            PCNode loopRestartNode = new LoopRestartPCNode(midPC);
            PCNode midNode         = new WhilePCNode(midPC, method.externContinueNextRoutine, method.externEndNextRoutine, loopRestartNode, endNode);
            PCNode startNode       = new NormalPCNode(startPC, method.externStartNextRoutine, midNode);

            loopHeads.Add(midPC);
            return(new StartingPCNode(startPC, startNode));
        }