Пример #1
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        /// <param name="node">対象Node</param>
        /// <param name="semanticModel">対象ソースのsemanticModel</param>
        /// <param name="parent">親IAnalyzeItem</param>
        /// <param name="container">イベントコンテナ</param>
        public ItemIf(IfStatementSyntax node, SemanticModel semanticModel, IAnalyzeItem parent, EventContainer container) : base(parent, node, semanticModel, container)
        {
            ItemType = ItemTypes.MethodStatement;

            var condition = semanticModel.GetOperation(node.Condition);

            Conditions.AddRange(OperationFactory.GetExpressionList(condition, container));

            TrueBlock.AddRange(GetBlock(node.Statement, semanticModel));
            FalseBlocks.AddRange(GetElseBlock(node.Else));

            List <IAnalyzeItem> GetElseBlock(ElseClauseSyntax elseNode)
            {
                var result = new List <IAnalyzeItem>();

                if (elseNode is null)
                {
                    return(result);
                }

                result.Add(ItemFactory.Create(elseNode, semanticModel, container, parent));

                // else ifの場合はさらに続ける
                if (elseNode.Statement is IfStatementSyntax ifNode)
                {
                    result.AddRange(GetElseBlock(ifNode.Else));
                }

                return(result);
            }
        }
Пример #2
0
 internal CompoundSqlCondition Add(CompoundSqlCondition condition)
 {
     if (ReferenceEquals(Combinator, condition.Combinator))
     {
         Conditions.AddRange(condition.Conditions);
     }
     else
     {
         Conditions.Add(condition);
     }
     return(this);
 }
Пример #3
0
        protected override void LoadConditions()
        {
            base.LoadConditions();

            var extendedActionConditions = Conditions.Select(condition =>
                                                             new Condition(condition.Text, condition.IsMatch, i =>
            {
                StoreConditionMatched(condition.Text);
                return(condition.Function.Invoke(i));
            })).ToList();

            Conditions.Clear();
            Conditions.AddRange(extendedActionConditions);
        }
Пример #4
0
        /// <summary>
        ///     Provides an implementation of how default settings should be applied for each ability.
        /// </summary>
        public virtual void ApplyDefaultSettings()
        {
            Conditions.Clear();

            Conditions.AddRange(RequiredConditions);

            if (MustWaitForGlobalCooldown)
            {
                Conditions.Add(new IsOffGlobalCooldownCondition());
            }
            if (MustWaitForSpellCooldown)
            {
                Conditions.Add(new SpellIsNotOnCooldownCondition(Spell));
            }
        }
Пример #5
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        /// <param name="node">対象Node</param>
        /// <param name="semanticModel">対象ソースのsemanticModel</param>
        /// <param name="parent">親IAnalyzeItem</param>
        /// <param name="container">イベントコンテナ</param>
        public ItemSwitch(SwitchStatementSyntax node, SemanticModel semanticModel, IAnalyzeItem parent, EventContainer container) : base(parent, node, semanticModel, container)
        {
            ItemType = ItemTypes.MethodStatement;

            var operation = semanticModel.GetOperation(node) as ISwitchOperation;

            // 条件設定
            Conditions.AddRange(OperationFactory.GetExpressionList(operation.Value, container));

            // Caseリスト設定
            foreach (var item in operation.Cases)
            {
                Cases.Add(ItemFactory.Create(item.Syntax, semanticModel, container, this));
            }
        }
Пример #6
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        /// <param name="node">対象Node</param>
        /// <param name="semanticModel">対象ソースのsemanticModel</param>
        /// <param name="parent">親IAnalyzeItem</param>
        /// <param name="container">イベントコンテナ</param>
        public ItemElseClause(ElseClauseSyntax node, SemanticModel semanticModel, IAnalyzeItem parent, EventContainer container) : base(parent, node, semanticModel, container)
        {
            ItemType = ItemTypes.MethodStatement;

            if (node.Statement is IfStatementSyntax ifNode)
            {
                var condition = semanticModel.GetOperation(ifNode.Condition);
                Conditions.AddRange(OperationFactory.GetExpressionList(condition, container));

                var block = ifNode.Statement as BlockSyntax;
                foreach (var statement in block.Statements)
                {
                    Block.Add(ItemFactory.Create(statement, semanticModel, container, this));
                }
            }
            else
            {
                var block = node.Statement as BlockSyntax;
                foreach (var statement in block.Statements)
                {
                    Block.Add(ItemFactory.Create(statement, semanticModel, container, this));
                }
            }
        }
Пример #7
0
 public SqlSearchCondition(IEnumerable <SqlCondition> list)
 {
     Conditions.AddRange(list);
 }
Пример #8
0
 public Rule(String name, List <Condition> conditions)
     : this(name)
 {
     Conditions.AddRange(conditions);
 }
Пример #9
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        /// <param name="node">対象Node</param>
        /// <param name="semanticModel">対象ソースのsemanticModel</param>
        /// <param name="parent">親IAnalyzeItem</param>
        /// <param name="container">イベントコンテナ</param>
        public ItemFor(ForStatementSyntax node, SemanticModel semanticModel, IAnalyzeItem parent, EventContainer container) : base(parent, node, semanticModel, container)
        {
            ItemType = ItemTypes.MethodStatement;

            // 宣言部
            if (node.Declaration != null)
            {
                // 型設定
                IsVar = node.Declaration.Type.IsVar;
                var declaredSymbol = semanticModel.GetDeclaredSymbol(node.Declaration.Variables.First());
                var parts          = ((ILocalSymbol)declaredSymbol).Type.ToDisplayParts(SymbolDisplayFormat.MinimallyQualifiedFormat);
                foreach (var part in parts)
                {
                    // スペースの場合は型設定に含めない
                    if (part.Kind == SymbolDisplayPartKind.Space)
                    {
                        continue;
                    }

                    var name = Expression.GetSymbolName(part, true);
                    var type = Expression.GetSymbolTypeName(part.Symbol);
                    if (part.Kind == SymbolDisplayPartKind.ClassName)
                    {
                        // 外部ファイル参照イベント発行
                        RaiseOtherFileReferenced(node, part.Symbol);
                    }

                    Types.Add(new Expression(name, type));
                }

                // ローカル定義
                foreach (var variable in node.Declaration.Variables)
                {
                    var declaration = semanticModel.GetOperation(variable);
                    Declarations.Add(OperationFactory.GetExpressionList(declaration, container));
                }
            }
            else if (node.Initializers != null)
            {
                // 既存定義
                foreach (var initializer in node.Initializers)
                {
                    var declaration = semanticModel.GetOperation(initializer);
                    Declarations.Add(OperationFactory.GetExpressionList(declaration, container));
                }
            }

            // 計算部
            foreach (var increment in node.Incrementors)
            {
                var incrementOperator = semanticModel.GetOperation(increment);
                Incrementors.Add(OperationFactory.GetExpressionList(incrementOperator, container));
            }

            // 条件部
            var condition = semanticModel.GetOperation(node.Condition);

            Conditions.AddRange(OperationFactory.GetExpressionList(condition, container));

            // 内部処理設定
            var block = node.Statement as BlockSyntax;

            foreach (var statement in block.Statements)
            {
                Members.Add(ItemFactory.Create(statement, semanticModel, container, this));
            }
        }
Пример #10
0
 public SqlSearchCondition(params SqlCondition[] list)
 {
     Conditions.AddRange(list);
 }
Пример #11
0
 public OrCondition(IEnumerable <ConditionBase> conditions)
 {
     Conditions.AddRange(conditions);
 }
Пример #12
0
 public ITargetDefinition OnlyWhen(params Func <bool>[] conditions)
 {
     Conditions.AddRange(conditions);
     return(this);
 }
Пример #13
0
 public OrCondition(params ConditionBase[] conditions)
 {
     Conditions.AddRange(conditions);
 }
Пример #14
0
 /// <summary>
 /// Creates a new instance of a junction condition and adds the given conditions.
 /// </summary>
 /// <param name="conditions">The conditions to add to the junction.</param>
 protected JunctionConditionBase(IEnumerable <ConditionBase> conditions) : this()
 {
     Conditions.AddRange(conditions);
 }
Пример #15
0
 /// <summary>
 /// Adds a range of condition to the list of conditions.
 /// </summary>
 /// <param name="conditions">The <see cref="IEnumerable{IFilterCondition}"/> conditions.</param>
 public void AddRange(IEnumerable <IFilterCondition> conditions)
 {
     Conditions.AddRange(conditions);
 }