public static Arg NewVar(BlockBase parent, VarDeclare target) { var ret = new Arg(); ret.init1(parent, target.Name, null); ret.target = target; return ret; }
public static Var New(BlockBase parent, VarDeclare var) { var ret = new Var(); ret.Parent = parent; ret.name = var.Name; ret.Reference = var; return ret; }
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; }
public static VarDeclare New(BlockBase parent, string name, TypeBase type) { var ret = new VarDeclare(); ret.init1(parent, name, type); return ret; }
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; }
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; }
protected bool ArgNeededGC(VarDeclare arg) { if (arg.Name == "this") return false; var tr = arg.Type as TypeReference; return tr != null && tr.UseGC; }
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; }
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)); } }