Skip to content

Commit 8614cc9

Browse files
committed
Remove remaining unused eval methods. Issue #604
1 parent 91b87b3 commit 8614cc9

File tree

1 file changed

+0
-46
lines changed

1 file changed

+0
-46
lines changed

src/comp/front/eval.rs

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ import util::common::span;
1818
import util::common::new_str_hash;
1919

2020

21-
// Simple dynamic-typed value type for eval_expr.
22-
tag val { val_bool(bool); val_int(int); val_str(str); }
23-
2421
tag eval_mode { mode_depend; mode_parse; }
2522

2623
type ctx =
@@ -32,49 +29,6 @@ type ctx =
3229
mutable int next_id,
3330
ast::crate_cfg cfg);
3431

35-
fn val_is_bool(val v) -> bool {
36-
alt (v) { case (val_bool(_)) { true } case (_) { false } }
37-
}
38-
39-
fn val_is_int(val v) -> bool {
40-
alt (v) { case (val_int(_)) { true } case (_) { false } }
41-
}
42-
43-
fn val_is_str(val v) -> bool {
44-
alt (v) { case (val_str(_)) { true } case (_) { false } }
45-
}
46-
47-
fn val_as_bool(val v) -> bool {
48-
alt (v) { case (val_bool(?b)) { b } case (_) { fail } }
49-
}
50-
51-
fn val_as_int(val v) -> int {
52-
alt (v) { case (val_int(?i)) { i } case (_) { fail } }
53-
}
54-
55-
fn val_as_str(val v) -> str {
56-
alt (v) { case (val_str(?s)) { s } case (_) { fail } }
57-
}
58-
59-
fn eval_lit(ctx cx, span sp, @ast::lit lit) -> val {
60-
alt (lit.node) {
61-
case (ast::lit_bool(?b)) { val_bool(b) }
62-
case (ast::lit_int(?i)) { val_int(i) }
63-
case (ast::lit_str(?s, _)) { val_str(s) }
64-
case (_) { cx.sess.span_fatal(sp, "evaluating unsupported literal") }
65-
}
66-
}
67-
68-
fn val_eq(session::session sess, span sp, val av, val bv) -> bool {
69-
if (val_is_bool(av) && val_is_bool(bv)) {
70-
val_as_bool(av) == val_as_bool(bv)
71-
} else if (val_is_int(av) && val_is_int(bv)) {
72-
val_as_int(av) == val_as_int(bv)
73-
} else if (val_is_str(av) && val_is_str(bv)) {
74-
str::eq(val_as_str(av), val_as_str(bv))
75-
} else { sess.span_fatal(sp, "bad types in comparison") }
76-
}
77-
7832
fn eval_crate_directives(ctx cx, vec[@ast::crate_directive] cdirs,
7933
str prefix, &mutable vec[@ast::view_item] view_items,
8034
&mutable vec[@ast::item] items) {

0 commit comments

Comments
 (0)