Esempio n. 1
0
        private List <StatementSyntax> GetFlowBuildBody()
        {
            var builder = IdentifierName("builder");

            var statements = new List <StatementSyntax>();

            if (myScheme.DefaultFaultHandlerType != null)
            {
                statements.Add(
                    AddDefaultXxxHandler(builder, "WithDefaultFaultHandler", myScheme.DefaultFaultHandlerType));
            }

            if (myScheme.DefaultCancellationHandlerType != null)
            {
                statements.Add(
                    AddDefaultXxxHandler(builder, "WithDefaultCancellationHandler", myScheme.DefaultCancellationHandlerType));
            }

            var schemeDeclarator = new SchemeDeclarator(statements, this, builder);

            schemeDeclarator.AddDeclarations(myScheme.Nodes, myScheme.GlobalVariables);

            if (myScheme.IntialNode != null)
            {
                statements.Add(SetInitialNode(builder, IdentifierName(GetVariableOf(myScheme.IntialNode))));
            }

            return(statements);
        }
Esempio n. 2
0
        public void Visit(BlockInfo node)
        {
            var blockVariable = myVariableManager.GetVariableName();

            myVariableManager.AddVariable(node, blockVariable);

            var outerBuilder  = myVariableManager.GetVariableName();
            var nestedBuilder = myVariableManager.GetVariableName();

            var nestedStatements = new List <StatementSyntax>();

            var nestedDeclarator = new SchemeDeclarator(
                nestedStatements,
                myVariableManager,
                IdentifierName(nestedBuilder));

            nestedDeclarator.AddDeclarations(node.Nodes, node.Variables);

            var declaration = CreateBlock(
                node.Description,
                blockVariable,
                outerBuilder, nestedBuilder,
                nestedStatements);

            myStatements.Add(declaration);
        }