internal override ReferenceBTValue FromStack() { ReferenceBTValue val = new ReferenceBTValue(PrimitiveBTValue.PrimitiveType(), this.btType); val.Creators.AddCreators(this.crtrs); return(val); }
internal static Creators Merge(BTValue val1, BTValue val2) { if (val1 == null || val2 == null) { return(new Creators()); } else if (val1 is PrimitiveBTValue && val2 is PrimitiveBTValue) { return(PrimitiveBTValue.Merge(val1 as PrimitiveBTValue, val2 as PrimitiveBTValue)); } else if (val1 is ReferenceBTValue && val2 is ReferenceBTValue) { return(ReferenceBTValue.Merge(val1 as ReferenceBTValue, val2 as ReferenceBTValue)); } else if (val1 is PrimitiveBTValue) { return((val1 as PrimitiveBTValue).ToReferenceBTValueCreators()); } else if (val2 is PrimitiveBTValue) { return((val2 as PrimitiveBTValue).ToReferenceBTValueCreators()); } else { throw new InternalException(); } }
internal BTValue ToStack(Type type) { ReferenceBTValue val = this.findLeaf(); if (PrimitiveBTValue.CheckType(type)) { val.addType(PrimitiveBTValue.PrimitiveType()); //!!!!!!!!!!!! return(new PrimitiveBTValue(val.btType)); } else { return(val); } }
internal static Creators Merge(PrimitiveBTValue val1, PrimitiveBTValue val2) { if (val1.btType == val2.btType) { return(new Creators()); } else if (val1.btType == BTType.Static) { return(val1.Lift()); } else if (val2.btType == BTType.Static) { return(val2.Lift()); } else { throw new InternalException(); } }
public override bool Equals(object o) { if (o is ReferenceBTValue) { ReferenceBTValue val1 = this.findLeaf(); ReferenceBTValue val2 = (o as ReferenceBTValue).findLeaf(); if (val1.btType == BTType.Dynamic && val2.btType == BTType.Dynamic) { return(true); } else if (val1.types.Count == 1 && val1.types[0] == PrimitiveBTValue.PrimitiveType() && val2.types.Count == 1 && val2.types[0] == PrimitiveBTValue.PrimitiveType()) { return(val1.btType == val2.btType); } else { return(val1 == val2); } } else { return(false); } }
internal static Creators PseudoMerge(PrimitiveBTValue val1, PrimitiveBTValue val2) { if (val1.btType == val2.btType) return new Creators(); else if (val1.btType == BTType.Static) return val1.crtrs; else if (val2.btType == BTType.Static) return val2.crtrs; else throw new InternalException(); }
protected override void VisitLoadLength(LoadLength upNode, object o) { State state = o as State; ReferenceBTValue arr = state.Stack.Pop() as ReferenceBTValue; BTType btType = arr.BTType; PrimitiveBTValue length = new PrimitiveBTValue(btType); state.Stack.Push(length); Annotation.SetNodeBTType(upNode, btType); }
protected override void VisitLoadConst(LoadConst upNode, object o) { State state = o as State; BTValue val = new PrimitiveBTValue(BTType.Static); state.Stack.Push(val); Annotation.SetNodeBTType(upNode, BTType.Static); }
protected override void VisitBinaryOp(BinaryOp upNode, object o) { State state = o as State; BTValue val2 = state.Stack.Pop() as BTValue; BTValue val1 = state.Stack.Pop() as BTValue; if (val1.BTType == val2.BTType) { BTValue val3 = new PrimitiveBTValue(val1.BTType); state.Stack.Push(val3); Annotation.SetNodeBTType(upNode, val3.BTType); } else if (val1.BTType == BTType.Static) throw new LiftException(val1); else if (val2.BTType == BTType.Static) throw new LiftException(val2); else throw new InternalException(); }