示例#1
0
        /// <summary>
        /// Check new expressions.
        /// </summary>
        /// <param name="semActs">The semantic analyser</param>
        /// <param name="exp">The newexpression</param>
        private void CheckNewExpression(SemActs semActs, NewExpr exp)
        {
            var typeName = exp.TypeName;

            // 1. Check # params to Date
            if (string.Compare(typeName, "Date", StringComparison.InvariantCultureIgnoreCase) == 0)
            {
                if (!LDateType.CanCreateFrom(exp.ParamListExpressions.Count))
                {
                    AddError("Unexpected number of inputs when creating date", exp);
                }
            }
            // 2. Check # params to Time
            else if (string.Compare(typeName, "Time", StringComparison.InvariantCultureIgnoreCase) == 0)
            {
                if (!DateTimeTypeHelper.CanCreateTimeFrom(exp.ParamListExpressions.Count))
                {
                    AddError("Unexpected number of inputs when creating time", exp);
                }
            }
        }