Skip to content

Commit 9d83f95

Browse files
committed
---
yaml --- r: 2065 b: refs/heads/master c: ce85b9e h: refs/heads/master i: 2063: 097a1af v: v3
1 parent e6e9ca4 commit 9d83f95

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: d4d0144bcf3a3cf3e76651cc886d4a0b25350324
2+
refs/heads/master: ce85b9eb7be9a964460a71c8b30e35693df07340

trunk/src/comp/front/extfmt.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,15 +168,13 @@ fn pieces_to_expr(vec[piece] pieces, vec[@ast.expr] args) -> @ast.expr {
168168
case (ty_int(?sign)) {
169169
alt (sign) {
170170
case (signed) {
171-
let vec[str] path = vec("std", "_int", "to_str");
172-
auto radix_expr = make_new_uint(arg.span, 10u);
173-
let vec[@ast.expr] args = vec(arg, radix_expr);
171+
let vec[str] path = vec("std", "ExtFmt", "RT", "int_to_str");
172+
let vec[@ast.expr] args = vec(arg);
174173
ret make_call(arg.span, path, args);
175174
}
176175
case (unsigned) {
177-
let vec[str] path = vec("std", "_uint", "to_str");
178-
auto radix_expr = make_new_uint(arg.span, 10u);
179-
let vec[@ast.expr] args = vec(arg, radix_expr);
176+
let vec[str] path = vec("std", "ExtFmt", "RT", "int_to_str");
177+
let vec[@ast.expr] args = vec(arg);
180178
ret make_call(arg.span, path, args);
181179
}
182180
}

trunk/src/lib/ExtFmt.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,3 +258,14 @@ fn parse_type(str s, uint i, uint lim) -> tup(ty, uint) {
258258

259259
ret tup(t, i + 1u);
260260
}
261+
262+
// Functions used by the fmt extension at runtime
263+
mod RT {
264+
fn int_to_str(int i) -> str {
265+
ret _int.to_str(i, 10u);
266+
}
267+
268+
fn uint_to_str(uint u) -> str {
269+
ret _uint.to_str(u, 10u);
270+
}
271+
}

0 commit comments

Comments
 (0)