public override void visit(Generated.Case obj, bool visitSubNodes)
        {
            Functions.Case cas = obj as Functions.Case;

            try
            {
                Interpreter.Expression expression = cas.Expression;
                if (expression != null)
                {
                    expression.checkExpression();
                    Types.Type expressionType = cas.Expression.GetExpressionType();
                    if (expressionType != null)
                    {
                        if (!cas.EnclosingFunction.ReturnType.Match(expressionType))
                        {
                            cas.AddError("Expression type (" + expressionType.FullName + ") does not match function return type (" + cas.EnclosingFunction.ReturnType.Name + ")");
                        }
                    }
                    else
                    {
                        cas.AddError("Cannot determine expression type (6) for " + cas.Expression.ToString());
                    }
                }
                else
                {
                    cas.AddError("Cannot evaluate expression " + cas.ExpressionText);
                }
            }
            catch (Exception e)
            {
                cas.AddException(e);
            }

            base.visit(obj, visitSubNodes);
        }
Exemple #2
0
        /// <summary>
        /// Cleans all text fields in this element
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="visitSubNodes"></param>
        public override void visit(Generated.Case obj, bool visitSubNodes)
        {
            if (obj.getExpression() != null)
            {
                obj.setExpression(obj.getExpression().Trim());
            }
            if (obj.getComment() != null)
            {
                obj.setComment(obj.getComment().Trim());
            }

            base.visit(obj, visitSubNodes);
        }