Exemplo n.º 1
0
        public override void VisitMethodDeclaration(IMethodDeclaration decl, SST context)
        {
            _cancellationToken.ThrowIfCancellationRequested();

            if (decl.DeclaredElement != null)
            {
                var methodName = decl.DeclaredElement.GetName <IMethodName>();

                var sstDecl = new MethodDeclaration
                {
                    Name         = methodName,
                    IsEntryPoint = _entryPoints.Contains(methodName)
                };
                context.Methods.Add(sstDecl);

                if (decl == _marker.AffectedNode)
                {
                    sstDecl.Body.Add(new ExpressionStatement {
                        Expression = new CompletionExpression()
                    });
                }

                if (!decl.IsAbstract)
                {
                    var bodyVisitor = new BodyVisitor(new UniqueVariableNameGenerator(), _marker);

                    Execute.AndSupressExceptions(
                        delegate { decl.Accept(bodyVisitor, sstDecl.Body); });
                }
            }
        }