mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Use JSTraceable everywhere
This commit is contained in:
parent
85f79290a6
commit
cc44a3b064
133 changed files with 325 additions and 278 deletions
|
@ -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))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue