public static bool Analyze(AstNode node)
            {
                var obj = new IsIteratorBlockVisitor();

                node.AcceptVisitor(obj);
                return(obj._result);
            }
        public JsFunctionDefinitionExpression CompileMethod(EntityDeclaration entity, BlockStatement body, IMethod method, MethodScriptSemantics impl)
        {
            bool             isIEnumerable = method.ReturnType.IsKnownType(KnownTypeCode.IEnumerable) || method.ReturnType.IsKnownType(KnownTypeCode.IEnumerableOfT);
            bool             isIEnumerator = method.ReturnType.IsKnownType(KnownTypeCode.IEnumerator) || method.ReturnType.IsKnownType(KnownTypeCode.IEnumeratorOfT);
            StateMachineType smt           = StateMachineType.NormalMethod;
            IType            iteratorBlockYieldTypeOrAsyncTaskGenericArgument = null;

            if ((isIEnumerable || isIEnumerator) && IsIteratorBlockVisitor.Analyze(body))
            {
                smt = isIEnumerable ? StateMachineType.IteratorBlockReturningIEnumerable : StateMachineType.IteratorBlockReturningIEnumerator;
                iteratorBlockYieldTypeOrAsyncTaskGenericArgument = method.ReturnType is ParameterizedType ? ((ParameterizedType)method.ReturnType).TypeArguments[0] : _compilation.FindType(KnownTypeCode.Object);
            }
            else if (entity.HasModifier(Modifiers.Async))
            {
                smt = (method.ReturnType.IsKnownType(KnownTypeCode.Void) ? StateMachineType.AsyncVoid : StateMachineType.AsyncTask);
                iteratorBlockYieldTypeOrAsyncTaskGenericArgument = method.ReturnType is ParameterizedType ? ((ParameterizedType)method.ReturnType).TypeArguments[0] : null;
            }

            CreateCompilationContext(entity, method, method.DeclaringTypeDefinition, (impl.Type == MethodScriptSemantics.ImplType.StaticMethodWithThisAsFirstArgument ? _namer.ThisAlias : null));
            return(_statementCompiler.CompileMethod(method.Parameters, variables, body, impl.Type == MethodScriptSemantics.ImplType.StaticMethodWithThisAsFirstArgument, impl.ExpandParams, smt, iteratorBlockYieldTypeOrAsyncTaskGenericArgument));
        }