2011-09-12 18:13:28 -05:00
|
|
|
import std::{str, map, uint, int, option};
|
2011-05-12 10:24:54 -05:00
|
|
|
import std::map::hashmap;
|
2011-09-12 18:13:28 -05:00
|
|
|
import std::option::{none, some};
|
2011-07-05 04:48:19 -05:00
|
|
|
import syntax::ast;
|
2011-09-12 18:13:28 -05:00
|
|
|
import ast::{ty, pat, lit, path};
|
|
|
|
import syntax::codemap::{codemap, span};
|
2011-07-26 09:47:13 -05:00
|
|
|
import syntax::visit;
|
2011-09-12 18:13:28 -05:00
|
|
|
import std::io::{stdout, str_writer, string_writer};
|
2011-07-05 04:48:19 -05:00
|
|
|
import syntax::print;
|
2011-09-12 18:13:28 -05:00
|
|
|
import print::pprust::{print_block, print_item, print_expr, print_path,
|
|
|
|
print_decl, print_fn, print_type, print_literal};
|
2011-07-05 04:48:19 -05:00
|
|
|
import print::pp::mk_printer;
|
2011-06-15 13:19:50 -05:00
|
|
|
|
2011-08-12 09:15:18 -05:00
|
|
|
type flag = hashmap<str, ()>;
|
2010-08-18 13:34:47 -05:00
|
|
|
|
2011-09-12 04:27:30 -05:00
|
|
|
fn def_eq(a: ast::def_id, b: ast::def_id) -> bool {
|
2011-07-26 07:06:02 -05:00
|
|
|
ret a.crate == b.crate && a.node == b.node;
|
2011-03-08 13:59:38 -06:00
|
|
|
}
|
|
|
|
|
2011-09-12 04:27:30 -05:00
|
|
|
fn hash_def(d: ast::def_id) -> uint {
|
2011-07-27 07:19:39 -05:00
|
|
|
let h = 5381u;
|
2011-07-26 07:06:02 -05:00
|
|
|
h = (h << 5u) + h ^ (d.crate as uint);
|
|
|
|
h = (h << 5u) + h ^ (d.node as uint);
|
2011-03-31 13:55:28 -05:00
|
|
|
ret h;
|
|
|
|
}
|
2010-10-19 16:54:10 -05:00
|
|
|
|
2011-08-12 08:36:51 -05:00
|
|
|
fn new_def_hash<@V>() -> std::map::hashmap<ast::def_id, V> {
|
2011-08-12 09:15:18 -05:00
|
|
|
let hasher: std::map::hashfn<ast::def_id> = hash_def;
|
|
|
|
let eqer: std::map::eqfn<ast::def_id> = def_eq;
|
2011-08-13 02:09:25 -05:00
|
|
|
ret std::map::mk_hashmap::<ast::def_id, V>(hasher, eqer);
|
2010-10-19 16:54:10 -05:00
|
|
|
}
|
|
|
|
|
2011-09-12 04:27:30 -05:00
|
|
|
fn field_expr(f: ast::field) -> @ast::expr { ret f.node.expr; }
|
2011-04-12 14:16:21 -05:00
|
|
|
|
2011-09-12 04:27:30 -05:00
|
|
|
fn field_exprs(fields: [ast::field]) -> [@ast::expr] {
|
2011-08-19 17:16:48 -05:00
|
|
|
let es = [];
|
|
|
|
for f: ast::field in fields { es += [f.node.expr]; }
|
2011-07-06 21:00:00 -05:00
|
|
|
ret es;
|
2011-04-12 14:16:21 -05:00
|
|
|
}
|
|
|
|
|
2011-09-12 04:27:30 -05:00
|
|
|
fn log_expr(e: ast::expr) { log print::pprust::expr_to_str(@e); }
|
Further work on typestate_check
Lots of work on typestate_check, seems to get a lot of the way
through checking the standard library.
* Added for, for_each, assign_op, bind, cast, put, check, break,
and cont. (I'm not sure break and cont are actually handled correctly.)
* Fixed side-effect bug in seq_preconds so that unioning the
preconditions of a sequence of statements or expressions
is handled correctly.
* Pass poststate correctly through a stmt_decl.
* Handle expr_ret and expr_fail properly (after execution of a ret
or fail, everything is true -- this is needed to handle ifs and alts
where one branch is a ret or fail)
* Fixed bug in set_prestate_ann where a thing that needed to be
mutated wasn't getting passed as an alias
* Fixed bug in how expr_alt was treated (zero is not the identity
for intersect, who knew, right?)
* Update logging to reflect log_err vs. log
* Fixed find_locals so as to return all local decls and exclude
function arguments.
* Make union_postconds work on an empty vector (needed to handle
empty blocks correctly)
* Added _vec.cat_options, which takes a list of option[T] to a list
of T, ignoring any Nones
* Added two test cases.
2011-04-20 14:11:01 -05:00
|
|
|
|
2011-09-12 04:27:30 -05:00
|
|
|
fn log_expr_err(e: ast::expr) { log_err print::pprust::expr_to_str(@e); }
|
Further work on typestate_check
Lots of work on typestate_check, seems to get a lot of the way
through checking the standard library.
* Added for, for_each, assign_op, bind, cast, put, check, break,
and cont. (I'm not sure break and cont are actually handled correctly.)
* Fixed side-effect bug in seq_preconds so that unioning the
preconditions of a sequence of statements or expressions
is handled correctly.
* Pass poststate correctly through a stmt_decl.
* Handle expr_ret and expr_fail properly (after execution of a ret
or fail, everything is true -- this is needed to handle ifs and alts
where one branch is a ret or fail)
* Fixed bug in set_prestate_ann where a thing that needed to be
mutated wasn't getting passed as an alias
* Fixed bug in how expr_alt was treated (zero is not the identity
for intersect, who knew, right?)
* Update logging to reflect log_err vs. log
* Fixed find_locals so as to return all local decls and exclude
function arguments.
* Make union_postconds work on an empty vector (needed to handle
empty blocks correctly)
* Added _vec.cat_options, which takes a list of option[T] to a list
of T, ignoring any Nones
* Added two test cases.
2011-04-20 14:11:01 -05:00
|
|
|
|
2011-09-12 04:27:30 -05:00
|
|
|
fn log_ty_err(t: @ty) { log_err print::pprust::ty_to_str(t); }
|
2011-05-14 21:02:30 -05:00
|
|
|
|
2011-09-12 04:27:30 -05:00
|
|
|
fn log_pat_err(p: @pat) { log_err print::pprust::pat_to_str(p); }
|
2011-05-14 21:02:30 -05:00
|
|
|
|
2011-09-12 04:27:30 -05:00
|
|
|
fn log_block(b: ast::blk) { log print::pprust::block_to_str(b); }
|
Further work on typestate_check
Lots of work on typestate_check, seems to get a lot of the way
through checking the standard library.
* Added for, for_each, assign_op, bind, cast, put, check, break,
and cont. (I'm not sure break and cont are actually handled correctly.)
* Fixed side-effect bug in seq_preconds so that unioning the
preconditions of a sequence of statements or expressions
is handled correctly.
* Pass poststate correctly through a stmt_decl.
* Handle expr_ret and expr_fail properly (after execution of a ret
or fail, everything is true -- this is needed to handle ifs and alts
where one branch is a ret or fail)
* Fixed bug in set_prestate_ann where a thing that needed to be
mutated wasn't getting passed as an alias
* Fixed bug in how expr_alt was treated (zero is not the identity
for intersect, who knew, right?)
* Update logging to reflect log_err vs. log
* Fixed find_locals so as to return all local decls and exclude
function arguments.
* Make union_postconds work on an empty vector (needed to handle
empty blocks correctly)
* Added _vec.cat_options, which takes a list of option[T] to a list
of T, ignoring any Nones
* Added two test cases.
2011-04-20 14:11:01 -05:00
|
|
|
|
2011-09-12 04:27:30 -05:00
|
|
|
fn log_block_err(b: ast::blk) { log_err print::pprust::block_to_str(b); }
|
2011-04-12 14:16:21 -05:00
|
|
|
|
2011-09-12 04:27:30 -05:00
|
|
|
fn log_item_err(i: @ast::item) { log_err print::pprust::item_to_str(i); }
|
2011-04-22 13:08:47 -05:00
|
|
|
|
2011-09-12 04:27:30 -05:00
|
|
|
fn log_fn(f: ast::_fn, name: ast::ident, params: [ast::ty_param]) {
|
2011-07-05 04:48:19 -05:00
|
|
|
log print::pprust::fun_to_str(f, name, params);
|
2011-04-22 13:08:47 -05:00
|
|
|
}
|
|
|
|
|
2011-09-12 04:27:30 -05:00
|
|
|
fn log_fn_err(f: ast::_fn, name: ast::ident, params: [ast::ty_param]) {
|
2011-07-05 04:48:19 -05:00
|
|
|
log_err print::pprust::fun_to_str(f, name, params);
|
Further work on typestate_check
Lots of work on typestate_check, seems to get a lot of the way
through checking the standard library.
* Added for, for_each, assign_op, bind, cast, put, check, break,
and cont. (I'm not sure break and cont are actually handled correctly.)
* Fixed side-effect bug in seq_preconds so that unioning the
preconditions of a sequence of statements or expressions
is handled correctly.
* Pass poststate correctly through a stmt_decl.
* Handle expr_ret and expr_fail properly (after execution of a ret
or fail, everything is true -- this is needed to handle ifs and alts
where one branch is a ret or fail)
* Fixed bug in set_prestate_ann where a thing that needed to be
mutated wasn't getting passed as an alias
* Fixed bug in how expr_alt was treated (zero is not the identity
for intersect, who knew, right?)
* Update logging to reflect log_err vs. log
* Fixed find_locals so as to return all local decls and exclude
function arguments.
* Make union_postconds work on an empty vector (needed to handle
empty blocks correctly)
* Added _vec.cat_options, which takes a list of option[T] to a list
of T, ignoring any Nones
* Added two test cases.
2011-04-20 14:11:01 -05:00
|
|
|
}
|
|
|
|
|
2011-09-12 04:27:30 -05:00
|
|
|
fn log_stmt(st: ast::stmt) { log print::pprust::stmt_to_str(st); }
|
Further work on typestate_check
Lots of work on typestate_check, seems to get a lot of the way
through checking the standard library.
* Added for, for_each, assign_op, bind, cast, put, check, break,
and cont. (I'm not sure break and cont are actually handled correctly.)
* Fixed side-effect bug in seq_preconds so that unioning the
preconditions of a sequence of statements or expressions
is handled correctly.
* Pass poststate correctly through a stmt_decl.
* Handle expr_ret and expr_fail properly (after execution of a ret
or fail, everything is true -- this is needed to handle ifs and alts
where one branch is a ret or fail)
* Fixed bug in set_prestate_ann where a thing that needed to be
mutated wasn't getting passed as an alias
* Fixed bug in how expr_alt was treated (zero is not the identity
for intersect, who knew, right?)
* Update logging to reflect log_err vs. log
* Fixed find_locals so as to return all local decls and exclude
function arguments.
* Make union_postconds work on an empty vector (needed to handle
empty blocks correctly)
* Added _vec.cat_options, which takes a list of option[T] to a list
of T, ignoring any Nones
* Added two test cases.
2011-04-20 14:11:01 -05:00
|
|
|
|
2011-09-12 04:27:30 -05:00
|
|
|
fn log_stmt_err(st: ast::stmt) { log_err print::pprust::stmt_to_str(st); }
|
Further work on typestate_check
Lots of work on typestate_check, seems to get a lot of the way
through checking the standard library.
* Added for, for_each, assign_op, bind, cast, put, check, break,
and cont. (I'm not sure break and cont are actually handled correctly.)
* Fixed side-effect bug in seq_preconds so that unioning the
preconditions of a sequence of statements or expressions
is handled correctly.
* Pass poststate correctly through a stmt_decl.
* Handle expr_ret and expr_fail properly (after execution of a ret
or fail, everything is true -- this is needed to handle ifs and alts
where one branch is a ret or fail)
* Fixed bug in set_prestate_ann where a thing that needed to be
mutated wasn't getting passed as an alias
* Fixed bug in how expr_alt was treated (zero is not the identity
for intersect, who knew, right?)
* Update logging to reflect log_err vs. log
* Fixed find_locals so as to return all local decls and exclude
function arguments.
* Make union_postconds work on an empty vector (needed to handle
empty blocks correctly)
* Added _vec.cat_options, which takes a list of option[T] to a list
of T, ignoring any Nones
* Added two test cases.
2011-04-20 14:11:01 -05:00
|
|
|
|
2011-09-12 04:27:30 -05:00
|
|
|
fn has_nonlocal_exits(b: ast::blk) -> bool {
|
2011-07-27 07:19:39 -05:00
|
|
|
let has_exits = @mutable false;
|
2011-09-12 04:27:30 -05:00
|
|
|
fn visit_expr(flag: @mutable bool, e: @ast::expr) {
|
2011-07-27 07:19:39 -05:00
|
|
|
alt e.node {
|
|
|
|
ast::expr_break. { *flag = true; }
|
|
|
|
ast::expr_cont. { *flag = true; }
|
|
|
|
_ { }
|
2011-06-15 13:19:50 -05:00
|
|
|
}
|
|
|
|
}
|
2011-07-27 07:19:39 -05:00
|
|
|
let v =
|
|
|
|
visit::mk_simple_visitor(@{visit_expr: bind visit_expr(has_exits, _)
|
|
|
|
with *visit::default_simple_visitor()});
|
2011-07-26 09:47:13 -05:00
|
|
|
visit::visit_block(b, (), v);
|
2011-05-26 19:16:54 -05:00
|
|
|
ret *has_exits;
|
Support all expression forms in typestate
Added support for self_method, cont, chan, port, recv, send, be,
do_while, spawn, and ext; handled break and cont correctly.
(However, there are no non-xfailed test cases for ext or spawn in
stage0 currently.)
Although the standard library compiles and all test cases pass with
typestate enabled, I left typestate checking disabled as rustc
terminates abnormally when building the standard library if so,
even though it does generate code correctly.
2011-04-21 19:39:04 -05:00
|
|
|
}
|
2011-05-14 21:02:30 -05:00
|
|
|
|
2011-09-12 04:27:30 -05:00
|
|
|
fn local_rhs_span(l: @ast::local, def: span) -> span {
|
2011-07-27 07:19:39 -05:00
|
|
|
alt l.node.init { some(i) { ret i.expr.span; } _ { ret def; } }
|
2011-05-18 17:38:38 -05:00
|
|
|
}
|
|
|
|
|
2011-09-28 14:07:33 -05:00
|
|
|
fn lit_is_numeric(l: @ast::lit) -> bool {
|
|
|
|
alt l.node {
|
|
|
|
ast::lit_int(_) | ast::lit_char(_) | ast::lit_uint(_) |
|
|
|
|
ast::lit_mach_int(_, _) | ast::lit_float(_) | ast::lit_mach_float(_,_) {
|
|
|
|
true
|
|
|
|
}
|
|
|
|
_ { false }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn lit_type_eq(l: @ast::lit, m: @ast::lit) -> bool {
|
|
|
|
alt l.node {
|
|
|
|
ast::lit_str(_) {
|
|
|
|
alt m.node { ast::lit_str(_) { true } _ { false } }
|
|
|
|
}
|
|
|
|
ast::lit_char(_) {
|
|
|
|
alt m.node { ast::lit_char(_) { true } _ { false } }
|
|
|
|
}
|
|
|
|
ast::lit_int(_) {
|
|
|
|
alt m.node { ast::lit_int(_) { true } _ { false } }
|
|
|
|
}
|
|
|
|
ast::lit_uint(_) {
|
|
|
|
alt m.node { ast::lit_uint(_) { true } _ { false } }
|
|
|
|
}
|
|
|
|
ast::lit_mach_int(_, _) {
|
|
|
|
alt m.node { ast::lit_mach_int(_, _) { true } _ { false } }
|
|
|
|
}
|
|
|
|
ast::lit_float(_) {
|
|
|
|
alt m.node { ast::lit_float(_) { true } _ { false } }
|
|
|
|
}
|
|
|
|
ast::lit_mach_float(_, _) {
|
|
|
|
alt m.node { ast::lit_mach_float(_, _) { true } _ { false } }
|
|
|
|
}
|
|
|
|
ast::lit_nil. {
|
|
|
|
alt m.node { ast::lit_nil. { true } _ { false } }
|
|
|
|
}
|
|
|
|
ast::lit_bool(_) {
|
|
|
|
alt m.node { ast::lit_bool(_) { true } _ { false } }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn lit_in_range(l: @ast::lit, m1: @ast::lit, m2: @ast::lit) -> bool {
|
|
|
|
alt lits_to_range(m1, m2) {
|
|
|
|
irange(i1, i2) {
|
|
|
|
alt l.node {
|
|
|
|
ast::lit_int(i3) | ast::lit_mach_int(_, i3) {
|
|
|
|
i3 >= *min(i1, i2) && i3 <= *max(i1, i2)
|
|
|
|
}
|
|
|
|
_ { fail }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
urange(u1, u2) {
|
|
|
|
alt l.node {
|
|
|
|
ast::lit_uint(u3) {
|
|
|
|
u3 >= *min(u1, u2) && u3 <= *max(u1, u2)
|
|
|
|
}
|
|
|
|
_ { fail }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
crange(c1, c2) {
|
|
|
|
alt l.node {
|
|
|
|
ast::lit_char(c3) {
|
|
|
|
(c3 as uint) >= *min(c1 as uint, c2 as uint) &&
|
|
|
|
(c3 as uint) <= *max(c1 as uint, c2 as uint)
|
|
|
|
}
|
|
|
|
_ { fail }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
frange(f1, f2) {
|
|
|
|
alt l.node {
|
|
|
|
ast::lit_float(f3) | ast::lit_mach_float(_, f3) {
|
2011-10-12 03:25:39 -05:00
|
|
|
std::float::from_str(f3) >= *min(f1, f2) &&
|
|
|
|
std::float::from_str(f3) <= *max(f1, f2)
|
2011-09-28 14:07:33 -05:00
|
|
|
}
|
|
|
|
_ { fail }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn min<@T>(x: T, y: T) -> @T {
|
|
|
|
ret @(if x > y { y } else { x });
|
|
|
|
}
|
|
|
|
|
|
|
|
fn max<@T>(x: T, y: T) -> @T {
|
|
|
|
ret @(if x > y { x } else { y });
|
|
|
|
}
|
|
|
|
|
|
|
|
fn ranges_overlap<@T>(a1: T, a2: T, b1: T, b2: T) -> bool {
|
|
|
|
let min1 = *min(a1, a2);
|
|
|
|
let max1 = *max(a1, a2);
|
|
|
|
let min2 = *min(b1, b2);
|
|
|
|
let max2 = *max(b1, b2);
|
|
|
|
ret (min1 >= min2 && max1 <= max2) || (min1 <= min2 && max1 >= min2) ||
|
|
|
|
(min1 >= min2 && min1 <= max2) || (max1 >= min2 && max1 <= max2);
|
|
|
|
}
|
|
|
|
|
|
|
|
fn lit_ranges_overlap(a1: @ast::lit, a2: @ast::lit,
|
|
|
|
b1: @ast::lit, b2: @ast::lit) -> bool {
|
|
|
|
alt lits_to_range(a1, a2) {
|
|
|
|
irange(i1, i2) {
|
|
|
|
alt lits_to_range(b1, b2) {
|
|
|
|
irange(i3, i4) { ranges_overlap(i1, i2, i3, i4) }
|
|
|
|
_ { fail }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
urange(u1, u2) {
|
|
|
|
alt lits_to_range(b1, b2) {
|
|
|
|
urange(u3, u4) { ranges_overlap(u1, u2, u3, u4) }
|
|
|
|
_ { fail }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
crange(c1, c2) {
|
|
|
|
alt lits_to_range(b1, b2) {
|
|
|
|
crange(c3, c4) { ranges_overlap(c1, c2, c3, c4) }
|
|
|
|
_ { fail }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
frange(f1, f2) {
|
|
|
|
alt lits_to_range(b1, b2) {
|
|
|
|
frange(f3, f4) { ranges_overlap(f1, f2, f3, f4) }
|
|
|
|
_ { fail }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
tag range {
|
|
|
|
irange(int, int);
|
|
|
|
urange(uint, uint);
|
|
|
|
crange(char, char);
|
|
|
|
frange(float, float);
|
|
|
|
}
|
|
|
|
|
|
|
|
fn lits_to_range(l: @ast::lit, r: @ast::lit) -> range {
|
|
|
|
alt l.node {
|
|
|
|
ast::lit_int(i1) | ast::lit_mach_int(_, i1) {
|
|
|
|
alt r.node { ast::lit_int(i2) { irange(i1, i2) } _ { fail } }
|
|
|
|
}
|
|
|
|
ast::lit_uint(u1) {
|
|
|
|
alt r.node { ast::lit_uint(u2) { urange(u1, u2) } _ { fail } }
|
|
|
|
}
|
|
|
|
ast::lit_char(c1) {
|
|
|
|
alt r.node { ast::lit_char(c2) { crange(c1, c2) } _ { fail } }
|
|
|
|
}
|
|
|
|
ast::lit_float(f1) | ast::lit_mach_float(_, f1) {
|
|
|
|
alt r.node { ast::lit_float(f2) | ast::lit_mach_float(_, f2) {
|
2011-10-12 03:25:39 -05:00
|
|
|
frange(std::float::from_str(f1), std::float::from_str(f2))
|
2011-09-28 14:07:33 -05:00
|
|
|
}
|
|
|
|
_ { fail } }
|
|
|
|
}
|
|
|
|
_ { fail }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-09-12 04:27:30 -05:00
|
|
|
fn lit_eq(l: @ast::lit, m: @ast::lit) -> bool {
|
2011-07-27 07:19:39 -05:00
|
|
|
alt l.node {
|
2011-09-02 00:08:59 -05:00
|
|
|
ast::lit_str(s) {
|
2011-09-02 17:34:58 -05:00
|
|
|
alt m.node { ast::lit_str(t) { ret s == t } _ { ret false; } }
|
2011-07-27 07:19:39 -05:00
|
|
|
}
|
|
|
|
ast::lit_char(c) {
|
|
|
|
alt m.node { ast::lit_char(d) { ret c == d; } _ { ret false; } }
|
|
|
|
}
|
|
|
|
ast::lit_int(i) {
|
|
|
|
alt m.node { ast::lit_int(j) { ret i == j; } _ { ret false; } }
|
|
|
|
}
|
|
|
|
ast::lit_uint(i) {
|
|
|
|
alt m.node { ast::lit_uint(j) { ret i == j; } _ { ret false; } }
|
|
|
|
}
|
|
|
|
ast::lit_mach_int(_, i) {
|
|
|
|
alt m.node {
|
|
|
|
ast::lit_mach_int(_, j) { ret i == j; }
|
|
|
|
_ { ret false; }
|
2011-06-01 20:10:10 -05:00
|
|
|
}
|
2011-07-27 07:19:39 -05:00
|
|
|
}
|
|
|
|
ast::lit_float(s) {
|
|
|
|
alt m.node { ast::lit_float(t) { ret s == t; } _ { ret false; } }
|
|
|
|
}
|
|
|
|
ast::lit_mach_float(_, s) {
|
|
|
|
alt m.node {
|
|
|
|
ast::lit_mach_float(_, t) { ret s == t; }
|
|
|
|
_ { ret false; }
|
2011-06-01 20:10:10 -05:00
|
|
|
}
|
2011-07-27 07:19:39 -05:00
|
|
|
}
|
|
|
|
ast::lit_nil. {
|
|
|
|
alt m.node { ast::lit_nil. { ret true; } _ { ret false; } }
|
|
|
|
}
|
|
|
|
ast::lit_bool(b) {
|
|
|
|
alt m.node { ast::lit_bool(c) { ret b == c; } _ { ret false; } }
|
|
|
|
}
|
2011-06-01 20:10:10 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-08-03 12:57:33 -05:00
|
|
|
tag call_kind { kind_call; kind_spawn; kind_bind; kind_for_each; }
|
2011-07-11 19:26:40 -05:00
|
|
|
|
2011-09-02 17:34:58 -05:00
|
|
|
fn call_kind_str(c: call_kind) -> str {
|
2011-07-27 07:19:39 -05:00
|
|
|
alt c {
|
2011-09-02 17:34:58 -05:00
|
|
|
kind_call. { "Call" }
|
|
|
|
kind_spawn. { "Spawn" }
|
|
|
|
kind_bind. { "Bind" }
|
|
|
|
kind_for_each. { "For-Each" }
|
2011-07-11 19:26:40 -05:00
|
|
|
}
|
|
|
|
}
|
2011-07-11 09:47:24 -05:00
|
|
|
|
2011-09-12 04:27:30 -05:00
|
|
|
fn is_main_name(path: [ast::ident]) -> bool {
|
2011-09-02 17:34:58 -05:00
|
|
|
str::eq(option::get(std::vec::last(path)), "main")
|
2011-07-13 19:26:06 -05:00
|
|
|
}
|
2011-07-22 05:03:10 -05:00
|
|
|
|
2011-09-28 14:07:33 -05:00
|
|
|
|
2011-07-22 05:03:10 -05:00
|
|
|
|
2010-08-18 13:34:47 -05:00
|
|
|
//
|
|
|
|
// Local Variables:
|
|
|
|
// mode: rust
|
|
|
|
// fill-column: 78;
|
|
|
|
// indent-tabs-mode: nil
|
|
|
|
// c-basic-offset: 4
|
|
|
|
// buffer-file-coding-system: utf-8-unix
|
2011-03-25 17:07:27 -05:00
|
|
|
// compile-command: "make -k -C $RBUILD 2>&1 | sed -e 's/\\/x\\//x:\\//g'";
|
2010-08-18 13:34:47 -05:00
|
|
|
// End:
|
|
|
|
//
|