Ejemplo n.º 1
0
        public override void VisitEqual(ASTEqual 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);
            }

            _lastWalkedType = typeof(bool);
        }
Ejemplo n.º 2
0
        protected override bool Visit(ASTEqual 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);
        }
Ejemplo n.º 3
0
 protected override bool Visit(ASTDot node) => EmitBinary <CDot>(node);             // TODO, different for pointers
 protected override bool Visit(ASTEqual node) => EmitBinary <CEqualEqual>(node);
Ejemplo n.º 4
0
 public override void VisitEqual(ASTEqual n)
 {
     TypeCheckEquality(n);
 }
Ejemplo n.º 5
0
 public bool Visit(ASTEqual node)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 6
0
 protected abstract bool Visit(ASTEqual node);