示例#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);
        }
示例#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);
        }
示例#3
0
 protected override bool Visit(ASTDot node) => EmitBinary <CDot>(node);             // TODO, different for pointers
 protected override bool Visit(ASTEqual node) => EmitBinary <CEqualEqual>(node);
示例#4
0
文件: ThirdPass.cs 项目: goric/cflat
 public override void VisitEqual(ASTEqual n)
 {
     TypeCheckEquality(n);
 }
示例#5
0
 public bool Visit(ASTEqual node)
 {
     throw new NotImplementedException();
 }
示例#6
0
 protected abstract bool Visit(ASTEqual node);