Use JSTraceable everywhere

This commit is contained in:
Manish Goregaokar 2014-09-24 03:01:03 +05:30
parent 85f79290a6
commit cc44a3b064
133 changed files with 325 additions and 278 deletions

View file

@ -49,16 +49,7 @@ fn jstraceable_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substru
let fields = match *substr.fields {
Struct(ref fs) => fs,
EnumMatching(index, variant, ref fs) => {
// Determine the discriminant. We will feed this value to the byte
// iteration function.
let discriminant = match variant.node.disr_expr {
Some(ref d) => d.clone(),
None => cx.expr_uint(trait_span, index)
};
stmts.push(call_hash(trait_span, discriminant));
EnumMatching(_, _, ref fs) => {
fs
}
_ => cx.span_bug(trait_span, "impossible substructure in `jstraceable`")
@ -68,9 +59,5 @@ fn jstraceable_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substru
stmts.push(call_hash(span, self_.clone()));
}
if stmts.len() == 0 {
cx.span_bug(trait_span, "#[jstraceable] needs at least one field");
}
cx.expr_block(cx.block(trait_span, stmts, None))
}