예제 #1
0
        private static bool?IsCoroutine(IMethodDeclaration methodDeclaration, UnityApi unityApi)
        {
            if (methodDeclaration == null)
            {
                return(null);
            }
            if (!methodDeclaration.IsFromUnityProject())
            {
                return(null);
            }

            var method = methodDeclaration.DeclaredElement;

            if (method == null)
            {
                return(null);
            }

            var function = unityApi.GetUnityEventFunction(method);

            if (function == null || !function.Coroutine)
            {
                return(null);
            }

            var type = method.ReturnType.GetScalarType();

            if (type == null)
            {
                return(null);
            }

            return(Equals(type.GetClrName(), PredefinedType.IENUMERATOR_FQN));
        }