예제 #1
0
        public override void VisitAdd(ASTAdd n)
        {
            SetupOperands(n);

            //pop 2 numbers, add, push result
            _gen.Emit(OpCodes.Add);
        }
예제 #2
0
파일: ThirdPass.cs 프로젝트: goric/cflat
        /// <summary>
        /// Binary operators are not supported for classes, only primatives.
        /// </summary>
        /// <param name="n"></param>
        public override void VisitAdd(ASTAdd n)
        {
            CFlatType lhs = CheckSubTree(n.Left);
            CFlatType rhs = CheckSubTree(n.Right);

            if (lhs.IsNumeric && rhs.IsNumeric)
            {
                _lastSeenType = n.CFlatType = Supertype(lhs, rhs);
            }
            else
            {
                ReportError(n.Location, "Invalid operands for addition. Got types '{0}' and '{1}'.", TypeToFriendlyName(lhs), TypeToFriendlyName(rhs));
            }
        }
예제 #3
0
 protected override bool Visit(ASTAdd node) => EmitBinary <CAdd>(node);
예제 #4
0
 protected override bool Visit(ASTAdd node) => VisitArethetic(node);
예제 #5
0
 public bool Visit(ASTAdd node)
 {
     throw new NotImplementedException();
 }
예제 #6
0
 protected abstract bool Visit(ASTAdd node);