Пример #1
0
        public string Visit(Increment node)
        {
            var st = $"// Start {node.GetType()} \n";

            if (currentFunction != null && globalFunctions[currentFunction].localVariables[node.AnchorToken.Lexeme].isParameter)
            {
                st += "\t\tldarg " + node.AnchorToken.Lexeme + "\n";
            }
            else
            {
                st += "\t\tldloc " + node.AnchorToken.Lexeme + "\n";
            }
            st += "\t\tldc.i4.1\n";
            st += "\t\tadd.ovf\n";
            if (currentFunction != null && globalFunctions[currentFunction].localVariables[node.AnchorToken.Lexeme].isParameter)
            {
                st += "\t\tstarg " + node.AnchorToken.Lexeme + "\n";
            }
            else
            {
                st += "\t\tstloc " + node.AnchorToken.Lexeme + "\n";
            }
            st += $"// End {node.GetType()} \n";

            return(st);
        }