示例#1
0
        public Type Visit(NotStatement notStatement, FunctionGeneratorEnvironment arg)
        {
            notStatement.s1.Accept(this, arg);
            Program.Emit(T42Instruction.NOT);

            return(new BoolType());
        }
示例#2
0
        public IValue Visit(NotStatement notStatement)
        {
            IValue result = notStatement.s1.Accept(this);

            if (result.Type != ValueType.Bool)
            {
                var err = new ErrorMessage();
                throw new EvaluationError(err.ErrorOutput(ErrorMessage.ErrorCode.UOP_1, notStatement));
            }
            var x = ((BoolValue)result).Bool;

            return(new BoolValue(!x));
        }
示例#3
0
        public Type Visit(NotStatement notStatement)
        {
            var type      = notStatement.s1.Accept(this);
            var type_text = type.GetType().Name;

            if (IsVoidType(type_text))
            {
                var err = new TypeErrorMessage();
                throw new TypeException(err.ErrorOutput(TypeErrorMessage.ErrorCode.ASN_2, notStatement));
            }
            if (type_text != "BoolType")
            {
                var err = new TypeErrorMessage();
                throw new TypeException(err.ErrorOutput(TypeErrorMessage.ErrorCode.UOP_1, notStatement));
            }
            return(type);
        }
示例#4
0
        public Statement Visit(NotStatement notStatement)
        {
            notStatement.s1.Accept(this);

            return(null);
        }
示例#5
0
        public Void Visit(NotStatement notStatement, SortedSet <string> free)
        {
            notStatement.s1.Accept(this, free);

            return(null);
        }