mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Do not allow unused_mut in codegen anymore
This commit is contained in:
parent
aaa7a86381
commit
1064e7decc
2 changed files with 10 additions and 9 deletions
|
@ -1634,7 +1634,6 @@ class CGImports(CGWrapper):
|
||||||
'unused_parens',
|
'unused_parens',
|
||||||
'unused_imports',
|
'unused_imports',
|
||||||
'unused_variables',
|
'unused_variables',
|
||||||
'unused_mut',
|
|
||||||
'unused_assignments',
|
'unused_assignments',
|
||||||
'dead_code',
|
'dead_code',
|
||||||
]
|
]
|
||||||
|
@ -2115,7 +2114,7 @@ class CGAbstractMethod(CGThing):
|
||||||
|
|
||||||
|
|
||||||
def CreateBindingJSObject(descriptor, parent=None):
|
def CreateBindingJSObject(descriptor, parent=None):
|
||||||
create = "let mut raw = Box::into_raw(object);\nlet _rt = RootedTraceable::new(&*raw);\n"
|
create = "let raw = Box::into_raw(object);\nlet _rt = RootedTraceable::new(&*raw);\n"
|
||||||
if descriptor.proxy:
|
if descriptor.proxy:
|
||||||
assert not descriptor.isGlobal()
|
assert not descriptor.isGlobal()
|
||||||
create += """
|
create += """
|
||||||
|
@ -2164,10 +2163,10 @@ class CGWrapMethod(CGAbstractMethod):
|
||||||
assert not descriptor.interface.isCallback()
|
assert not descriptor.interface.isCallback()
|
||||||
if not descriptor.isGlobal():
|
if not descriptor.isGlobal():
|
||||||
args = [Argument('*mut JSContext', 'cx'), Argument('GlobalRef', 'scope'),
|
args = [Argument('*mut JSContext', 'cx'), Argument('GlobalRef', 'scope'),
|
||||||
Argument("Box<%s>" % descriptor.concreteType, 'object', mutable=True)]
|
Argument("Box<%s>" % descriptor.concreteType, 'object')]
|
||||||
else:
|
else:
|
||||||
args = [Argument('*mut JSContext', 'cx'),
|
args = [Argument('*mut JSContext', 'cx'),
|
||||||
Argument("Box<%s>" % descriptor.concreteType, 'object', mutable=True)]
|
Argument("Box<%s>" % descriptor.concreteType, 'object')]
|
||||||
retval = 'Root<%s>' % descriptor.concreteType
|
retval = 'Root<%s>' % descriptor.concreteType
|
||||||
CGAbstractMethod.__init__(self, descriptor, 'Wrap', retval, args,
|
CGAbstractMethod.__init__(self, descriptor, 'Wrap', retval, args,
|
||||||
pub=True, unsafe=True)
|
pub=True, unsafe=True)
|
||||||
|
@ -2858,7 +2857,7 @@ class CGStaticMethod(CGAbstractStaticBindingMethod):
|
||||||
def generate_code(self):
|
def generate_code(self):
|
||||||
nativeName = CGSpecializedMethod.makeNativeName(self.descriptor,
|
nativeName = CGSpecializedMethod.makeNativeName(self.descriptor,
|
||||||
self.method)
|
self.method)
|
||||||
setupArgs = CGGeneric("let mut args = CallArgs::from_vp(vp, argc);\n")
|
setupArgs = CGGeneric("let args = CallArgs::from_vp(vp, argc);\n")
|
||||||
call = CGMethodCall(["global.r()"], nativeName, True, self.descriptor, self.method)
|
call = CGMethodCall(["global.r()"], nativeName, True, self.descriptor, self.method)
|
||||||
return CGList([setupArgs, call])
|
return CGList([setupArgs, call])
|
||||||
|
|
||||||
|
@ -2909,7 +2908,7 @@ class CGStaticGetter(CGAbstractStaticBindingMethod):
|
||||||
def generate_code(self):
|
def generate_code(self):
|
||||||
nativeName = CGSpecializedGetter.makeNativeName(self.descriptor,
|
nativeName = CGSpecializedGetter.makeNativeName(self.descriptor,
|
||||||
self.attr)
|
self.attr)
|
||||||
setupArgs = CGGeneric("let mut args = CallArgs::from_vp(vp, argc);\n")
|
setupArgs = CGGeneric("let args = CallArgs::from_vp(vp, argc);\n")
|
||||||
call = CGGetterCall(["global.r()"], self.attr.type, nativeName, self.descriptor,
|
call = CGGetterCall(["global.r()"], self.attr.type, nativeName, self.descriptor,
|
||||||
self.attr)
|
self.attr)
|
||||||
return CGList([setupArgs, call])
|
return CGList([setupArgs, call])
|
||||||
|
@ -4227,7 +4226,7 @@ class CGDOMJSProxyHandler_ownPropertyKeys(CGAbstractExternMethod):
|
||||||
for name in (*unwrapped_proxy).SupportedPropertyNames() {
|
for name in (*unwrapped_proxy).SupportedPropertyNames() {
|
||||||
let cstring = CString::new(name).unwrap();
|
let cstring = CString::new(name).unwrap();
|
||||||
let jsstring = JS_InternString(cx, cstring.as_ptr());
|
let jsstring = JS_InternString(cx, cstring.as_ptr());
|
||||||
let mut rooted = RootedString::new(cx, jsstring);
|
let rooted = RootedString::new(cx, jsstring);
|
||||||
let jsid = INTERNED_STRING_TO_JSID(cx, rooted.handle().get());
|
let jsid = INTERNED_STRING_TO_JSID(cx, rooted.handle().get());
|
||||||
let rooted_jsid = RootedId::new(cx, jsid);
|
let rooted_jsid = RootedId::new(cx, jsid);
|
||||||
AppendToAutoIdVector(props, rooted_jsid.handle().get());
|
AppendToAutoIdVector(props, rooted_jsid.handle().get());
|
||||||
|
@ -5548,6 +5547,8 @@ class CallbackMember(CGNativeMember):
|
||||||
"}\n")
|
"}\n")
|
||||||
|
|
||||||
def getArgcDecl(self):
|
def getArgcDecl(self):
|
||||||
|
if self.argCount <= 1:
|
||||||
|
return CGGeneric("let argc = %s;" % self.argCountStr)
|
||||||
return CGGeneric("let mut argc = %s;" % self.argCountStr)
|
return CGGeneric("let mut argc = %s;" % self.argCountStr)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
|
@ -169,13 +169,13 @@ pub mod codegen {
|
||||||
include!(concat!(env!("OUT_DIR"), "/PrototypeList.rs"));
|
include!(concat!(env!("OUT_DIR"), "/PrototypeList.rs"));
|
||||||
}
|
}
|
||||||
#[allow(unreachable_code, non_camel_case_types, non_upper_case_globals, unused_parens,
|
#[allow(unreachable_code, non_camel_case_types, non_upper_case_globals, unused_parens,
|
||||||
unused_imports, unused_variables, unused_mut, unused_assignments,
|
unused_imports, unused_variables, unused_assignments,
|
||||||
dead_code)]
|
dead_code)]
|
||||||
pub mod RegisterBindings {
|
pub mod RegisterBindings {
|
||||||
include!(concat!(env!("OUT_DIR"), "/RegisterBindings.rs"));
|
include!(concat!(env!("OUT_DIR"), "/RegisterBindings.rs"));
|
||||||
}
|
}
|
||||||
#[allow(unreachable_code, non_camel_case_types, non_upper_case_globals, unused_parens,
|
#[allow(unreachable_code, non_camel_case_types, non_upper_case_globals, unused_parens,
|
||||||
unused_imports, unused_variables, unused_mut, unused_assignments,
|
unused_imports, unused_variables, unused_assignments,
|
||||||
dead_code)]
|
dead_code)]
|
||||||
pub mod UnionTypes {
|
pub mod UnionTypes {
|
||||||
include!(concat!(env!("OUT_DIR"), "/UnionTypes.rs"));
|
include!(concat!(env!("OUT_DIR"), "/UnionTypes.rs"));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue