/// <summary> /// Loop over all branches, trying to locate one that is equal to the given opcode /// If the branch is a branch itself, perform the locate recursively. /// </summary> /// <param name="opcode"></param> /// <returns></returns> internal override Opcode Locate(Opcode opcode) { Fx.Assert(!opcode.TestFlag(OpcodeFlags.Branch), ""); for (int i = 0, count = this.branches.Count; i < count; ++i) { Opcode branch = this.branches[i]; if (branch.TestFlag(OpcodeFlags.Branch)) { // The branch is itself a branch. Since branch opcodes serve as branches in the exection // path for a query, but don't comprise one of the opcodes used to actually perform it, we // recursively try to locate an equivalent opcode inside the branch Opcode subBranch = branch.Locate(opcode); if (null != subBranch) { return(subBranch); } } else if (branch.Equals(opcode)) { return(branch); } } return(null); }
internal override Opcode Locate(Opcode opcode) { int num = 0; int count = this.branches.Count; while (num < count) { Opcode opcode2 = this.branches[num]; if (opcode2.TestFlag(OpcodeFlags.Branch)) { Opcode opcode3 = opcode2.Locate(opcode); if (opcode3 != null) { return(opcode3); } } else if (opcode2.Equals(opcode)) { return(opcode2); } num++; } return(null); }