mirror of
https://github.com/servo/servo.git
synced 2025-06-08 16:43:28 +00:00
Implement JSTraceable for more types.
This commit is contained in:
parent
8ce9ca6243
commit
3613e8f231
3 changed files with 9 additions and 1 deletions
|
@ -4103,6 +4103,7 @@ class CGUnionStruct(CGThing):
|
||||||
% (self.type, v["name"]) for v in templateVars
|
% (self.type, v["name"]) for v in templateVars
|
||||||
]
|
]
|
||||||
return ("""\
|
return ("""\
|
||||||
|
#[derive(JSTraceable)]
|
||||||
pub enum %s {
|
pub enum %s {
|
||||||
%s
|
%s
|
||||||
}
|
}
|
||||||
|
@ -5881,6 +5882,7 @@ class CGDictionary(CGThing):
|
||||||
for m in self.memberInfo]
|
for m in self.memberInfo]
|
||||||
|
|
||||||
return (string.Template(
|
return (string.Template(
|
||||||
|
"#[derive(JSTraceable)]\n"
|
||||||
"pub struct ${selfName} {\n" +
|
"pub struct ${selfName} {\n" +
|
||||||
"${inheritance}" +
|
"${inheritance}" +
|
||||||
"\n".join(memberDecls) + "\n" +
|
"\n".join(memberDecls) + "\n" +
|
||||||
|
|
|
@ -642,3 +642,9 @@ impl<T: DomObject> Drop for Root<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsafe impl<T: DomObject> JSTraceable for Root<T> {
|
||||||
|
unsafe fn trace(&self, _: *mut JSTracer) {
|
||||||
|
// Already traced.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ use std::collections::HashMap;
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
|
|
||||||
/// The `MozMap` (open-ended dictionary) type.
|
/// The `MozMap` (open-ended dictionary) type.
|
||||||
#[derive(Clone)]
|
#[derive(Clone, JSTraceable)]
|
||||||
pub struct MozMap<T> {
|
pub struct MozMap<T> {
|
||||||
map: HashMap<DOMString, T>,
|
map: HashMap<DOMString, T>,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue