public ProjectIssue Analyze(MethodDefinition methodDefinition, Instruction inst) { if (inst.Previous != null) { return(null); } if (!MonoBehaviourAnalysis.IsMonoBehaviour(methodDefinition.DeclaringType)) { return(null); } if (!MonoBehaviourAnalysis.IsMonoBehaviourMagicMethod(methodDefinition)) { return(null); } return(new ProjectIssue ( k_Descriptor, methodDefinition.FullName, IssueCategory.Code, new CallTreeNode(methodDefinition) )); }
public ProjectIssue Analyze(MethodDefinition methodDefinition, Instruction inst) { // skip any no-op var previousIL = inst.Previous; while (previousIL != null && previousIL.OpCode == OpCodes.Nop) { previousIL = previousIL.Previous; } // if there is no instruction before OpCodes.Ret, then we know this method is empty if (previousIL != null) { return(null); } if (!MonoBehaviourAnalysis.IsMonoBehaviour(methodDefinition.DeclaringType)) { return(null); } if (!MonoBehaviourAnalysis.IsMonoBehaviourEvent(methodDefinition)) { return(null); } return(new ProjectIssue ( k_Descriptor, methodDefinition.FullName, IssueCategory.Code, new CallTreeNode(methodDefinition) )); }
static bool IsPerformanceCriticalContext(MethodDefinition methodDefinition) { if (MonoBehaviourAnalysis.IsMonoBehaviour(methodDefinition.DeclaringType) && MonoBehaviourAnalysis.IsMonoBehaviourUpdateMethod(methodDefinition)) { return(true); } if (ComponentSystemAnalysis.IsComponentSystem(methodDefinition.DeclaringType) && ComponentSystemAnalysis.IsOnUpdateMethod(methodDefinition)) { return(true); } return(false); }