Example #1
0
        public bool Visit(Binary_Expression expression)
        {
            bool result = true;

            result &= expression.Left.Accept <bool>(this);
            result &= expression.Right.Accept <bool>(this);
            QSType exprType  = expression.GetType(this._typeMem);
            QSType leftType  = expression.GetLeftType(this._typeMem);
            QSType rightType = expression.GetRightType(this._typeMem);

            if (!leftType.IsCompatible(rightType))
            {
                this._errorList.Add(new OperatorTypeMismatch(leftType, rightType, expression.GetOperator(),
                                                             expression.Line));
                result = false;
            }

            if (!leftType.IsCompatible(exprType))
            {
                this._errorList.Add(new TypeMismatchError(leftType, rightType, expression.Line));
                result = false;
            }
            return(result);
        }
Example #2
0
 public object Visit(Binary_Expression expression)
 {
     throw new NotImplementedException();
 }