diff options
author | Manish Goregaokar <manishsmail@gmail.com> | 2014-09-24 06:07:07 +0530 |
---|---|---|
committer | Manish Goregaokar <manishsmail@gmail.com> | 2014-09-24 19:35:41 +0530 |
commit | 6f6a62e9671cb562e0d29b82a2604ba44c0af6d0 (patch) | |
tree | c1a68fbc46894539fe58778c2696e97502eb90ff /components/plugins/jstraceable.rs | |
parent | 5336dd98539a2129b2cce73e9488d570f930ac05 (diff) | |
download | servo-6f6a62e9671cb562e0d29b82a2604ba44c0af6d0.tar.gz servo-6f6a62e9671cb562e0d29b82a2604ba44c0af6d0.zip |
Address review comments
Diffstat (limited to 'components/plugins/jstraceable.rs')
-rw-r--r-- | components/plugins/jstraceable.rs | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/components/plugins/jstraceable.rs b/components/plugins/jstraceable.rs index 6c3998f2d52..19171a6ded1 100644 --- a/components/plugins/jstraceable.rs +++ b/components/plugins/jstraceable.rs @@ -31,7 +31,7 @@ use syntax::ext::deriving::generic::{combine_substructure, EnumMatching, FieldIn } ) }; - trait_def.expand(cx, mitem, item, push) + trait_def.expand(cx, mitem, item, push) } // Mostly copied from syntax::ext::deriving::hash @@ -40,23 +40,20 @@ fn jstraceable_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substru [ref state_expr] => state_expr, _ => cx.span_bug(trait_span, "incorrect number of arguments in `jstraceable`") }; - let hash_ident = substr.method_ident; - let call_hash = |span, thing_expr| { - let expr = cx.expr_method_call(span, thing_expr, hash_ident, vec!(state_expr.clone())); + let trace_ident = substr.method_ident; + let call_trace = |span, thing_expr| { + let expr = cx.expr_method_call(span, thing_expr, trace_ident, vec!(state_expr.clone())); cx.stmt_expr(expr) }; let mut stmts = Vec::new(); let fields = match *substr.fields { - Struct(ref fs) => fs, - EnumMatching(_, _, ref fs) => { - fs - } + Struct(ref fs) | EnumMatching(_, _, ref fs) => fs, _ => cx.span_bug(trait_span, "impossible substructure in `jstraceable`") }; for &FieldInfo { ref self_, span, .. } in fields.iter() { - stmts.push(call_hash(span, self_.clone())); + stmts.push(call_trace(span, self_.clone())); } cx.expr_block(cx.block(trait_span, stmts, None)) |