/// <summary>
        /// Restarts a check of number types.
        /// </summary>
        public void RestartNumberType(ref bool isChanged)
        {
            foreach (IEntityDeclaration EntityDeclaration in ParameterList)
            {
                EntityDeclaration.RestartNumberType(ref isChanged);
            }

            foreach (IEntityDeclaration EntityDeclaration in ResultList)
            {
                EntityDeclaration.RestartNumberType(ref isChanged);
            }

            if (Variant.IsAssigned)
            {
                ((IExpression)Variant).RestartNumberType(ref isChanged);
            }

            ((IBody)QueryBody).RestartNumberType(ref isChanged);

            if (ParameterTable.Count > 0)
            {
                if (NumberArgumentTable.Count == 0)
                {
                    for (int i = 0; i < ParameterTable.Count; i++)
                    {
                        IParameter Parameter = ParameterTable[i];
                        NumberArgumentTable.Add(Parameter, new List <NumberKinds>());
                    }
                }
                else
                {
                    // Result of the previous pass.
                    for (int i = 0; i < ParameterTable.Count; i++)
                    {
                        IParameter Parameter = ParameterTable[i];
                        Debug.Assert(NumberArgumentTable.ContainsKey(Parameter));

                        Debug.Assert(Parameter.ResolvedParameter.ResolvedEffectiveType.IsAssigned);

                        if (Parameter.ResolvedParameter.ResolvedEffectiveType.Item is ICompiledNumberType AsNumberType)
                        {
                            NumberKinds BestGuess = AsNumberType.GetDefaultNumberKind();
                            UpdateParameterKind(NumberArgumentTable[Parameter], ref BestGuess);
                            AsNumberType.UpdateNumberKind(BestGuess, ref isChanged);
                        }

                        NumberArgumentTable[Parameter].Clear();
                    }
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ExpressionType"/> class.
        /// </summary>
        /// <param name="valueTypeName">The expression type name.</param>
        /// <param name="valueType">The expression type.</param>
        /// <param name="name">Name of the expression value, empty if none.</param>
        public ExpressionType(ITypeName valueTypeName, ICompiledType valueType, string name)
        {
            ValueTypeName = valueTypeName;
            ValueType     = valueType;
            Name          = name;

            if (valueType is ICompiledNumberType AsNumberType)
            {
                NumberKind = AsNumberType.GetDefaultNumberKind();
            }
            else
            {
                NumberKind = NumberKinds.NotApplicable;
            }
        }