Пример #1
0
        public override TreeNode GetAstCodeGenerator(SymbolTable t)
        {
            List <MIPSCodeGenerator.Expression> codeExpr = new List <MIPSCodeGenerator.Expression>();

            for (int i = 0; i < arg.Count; i++)
            {
                codeExpr.Add((MIPSCodeGenerator.Expression)Arg[i].GetAstCodeGenerator(t));
                //Arg[i].SetGeneratorType(codeExpr[i]);
            }
            MIPSCodeGenerator.Expression obj = null;
            if (name != null && name != "")
            {
                obj      = new MIPSCodeGenerator.Object(t.AddString(name));
                obj.Type = typeName;
            }
            else if (exprDispatched != null)
            {
                obj = (MIPSCodeGenerator.Expression)exprDispatched.GetAstCodeGenerator(t);
                exprDispatched.SetGeneratorType(obj);
            }
            else
            {
                obj = new MIPSCodeGenerator.Object(t.AddString("self"), Line); obj.Type = typeName;
            }


            if (Type == null || Type == "")
            {
                MIPSCodeGenerator.Dispatch d = new MIPSCodeGenerator.Dispatch(t.AddString(methodName), obj, codeExpr, Line);
                SetGeneratorType(d);
                return(d);
            }
            else
            {
                StaticDispatch sd = new StaticDispatch(t.AddString(methodName), t.AddString(Type), obj, codeExpr, Line);
                SetGeneratorType(sd);
                return(sd);
            }
        }
Пример #2
0
 public override TreeNode GetAstCodeGenerator(SymbolTable t)
 {
     MIPSCodeGenerator.Object obj = new MIPSCodeGenerator.Object(t.AddString(name));
     SetGeneratorType(obj);
     return(obj);
 }