public override bool Equals(object obj) { MethodInstruction other = obj as MethodInstruction; if (other == null) { return(false); } if (OpCode != other.OpCode) { return(false); } if (Condition != other.Condition) { return(false); } if (Operand == null && other.Operand == null) { return(true); } if (Operand == null || other.Operand == null) { return(false); } if (!Operand.Equals(other.Operand)) { return(false); } return(true); }
public void PushGlobalAddress(Symbol symbol) { MethodInstruction push = new MethodInstruction(MethodOpCode.PushGblA, symbol); if (push.Equals(LastInstruction())) { Dup(); } else { _deferredInstructions.Add(push); } }
public void PushLocalAddress(int i) { MethodInstruction push = new MethodInstruction(MethodOpCode.PushLocA, i); if (push.Equals(LastInstruction())) { Dup(); } else { _deferredInstructions.Add(push); } }
public InstructionList CreateVelocityListAtTime(double time) { // This will create instructions for all goal starting at the argument // time and after. InstructionList instructionListAtTime = KeyframeAtOrBefore(time); int indexToBeginAt = IndexOf(instructionListAtTime); InstructionList instructionList = new InstructionList(); for (int i = indexToBeginAt; i < Count; i++) { instructionList.AddRange(CreateVelocityListAtIndex(i)); if (i != indexToBeginAt || (instructionListAtTime.Count != 0 && instructionListAtTime[0].TimeToExecute >= time)) { foreach (Instruction instruction in this[i]) { instructionList.Add(instruction.Clone()); } } } if (mInstructionToExecuteAtEnd != null && instructionList.Count != 0) { MethodInstruction lastInstruction = mInstructionToExecuteAtEnd.Clone <MethodInstruction>(); lastInstruction.TimeToExecute = instructionList[instructionList.Count - 1].TimeToExecute; instructionList.Add(lastInstruction); } return(instructionList); }
public void BranchTrue(int i) { MethodInstruction last = LastInstruction(); if (last != null && last.OpCode == MethodOpCode.Operator) { Operator opr = (Operator)last.Operand; if (IsUnaryNotOperator(opr)) { RemoveLastInstruction(); BranchFalse(i); return; } else if (IsComparisonOperator(opr)) { RemoveLastInstruction(); BranchCondition(opr, i); return; } } _deferredInstructions.Add(new MethodInstruction(MethodOpCode.BranchTrue, i)); }
public void PushGlobalAddress(Symbol symbol) { MethodInstruction push = new MethodInstruction(MethodOpCode.PushGblA, symbol); if (push.Equals(LastInstruction())) Dup(); else _deferredInstructions.Add(push); }
public void PushLocalAddress(int i) { MethodInstruction push = new MethodInstruction(MethodOpCode.PushLocA, i); if (push.Equals(LastInstruction())) Dup(); else _deferredInstructions.Add(push); }
public void PushArgument(int i) { MethodInstruction push = new MethodInstruction(MethodOpCode.PushArg, i); if (push.Equals(LastInstruction())) Dup(); else _deferredInstructions.Add(push); }