DataDictionary.Interpreter.BinaryExpression.SemanticAnalysis C# (CSharp) Method

SemanticAnalysis() public method

Performs the semantic analysis of the expression
public SemanticAnalysis ( INamable instance, DataDictionary.Interpreter.Filter.BaseFilter expectation ) : bool
instance INamable the reference instance on which this element should analysed
expectation DataDictionary.Interpreter.Filter.BaseFilter Indicates the kind of element we are looking for
return bool
        public override bool SemanticAnalysis(INamable instance, BaseFilter expectation)
        {
            bool retVal = base.SemanticAnalysis(instance, expectation);

            if (retVal)
            {
                // Left
                if (Left != null)
                {
                    Left.SemanticAnalysis(instance, IsRightSide.INSTANCE);
                    StaticUsage.AddUsages(Left.StaticUsage, Usage.ModeEnum.Read);
                }
                else
                {
                    AddError("Left expression not provided", RuleChecksEnum.SemanticAnalysisError);
                }

                // Right
                if (Right != null)
                {
                    if (Operation == Operator.Is || Operation == Operator.As)
                    {
                        Right.SemanticAnalysis(instance, IsType.INSTANCE);
                        StaticUsage.AddUsages(Right.StaticUsage, Usage.ModeEnum.Type);
                    }
                    else
                    {
                        Right.SemanticAnalysis(instance, IsRightSide.INSTANCE);
                        StaticUsage.AddUsages(Right.StaticUsage, Usage.ModeEnum.Read);
                    }
                }
                else
                {
                    AddError("Right expression not provided", RuleChecksEnum.SemanticAnalysisError);
                }
            }

            return retVal;
        }