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

@ -2754,7 +2754,8 @@ use js::jsapi::JSContext;
use js::jsval::JSVal;
#[repr(uint)]
#[deriving(Encodable, PartialEq)]
#[deriving(PartialEq)]
#[jstraceable]
pub enum valuelist {
%s
}
@ -4893,7 +4894,7 @@ class CGCallback(CGClass):
bases=[ClassBase(baseName)],
constructors=self.getConstructors(),
methods=realMethods+getters+setters,
decorators="#[deriving(PartialEq,Clone,Encodable)]")
decorators="#[deriving(PartialEq,Clone)]#[jstraceable]")
def getConstructors(self):
return [ClassConstructor(
@ -5438,7 +5439,6 @@ class GlobalGenRoots():
CGGeneric("use dom::bindings::js::{JS, JSRef, Temporary};\n"),
CGGeneric("use dom::bindings::trace::JSTraceable;\n"),
CGGeneric("use dom::bindings::utils::Reflectable;\n"),
CGGeneric("use serialize::{Encodable, Encoder};\n"),
CGGeneric("use js::jsapi::JSTracer;\n\n")]
for descriptor in descriptors:
name = descriptor.name
@ -5500,16 +5500,7 @@ class GlobalGenRoots():
'toBound': name + 'Derived'})),
CGGeneric("impl %s for %s {}\n\n" % (name + 'Cast', name))]
trace = [CGGeneric(string.Template('''impl JSTraceable for ${name} {
fn trace(&self, tracer: *mut JSTracer) {
unsafe {
self.encode(&mut *tracer).ok().expect("failed to encode");
}
}
}
''').substitute({'name': name}))]
allprotos += protos + derived + cast + trace
allprotos += protos + derived + cast
curr = CGList(allprotos)
curr = CGWrapper(curr, pre=AUTOGENERATED_WARNING_COMMENT)