예제 #1
0
        public override void GenerateSlots(IList <Slot> newSlots, SlotGeneratorContext context)
        {
            if (context.Compilation != null && !string.IsNullOrEmpty(Expression))
            {
                // Parse expression
                var expression = ParseExpression(Expression);

                // Create a block that returns this expression for further analysis
                var block = Block(
                    SingletonList <StatementSyntax>(
                        ReturnStatement(ParenthesizedExpression(expression))));

                RoslynHelper.AnalyzeBlockFlow(newSlots, context.Compilation, block);
            }
        }
예제 #2
0
        public override void GenerateSlots(IList <Slot> newSlots, SlotGeneratorContext context)
        {
            newSlots.Add(InputExecutionSlotDefinition);
            newSlots.Add(OutputExecutionSlotDefinition);

            if (context.Compilation != null && !string.IsNullOrEmpty(Code))
            {
                var statement = ParseStatement($"{{ {Code} }}");

                var block = statement as BlockSyntax;
                if (block != null)
                {
                    RoslynHelper.AnalyzeBlockFlow(newSlots, context.Compilation, block);
                }
            }
        }