Ejemplo n.º 1
0
        public AssignmentResult CheckAssignment(int startLine, string variableName, SqlTypeInfo other)
        {
            if (this == SqlTypeInfo.Unknown)
            {
                return AssignmentResult.OK;
            }

            if (other == SqlTypeInfo.Unknown)
            {
                return AssignmentResult.OK;
            }

            var fullOther = (FullSqlTypeInfo)other;
            return ((FullSqlTypeInfo)this).CheckFullAssignment(startLine, variableName, fullOther);
        }
Ejemplo n.º 2
0
        internal static SqlTypeInfo CreateFromBinaryExpression(SqlTypeInfo leftType, SqlTypeInfo rightType, BinaryExpressionType binaryExpressionType)
        {
            if (leftType == SqlTypeInfo.Unknown || rightType == SqlTypeInfo.Unknown)
            {
                return SqlTypeInfo.Unknown;
            }

            // these binary expressions produce a result of the highest-precedence type of their operands
            if (binaryExpressionType == BinaryExpressionType.Add
                || binaryExpressionType == BinaryExpressionType.Subtract
                || binaryExpressionType == BinaryExpressionType.Multiply
                || binaryExpressionType == BinaryExpressionType.Divide)
            {
                return ((FullSqlTypeInfo)leftType).GetHigherPrecedenceType((FullSqlTypeInfo)rightType);
            }

            return SqlTypeInfo.Unknown; // TODO: support other expressions
        }