DataDictionary.Interpreter.LetExpression.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)
            {
                // Binding expression
                if (BindingExpression != null)
                {
                    BindingExpression.SemanticAnalysis(instance, IsRightSide.INSTANCE);
                    StaticUsage.AddUsages(BindingExpression.StaticUsage, Usage.ModeEnum.Read);

                    Type bindingExpressionType = BindingExpression.GetExpressionType();
                    if (bindingExpressionType != null)
                    {
                        StaticUsage.AddUsage(bindingExpressionType, Root, Usage.ModeEnum.Type);
                        BoundVariable.Type = bindingExpressionType;

                    }
                    else
                    {
                        AddError("Cannot determine binding expression type for " + ToString(), RuleChecksEnum.SemanticAnalysisError);
                    }
                }
                else
                {
                    AddError("Binding expression not provided", RuleChecksEnum.SemanticAnalysisError);
                }

                // The evaluated expression
                if (Expression != null)
                {
                    Expression.SemanticAnalysis(instance, expectation);
                    StaticUsage.AddUsages(Expression.StaticUsage, Usage.ModeEnum.Read);
                }
                else
                {
                    AddError("Value expression not provided", RuleChecksEnum.SemanticAnalysisError);
                }
            }

            return retVal;
        }