public override void VisitConcatenate(ASTConcatenate n) { //push left and right n.Left.Visit(this); BoxIfNeeded(n.Left.CFlatType); n.Right.Visit(this); BoxIfNeeded(n.Right.CFlatType); //now call String.Concat _gen.Emit(OpCodes.Call, typeof(String).GetMethod("Concat", BindingFlags.Public | BindingFlags.Static, null, new Type[] { typeof(object), typeof(object) }, null)); _lastWalkedType = typeof(string); }
public override void VisitConcatenate(ASTConcatenate n) { CFlatType lhs = CheckSubTree(n.Left); CFlatType rhs = CheckSubTree(n.Right); // we'll allow for implicit conversion from numeric types to strings for concat purposes if ((lhs.IsConcatenatable) && (rhs.IsConcatenatable)) { _lastSeenType = n.CFlatType = new TypeString(); } else { ReportError(n.Location, "Operands for concatenation must be strings, characters, or integers."); } }