diff options
| author | Tim Chevalier <[email protected]> | 2011-04-22 11:08:47 -0700 |
|---|---|---|
| committer | Graydon Hoare <[email protected]> | 2011-04-28 13:26:19 -0700 |
| commit | 707cd0281da28596f6f4b5e9cdf0af4f17bf50f0 (patch) | |
| tree | ee8a3221c24c1069e738ef6a02d59018c4e87f09 /src/comp/util/common.rs | |
| parent | Support all expression forms in typestate (diff) | |
| download | rust-707cd0281da28596f6f4b5e9cdf0af4f17bf50f0.tar.xz rust-707cd0281da28596f6f4b5e9cdf0af4f17bf50f0.zip | |
Fixed bug in typeck that wasn't filling in anns for stmts
(needed for typestate_check).
Also changed a (log; fail) to (log_err; fail) in typestate_check,
and added some more logging funs in util.common.
Diffstat (limited to 'src/comp/util/common.rs')
| -rw-r--r-- | src/comp/util/common.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/comp/util/common.rs b/src/comp/util/common.rs index fd0d688b..7484b4cf 100644 --- a/src/comp/util/common.rs +++ b/src/comp/util/common.rs @@ -16,6 +16,7 @@ import std.io.string_writer; import pretty.pprust.print_block; import pretty.pprust.print_expr; import pretty.pprust.print_decl; +import pretty.pprust.print_fn; import pretty.pp.mkstate; type filename = str; @@ -169,6 +170,25 @@ fn log_ann(&ast.ann a) -> () { } } +fn fun_to_str(&ast._fn f, str name, vec[ast.ty_param] params) -> str { + let str_writer s = string_writer(); + auto out_ = mkstate(s.get_writer(), 80u); + auto out = @rec(s=out_, + comments=none[vec[front.lexer.cmnt]], + mutable cur_cmnt=0u); + + print_fn(out, f.decl, name, params); + ret s.get_str(); +} + +fn log_fn(&ast._fn f, str name, vec[ast.ty_param] params) -> () { + log(fun_to_str(f, name, params)); +} + +fn log_fn_err(&ast._fn f, str name, vec[ast.ty_param] params) -> () { + log_err(fun_to_str(f, name, params)); +} + fn stmt_to_str(&ast.stmt st) -> str { let str_writer s = string_writer(); auto out_ = mkstate(s.get_writer(), 80u); |