mirror of
https://github.com/servo/servo.git
synced 2025-08-02 04:00:32 +01:00
Address review comments
This commit is contained in:
parent
5336dd9853
commit
6f6a62e967
9 changed files with 20 additions and 26 deletions
|
@ -40,23 +40,20 @@ fn jstraceable_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substru
|
||||||
[ref state_expr] => state_expr,
|
[ref state_expr] => state_expr,
|
||||||
_ => cx.span_bug(trait_span, "incorrect number of arguments in `jstraceable`")
|
_ => cx.span_bug(trait_span, "incorrect number of arguments in `jstraceable`")
|
||||||
};
|
};
|
||||||
let hash_ident = substr.method_ident;
|
let trace_ident = substr.method_ident;
|
||||||
let call_hash = |span, thing_expr| {
|
let call_trace = |span, thing_expr| {
|
||||||
let expr = cx.expr_method_call(span, thing_expr, hash_ident, vec!(state_expr.clone()));
|
let expr = cx.expr_method_call(span, thing_expr, trace_ident, vec!(state_expr.clone()));
|
||||||
cx.stmt_expr(expr)
|
cx.stmt_expr(expr)
|
||||||
};
|
};
|
||||||
let mut stmts = Vec::new();
|
let mut stmts = Vec::new();
|
||||||
|
|
||||||
let fields = match *substr.fields {
|
let fields = match *substr.fields {
|
||||||
Struct(ref fs) => fs,
|
Struct(ref fs) | EnumMatching(_, _, ref fs) => fs,
|
||||||
EnumMatching(_, _, ref fs) => {
|
|
||||||
fs
|
|
||||||
}
|
|
||||||
_ => cx.span_bug(trait_span, "impossible substructure in `jstraceable`")
|
_ => cx.span_bug(trait_span, "impossible substructure in `jstraceable`")
|
||||||
};
|
};
|
||||||
|
|
||||||
for &FieldInfo { ref self_, span, .. } in fields.iter() {
|
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))
|
cx.expr_block(cx.block(trait_span, stmts, None))
|
||||||
|
|
|
@ -158,13 +158,13 @@ impl<T: JSTraceable> JSTraceable for RefCell<T> {
|
||||||
|
|
||||||
impl<T: JSTraceable> JSTraceable for Rc<T> {
|
impl<T: JSTraceable> JSTraceable for Rc<T> {
|
||||||
fn trace(&self, trc: *mut JSTracer) {
|
fn trace(&self, trc: *mut JSTracer) {
|
||||||
self.trace(trc)
|
self.deref().trace(trc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: JSTraceable> JSTraceable for Box<T> {
|
impl<T: JSTraceable> JSTraceable for Box<T> {
|
||||||
fn trace(&self, trc: *mut JSTracer) {
|
fn trace(&self, trc: *mut JSTracer) {
|
||||||
self.trace(trc)
|
(**self).trace(trc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,13 +221,15 @@ impl<K: Eq+Hash, V: JSTraceable> JSTraceable for HashMap<K, V> {
|
||||||
}
|
}
|
||||||
|
|
||||||
untraceable!(bool, f32, f64, String, Url)
|
untraceable!(bool, f32, f64, String, Url)
|
||||||
untraceable!(SubpageId, WindowSizeData, PipelineId)
|
|
||||||
untraceable!(uint, u8, u16, u32, u64)
|
untraceable!(uint, u8, u16, u32, u64)
|
||||||
untraceable!(int, i8, i16, i32, i64)
|
untraceable!(int, i8, i16, i32, i64)
|
||||||
untraceable!(Untraceable<T>)
|
untraceable!(Untraceable<T>)
|
||||||
untraceable!(ImageCacheTask, ScriptControlChan)
|
untraceable!(ImageCacheTask, ScriptControlChan)
|
||||||
untraceable!(Atom, Namespace)
|
untraceable!(Atom, Namespace)
|
||||||
untraceable!(PropertyDeclarationBlock)
|
untraceable!(PropertyDeclarationBlock)
|
||||||
|
// These three are interdependent, if you plan to put jsmanaged data
|
||||||
|
// in one of these make sure it is propagated properly to containing structs
|
||||||
|
untraceable!(SubpageId, WindowSizeData, PipelineId)
|
||||||
|
|
||||||
impl<'a> JSTraceable for &'a str {
|
impl<'a> JSTraceable for &'a str {
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
|
@ -64,8 +64,6 @@ use style::ComputedValues;
|
||||||
use sync::Arc;
|
use sync::Arc;
|
||||||
use uuid;
|
use uuid;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// The basic Node structure
|
// The basic Node structure
|
||||||
//
|
//
|
||||||
|
|
|
@ -19,7 +19,6 @@ use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
|
||||||
use dom::document::Document;
|
use dom::document::Document;
|
||||||
use dom::node::{Node, NodeHelpers};
|
use dom::node::{Node, NodeHelpers};
|
||||||
|
|
||||||
|
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#interface-treewalker
|
// http://dom.spec.whatwg.org/#interface-treewalker
|
||||||
|
|
|
@ -35,8 +35,6 @@ use std::mem::replace;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// Encapsulates a handle to a frame and its associated layout information.
|
/// Encapsulates a handle to a frame and its associated layout information.
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
pub struct Page {
|
pub struct Page {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue