private TripleObject BuildToTriple(Instruction toInstruction, string toInstanceOwnerKey, MethodDefinition parentMethod, int?toArgumentCounter = null) { var tripleObj = new TripleObject(); tripleObj.Instruction = toInstruction; var toObjectType = InstructionKeyService.GetToObjectType(toInstruction); tripleObj.ObjectType = toObjectType; tripleObj.InstanceOwnerKey = toInstanceOwnerKey; if (toObjectType == ObjectType.Argument) { var methodCallReference = (MethodReference)toInstruction.Operand; tripleObj.ObjectKey = InstructionKeyService.GetObjectKey(toInstruction, toObjectType, methodCallReference, toArgumentCounter.Value); } else { tripleObj.ObjectKey = InstructionKeyService.GetObjectKey(toInstruction, toObjectType, parentMethod); } tripleObj.InstructionKey = InstructionKeyService.GetInstructionKey(toInstruction, parentMethod); tripleObj.OwnerTypeCategory = InstructionKeyService.GetTypeCategory(toInstruction); tripleObj.OwnerTypeKey = InstructionKeyService.GetTypeKey(toInstruction); tripleObj.InheritsFromConcreteClass = InstructionKeyService.GetConcreteInheritance(toInstruction); return(tripleObj); }
private bool IsSupportedToObject(Instruction instruction) { var toObjectType = InstructionKeyService.GetToObjectType(instruction); if (!InstructionKeyService.IsSupportedObject(toObjectType)) { return(false); } return(true); }
private void ParseInstruction(Instruction instruction, MethodDefinition parentMethod, List <Triple> triples, string constructorInstructionKey = null) { var toObjectType = InstructionKeyService.GetToObjectType(instruction); if (!InstructionKeyService.IsSupportedObject(toObjectType)) { return; } if (toObjectType == ObjectType.Argument) { var argumentTriples = GetMethodCallArgumentTriples(parentMethod, instruction, constructorInstructionKey); foreach (var argumentTriple in argumentTriples) { triples.Add(argumentTriple); } } else if (toObjectType == ObjectType.NilArgument) { var triple = GetNilArgumentTriple(instruction, parentMethod); if (triple != null) { triples.Add(triple); } } else if (toObjectType == ObjectType.ReturnValue && parentMethod.FullName.StartsWith("System.Void")) { } else { var triple = GetGenericTriple(instruction, parentMethod, toObjectType); if (triple != null) { triples.Add(triple); } } }