Add float support to #fmt. Fix #1014.

This commit is contained in:
Josh Matthews 2011-11-10 06:31:42 -05:00 committed by Brian Anderson
parent 599baf9325
commit 43cb74b830
4 changed files with 72 additions and 4 deletions

View file

@ -196,6 +196,7 @@ fn pieces_to_expr(cx: ext_ctxt, sp: span, pieces: [piece], args: [@ast::expr])
ty_int(s) {
alt s { signed. { ret true; } unsigned. { ret false; } }
}
ty_float. { ret true; }
_ { ret false; }
}
}
@ -250,6 +251,7 @@ fn pieces_to_expr(cx: ext_ctxt, sp: span, pieces: [piece], args: [@ast::expr])
ty_hex(_) { ret make_conv_call(cx, arg.span, "uint", cnv, arg); }
ty_bits. { ret make_conv_call(cx, arg.span, "uint", cnv, arg); }
ty_octal. { ret make_conv_call(cx, arg.span, "uint", cnv, arg); }
ty_float. { ret make_conv_call(cx, arg.span, "float", cnv, arg); }
_ { cx.span_unimpl(sp, unsupported); }
}
}
@ -301,6 +303,7 @@ fn pieces_to_expr(cx: ext_ctxt, sp: span, pieces: [piece], args: [@ast::expr])
}
}
ty_octal. { log "type: octal"; }
ty_float. { log "type: float"; }
}
}
let fmt_sp = args[0].span;