Beispiel #1
0
        protected override bool Visit(ASTNotEqual node)
        {
            if (!Visit(node.Left, node.Right))
            {
                return(false);
            }
            var left  = node.Left.TypeInfo;
            var right = node.Right.TypeInfo;

            if (!left.Equals(right))
            {
                Error(node.Position, $"Cannot compare {left} and {right}");
                return(false);
            }

            node.TypeInfo = Cache.GetBoolean();
            return(true);
        }
Beispiel #2
0
        public override void VisitNotEqual(ASTNotEqual n)
        {
            SetupOperands(n);

            //string equality, good times
            if (_lastWalkedType == typeof(String))
            {
                _gen.Emit(OpCodes.Call, typeof(String).GetMethod("Equals", BindingFlags.Public | BindingFlags.Static, null,
                                                                 new Type[] { typeof(string), typeof(string) }, null));
            }
            else
            {
                _gen.Emit(OpCodes.Ceq);
            }
            //compare it with 0 to negate
            _gen.Emit(OpCodes.Ldc_I4_0);
            _gen.Emit(OpCodes.Ceq);

            _lastWalkedType = typeof(bool);
        }
Beispiel #3
0
 protected override bool Visit(ASTNotEqual node) => EmitBinary <CNotEqual>(node);
Beispiel #4
0
 public override void VisitNotEqual(ASTNotEqual n)
 {
     TypeCheckEquality(n);
 }
Beispiel #5
0
 public bool Visit(ASTNotEqual node)
 {
     throw new NotImplementedException();
 }
Beispiel #6
0
 protected abstract bool Visit(ASTNotEqual node);