Пример #1
0
        public IfElseStatement(ConditionalBlockStatement mainIf, StatementInfo info)
        {
            MainIf = mainIf;
            Info   = info;

            TraversableChildren = StatementHelpers.CreateChildren(mainIf);
            Branches            = new[] { mainIf.Statement };
        }
Пример #2
0
        public SwitchCaseStatement(EvaluationStatement switchTarget, ConditionalBlockStatement[] cases, StatementInfo info)
        {
            SwitchTarget = switchTarget;
            Cases        = cases;
            Info         = info;

            TraversableChildren = StatementHelpers.CreateChildren(new IStatement[] { switchTarget }.Union(cases).ToArray());
            Branches            = cases.Select(x => x.Statement).ToArray();
        }
Пример #3
0
        public EchoStatement(
            EvaluationStatement[] parameters, StatementInfo info)
        {
            Parameters = parameters;
            Info       = info;

            // ReSharper disable once CoVariantArrayConversion
            TraversableChildren = StatementHelpers.CreateChildren(parameters);
        }
Пример #4
0
        public DefinitionStatement(TypeDescriptor typeDescriptor, string name, EvaluationStatement defaultValue,
                                   bool hasDefaultValue, StatementInfo info)
        {
            TypeDescriptor  = typeDescriptor;
            Name            = name;
            DefaultValue    = defaultValue;
            HasDefaultValue = hasDefaultValue;
            Info            = info;

            TraversableChildren = StatementHelpers.CreateChildren(defaultValue);
        }
        public BitwiseEvaluationStatement(EvaluationStatement left, BitwiseOperator @operator,
                                          EvaluationStatement right, StatementInfo info, IStatement parentStatement = null)
        {
            Left            = left;
            Operator        = @operator;
            Right           = right;
            Info            = info;
            ParentStatement = parentStatement;

            TraversableChildren = StatementHelpers.CreateChildren(left, @operator, right);
        }
Пример #6
0
        public IfElseStatement(ConditionalBlockStatement mainIf, IStatement @else, StatementInfo info)
        {
            MainIf = mainIf;
            Else   = @else;
            Info   = info;

            TraversableChildren = StatementHelpers.CreateChildren(mainIf, @else);
            Branches            = mainIf?.Statement != null
                ? new[] { mainIf.Statement, @else }
                : new[] { @else };
        }
Пример #7
0
        public ArithmeticEvaluationStatement(EvaluationStatement left, ArithmeticOperator @operator,
                                             EvaluationStatement right, StatementInfo info, IStatement parentStatement = null)
        {
            CanBeEmbedded   = false;
            Left            = left;
            Operator        = @operator;
            Right           = right;
            Info            = info;
            ParentStatement = parentStatement;

            TraversableChildren = StatementHelpers.CreateChildren(left, @operator, right);
        }
Пример #8
0
        public FunctionCallStatement(string className, string functionName, TypeDescriptor typeDescriptor,
                                     EvaluationStatement[] parameters, StatementInfo info, IStatement parentStatement = null)
        {
            ClassName       = className;
            FunctionName    = functionName;
            Parameters      = parameters;
            Info            = info;
            TypeDescriptor  = typeDescriptor;
            ParentStatement = parentStatement;

            // ReSharper disable once CoVariantArrayConversion
            TraversableChildren = StatementHelpers.CreateChildren(parameters);
        }
Пример #9
0
        public FunctionStatement(TypeDescriptor typeDescriptor, string name,
                                 FunctionParameterDefinitionStatement[] parameters, IStatement statement, StatementInfo info)
        {
            TypeDescriptor = typeDescriptor;
            Name           = name;
            Statement      = statement;
            Info           = info;
            Parameters     = parameters;

            if (parameters != null)
            {
                TraversableChildren =
                    StatementHelpers.CreateChildren(new IStatement[] { statement }.Union(parameters).ToArray());
            }
            else
            {
                TraversableChildren =
                    StatementHelpers.CreateChildren(statement);
            }
        }