Simplify how Prefable arrays are passed in bindings::interface

This commit is contained in:
Anthony Ramine 2016-05-20 22:21:46 +02:00
parent bee6f59b16
commit adcecda047
2 changed files with 19 additions and 26 deletions

View file

@ -2531,15 +2531,10 @@ assert!(!prototype_proto.ptr.is_null());""" % getPrototypeProto)]
properties = {"id": name}
for arrayName in self.properties.arrayNames():
array = getattr(self.properties, arrayName)
if arrayName == "consts":
if array.length():
properties[arrayName] = array.variableName()
else:
properties[arrayName] = "&[]"
elif array.length():
properties[arrayName] = "Some(%s)" % array.variableName()
if array.length():
properties[arrayName] = array.variableName()
else:
properties[arrayName] = "None"
properties[arrayName] = "&[]"
code.append(CGGeneric("""
let mut prototype = RootedObject::new(cx, ptr::null_mut());