Use snake case for the members of NativeProperties.

Note that the codegen uses the names of the Python fields to initialize the
Rust struct.
This commit is contained in:
Ms2ger 2015-01-29 18:41:30 +01:00
parent b4b59df5e4
commit 23813577d1
2 changed files with 15 additions and 11 deletions

View file

@ -1905,10 +1905,10 @@ class CGAbstractExternMethod(CGAbstractMethod):
class PropertyArrays(): class PropertyArrays():
def __init__(self, descriptor): def __init__(self, descriptor):
self.staticMethods = MethodDefiner(descriptor, "StaticMethods", self.static_methods = MethodDefiner(descriptor, "StaticMethods",
static=True) static=True)
self.staticAttrs = AttrDefiner(descriptor, "StaticAttributes", self.static_attrs = AttrDefiner(descriptor, "StaticAttributes",
static=True) static=True)
self.methods = MethodDefiner(descriptor, "Methods", static=False) self.methods = MethodDefiner(descriptor, "Methods", static=False)
self.attrs = AttrDefiner(descriptor, "Attributes", static=False) self.attrs = AttrDefiner(descriptor, "Attributes", static=False)
self.consts = ConstDefiner(descriptor, "Constants") self.consts = ConstDefiner(descriptor, "Constants")
@ -1916,7 +1916,7 @@ class PropertyArrays():
@staticmethod @staticmethod
def arrayNames(): def arrayNames():
return [ "staticMethods", "staticAttrs", "methods", "attrs", "consts" ] return ["static_methods", "static_attrs", "methods", "attrs", "consts"]
def variableNames(self): def variableNames(self):
names = {} names = {}

View file

@ -171,9 +171,9 @@ pub struct NativeProperties {
/// Constants for the interface. /// Constants for the interface.
pub consts: Option<&'static [ConstantSpec]>, pub consts: Option<&'static [ConstantSpec]>,
/// Static methods for the interface. /// Static methods for the interface.
pub staticMethods: Option<&'static [JSFunctionSpec]>, pub static_methods: Option<&'static [JSFunctionSpec]>,
/// Static attributes for the interface. /// Static attributes for the interface.
pub staticAttrs: Option<&'static [JSPropertySpec]>, pub static_attrs: Option<&'static [JSPropertySpec]>,
} }
unsafe impl Sync for NativeProperties {} unsafe impl Sync for NativeProperties {}
@ -226,13 +226,17 @@ fn CreateInterfaceObject(cx: *mut JSContext, global: *mut JSObject, receiver: *m
let constructor = JS_GetFunctionObject(fun); let constructor = JS_GetFunctionObject(fun);
assert!(!constructor.is_null()); assert!(!constructor.is_null());
match members.staticMethods { match members.static_methods {
Some(staticMethods) => DefineMethods(cx, constructor, staticMethods), Some(static_methods) => {
DefineMethods(cx, constructor, static_methods)
},
_ => (), _ => (),
} }
match members.staticAttrs { match members.static_attrs {
Some(staticProperties) => DefineProperties(cx, constructor, staticProperties), Some(static_properties) => {
DefineProperties(cx, constructor, static_properties)
},
_ => (), _ => (),
} }