public Instance GetInstance(InternalVariable ivar) { Instance i = null; foreach (var inst in instances) { if (inst.lastPos < ivar.lastAppearance) { i = inst; } } if (i == null) { i = new Instance(); i.name = "iv_" + ivar.type.Name + "_" + instances.Count; //todo: if type is array, [] should be substituted in the Name //todo check parent ivarMan for checking accumulated instances (avoid name collisions) } else { i.recycled = true; } i.lastPos = ivar.lastAppearance; return(i); }
public InternalVariable Set(string ivar, Operation op) { int n = getN(ivar); var iv = new InternalVariable(this, op); vars.Add(n, iv); op.returnVar = iv; return(iv); }