예제 #1
0
        public void Accept(CIL_VCall vCall)
        {
            int i = -12;

            foreach (var arg in vCall.Args)
            {
                if (int.TryParse(arg, out int n))
                {
                    Text += "\t li $a0, " + n + "\n" +
                            "\t sw $a0, " + i + "($sp) \n";
                }
                else
                {
                    Text += "\t lw $a0, " + CurrentScope.VarInStack[arg] + "($fp) \n" +
                            "\t sw $a0, " + i + "($sp) \n";
                }

                i -= 4;
            }

            var attr = Clases[vCall.MyType].GetMethod(vCall.Name);
            var indx = Clases[vCall.MyType].AllMethods().IndexOf(attr);

            Text += "\t la $a0, vt." + vCall.MyType + "\n" +
                    "\t lw $a1, " + (4 * (indx + 1)) + "($a0) \n" +
                    "\t jal $a1 \n" +
                    "\t sw $v0, " + CurrentScope.VarInStack[vCall.Dest] + "($fp) \n";
        }
예제 #2
0
 public void Accept(CIL_VCall vCall)
 {
     throw new System.NotImplementedException();
 }