Exemple #1
0
 public static Arg NewVar(BlockBase parent, VarDeclare target)
 {
     var ret = new Arg();
     ret.init1(parent, target.Name, null);
     ret.target = target;
     return ret;
 }
Exemple #2
0
 public static Var New(BlockBase parent, VarDeclare var)
 {
     var ret = new Var();
     ret.Parent = parent;
     ret.name = var.Name;
     ret.Reference = var;
     return ret;
 }
Exemple #3
0
 public static TypeDelegate New(
     BlockBase parent, CallType callType, TypeBase retType, VarDeclare[] args)
 {
     var ret = new TypeDelegate();
     ret.init(callType, retType, args);
     ret.Parent = parent;
     return ret;
 }
Exemple #4
0
 public static VarDeclare New(BlockBase parent, string name, TypeBase type)
 {
     var ret = new VarDeclare();
     ret.init1(parent, name, type);
     return ret;
 }
Exemple #5
0
 protected void init(CallType callType, TypeBase retType, VarDeclare[] args)
 {
     CallType = callType;
     RetType = retType;
     var list = new ArrayList();
     if (args == null)
         HasParams = true;
     else
         for (int i = 0; i < args.Length; i++)
         {
             var arg = args[i];
             if (arg is ArgPtr)
                 HasParams = true;
             else
                 list.Add(arg);
         }
     var ret = new VarDeclare[list.Count];
     for (int i = 0; i < ret.Length; i++)
         ret[i] = list[i] as VarDeclare;
     this.Args = ret;
 }
Exemple #6
0
 public static TypeFunction New(Function f)
 {
     var ret = new TypeFunction();
     var args = new VarDeclare[f.Args.Count];
     for (int i = 0; i < args.Length; i++)
         args[i] = f.Args[i] as VarDeclare;
     ret.init(f.CallType, f.ReturnType, args);
     return ret;
 }
Exemple #7
0
 protected bool ArgNeededGC(VarDeclare arg)
 {
     if (arg.Name == "this") return false;
     var tr = arg.Type as TypeReference;
     return tr != null && tr.UseGC;
 }
Exemple #8
0
 public VarDeclare[] GetAutoArgs()
 {
     if (autoArgs.Count == 0) return null;
     var ret = new VarDeclare[autoArgs.Count];
     for (int i = 0; i < ret.Length; i++)
         ret[i] = autoArgs[i] as VarDeclare;
     return ret;
 }
Exemple #9
0
        public override void AddDestructors(OpModule codes, VarDeclare[] ptrs)
        {
            base.AddDestructors(codes, ptrs);

            var args2 = args.ToArray();
            for (int i = args2.Length - 1; i >= 0; i--)
            {
                var arg = args2[i] as VarDeclare;
                if (ArgNeededGC(arg))
                    arg.Type.AddDestructorA(codes, arg.GetAddress(codes, this));
            }
        }