mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Rust upgrade to rustc hash b03a2755193cd756583bcf5831cf4545d75ecb8a
This commit is contained in:
parent
26045d7fcb
commit
d1b433a3b3
160 changed files with 1427 additions and 1162 deletions
|
@ -183,7 +183,7 @@ class CGMethodCall(CGThing):
|
|||
nativeMethodName + '_'*signatureIndex,
|
||||
static, descriptor,
|
||||
method, argConversionStartsAt)
|
||||
|
||||
|
||||
|
||||
signatures = method.signatures()
|
||||
if len(signatures) == 1:
|
||||
|
@ -203,7 +203,7 @@ class CGMethodCall(CGThing):
|
|||
"}" % (requiredArgs, methodName))
|
||||
self.cgRoot.prepend(
|
||||
CGWrapper(CGGeneric(code), pre="\n", post="\n"))
|
||||
|
||||
|
||||
return
|
||||
|
||||
# Need to find the right overload
|
||||
|
@ -277,7 +277,7 @@ class CGMethodCall(CGThing):
|
|||
s[1][distinguishingIndex].type.isNonCallbackInterface()) ]
|
||||
# There might be more than one of these; we need to check
|
||||
# which ones we unwrap to.
|
||||
|
||||
|
||||
if len(interfacesSigs) > 0:
|
||||
# The spec says that we should check for "platform objects
|
||||
# implementing an interface", but it's enough to guard on these
|
||||
|
@ -381,7 +381,7 @@ class CGMethodCall(CGThing):
|
|||
"return 0;\n" % methodName)))
|
||||
#XXXjdm Avoid unreachable statement warnings
|
||||
#overloadCGThings.append(
|
||||
# CGGeneric('fail!("We have an always-returning default case");\n'
|
||||
# CGGeneric('panic!("We have an always-returning default case");\n'
|
||||
# 'return 0;'))
|
||||
self.cgRoot = CGWrapper(CGList(overloadCGThings, "\n"),
|
||||
pre="\n")
|
||||
|
@ -686,7 +686,7 @@ def getJSToNativeConversionTemplate(type, descriptorProvider, failureCode=None,
|
|||
value = "Some(%s)" % value
|
||||
|
||||
default = (
|
||||
"static data: [u8, ..%s] = [ %s ];\n"
|
||||
"const data: [u8, ..%s] = [ %s ];\n"
|
||||
"%s" %
|
||||
(len(defaultValue.value) + 1,
|
||||
", ".join(["'" + char + "' as u8" for char in defaultValue.value] + ["0"]),
|
||||
|
@ -724,7 +724,7 @@ def getJSToNativeConversionTemplate(type, descriptorProvider, failureCode=None,
|
|||
handleInvalidEnumValueCode = exceptionCode
|
||||
else:
|
||||
handleInvalidEnumValueCode = "return 1;"
|
||||
|
||||
|
||||
template = (
|
||||
"match FindEnumStringIndex(cx, ${val}, %(values)s) {\n"
|
||||
" Err(_) => { %(exceptionCode)s },\n"
|
||||
|
@ -1146,7 +1146,7 @@ class PropertyDefiner:
|
|||
if specTerminator:
|
||||
specs.append(specTerminator)
|
||||
|
||||
return (("static %s: &'static [%s] = &[\n" +
|
||||
return (("const %s: &'static [%s] = &[\n" +
|
||||
",\n".join(specs) + "\n" +
|
||||
"];\n\n") % (name, specType))
|
||||
|
||||
|
@ -1197,9 +1197,9 @@ class MethodDefiner(PropertyDefiner):
|
|||
return (m["name"], accessor, jitinfo, m["length"], m["flags"])
|
||||
|
||||
def stringDecl(m):
|
||||
return "static %s_name: [u8, ..%i] = %s;\n" % (m["name"], len(m["name"]) + 1,
|
||||
return "const %s_name: [u8, ..%i] = %s;\n" % (m["name"], len(m["name"]) + 1,
|
||||
str_to_const_array(m["name"]))
|
||||
|
||||
|
||||
decls = ''.join([stringDecl(m) for m in array])
|
||||
return decls + self.generatePrefableArray(
|
||||
array, name,
|
||||
|
@ -1265,9 +1265,9 @@ class AttrDefiner(PropertyDefiner):
|
|||
|
||||
def stringDecl(attr):
|
||||
name = attr.identifier.name
|
||||
return "static %s_name: [u8, ..%i] = %s;\n" % (name, len(name) + 1,
|
||||
return "const %s_name: [u8, ..%i] = %s;\n" % (name, len(name) + 1,
|
||||
str_to_const_array(name))
|
||||
|
||||
|
||||
decls = ''.join([stringDecl(m) for m in array])
|
||||
|
||||
return decls + self.generatePrefableArray(
|
||||
|
@ -1296,8 +1296,8 @@ class ConstDefiner(PropertyDefiner):
|
|||
|
||||
def stringDecl(const):
|
||||
name = const.identifier.name
|
||||
return "static %s_name: &'static [u8] = &%s;\n" % (name, str_to_const_array(name))
|
||||
|
||||
return "const %s_name: &'static [u8] = &%s;\n" % (name, str_to_const_array(name))
|
||||
|
||||
decls = ''.join([stringDecl(m) for m in array])
|
||||
|
||||
return decls + self.generatePrefableArray(
|
||||
|
@ -1362,13 +1362,13 @@ class CGImports(CGWrapper):
|
|||
# CallbackMember.getArgConversions.
|
||||
'unreachable_code',
|
||||
'non_camel_case_types',
|
||||
'non_uppercase_statics',
|
||||
'unnecessary_parens',
|
||||
'non_upper_case_globals',
|
||||
'unused_parens',
|
||||
'unused_imports',
|
||||
'unused_variable',
|
||||
'unused_variables',
|
||||
'unused_unsafe',
|
||||
'unused_mut',
|
||||
'dead_assignment',
|
||||
'unused_assignments',
|
||||
'dead_code',
|
||||
]
|
||||
|
||||
|
@ -1442,7 +1442,7 @@ class CGDOMJSClass(CGThing):
|
|||
flags = "0"
|
||||
slots = "1"
|
||||
return """
|
||||
static Class_name: [u8, ..%i] = %s;
|
||||
const Class_name: [u8, ..%i] = %s;
|
||||
static Class: DOMJSClass = DOMJSClass {
|
||||
base: js::Class {
|
||||
name: &Class_name as *const u8 as *const libc::c_char,
|
||||
|
@ -1526,7 +1526,7 @@ class CGPrototypeJSClass(CGThing):
|
|||
|
||||
def define(self):
|
||||
return """
|
||||
static PrototypeClassName__: [u8, ..%s] = %s;
|
||||
const PrototypeClassName__: [u8, ..%s] = %s;
|
||||
static PrototypeClass: JSClass = JSClass {
|
||||
name: &PrototypeClassName__ as *const u8 as *const libc::c_char,
|
||||
flags: (1 & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT as uint, //JSCLASS_HAS_RESERVED_SLOTS(1)
|
||||
|
@ -1559,7 +1559,7 @@ class CGInterfaceObjectJSClass(CGThing):
|
|||
ctorname = "0 as *const u8" if not self.descriptor.interface.ctor() else CONSTRUCT_HOOK_NAME
|
||||
hasinstance = HASINSTANCE_HOOK_NAME
|
||||
return """
|
||||
static InterfaceObjectClass: JSClass = {
|
||||
const InterfaceObjectClass: JSClass = {
|
||||
%s, 0,
|
||||
JS_PropertyStub,
|
||||
JS_PropertyStub,
|
||||
|
@ -2192,7 +2192,7 @@ class CGCallGenerator(CGThing):
|
|||
call = CGGeneric(nativeMethodName)
|
||||
if static:
|
||||
call = CGWrapper(call, pre="%s::" % descriptorProvider.interface.identifier.name)
|
||||
else:
|
||||
else:
|
||||
call = CGWrapper(call, pre="%s." % object)
|
||||
call = CGList([call, CGWrapper(args, pre="(", post=")")])
|
||||
|
||||
|
@ -2348,7 +2348,7 @@ class CGCase(CGList):
|
|||
bodyList = CGList([body], "\n")
|
||||
if fallThrough:
|
||||
raise TypeError("fall through required but unsupported")
|
||||
#bodyList.append(CGGeneric('fail!("fall through unsupported"); /* Fall through */'))
|
||||
#bodyList.append(CGGeneric('panic!("fall through unsupported"); /* Fall through */'))
|
||||
self.append(CGIndenter(bodyList));
|
||||
self.append(CGGeneric("}"))
|
||||
|
||||
|
@ -2683,7 +2683,7 @@ class CGMemberJITInfo(CGThing):
|
|||
depth = self.descriptor.interface.inheritanceDepth()
|
||||
failstr = "true" if infallible else "false"
|
||||
return ("\n"
|
||||
"static %s: JSJitInfo = JSJitInfo {\n"
|
||||
"const %s: JSJitInfo = JSJitInfo {\n"
|
||||
" op: %s as *const u8,\n"
|
||||
" protoID: %s,\n"
|
||||
" depth: %s,\n"
|
||||
|
@ -2760,7 +2760,7 @@ pub enum valuelist {
|
|||
%s
|
||||
}
|
||||
|
||||
pub static strings: &'static [&'static str] = &[
|
||||
pub const strings: &'static [&'static str] = &[
|
||||
%s,
|
||||
];
|
||||
|
||||
|
@ -2806,7 +2806,7 @@ class CGConstant(CGThing):
|
|||
def stringDecl(const):
|
||||
name = const.identifier.name
|
||||
value = convertConstIDLValueToRust(const.value)
|
||||
return CGGeneric("pub static %s: %s = %s;\n" % (name, builtinNames[const.value.type.tag()], value))
|
||||
return CGGeneric("pub const %s: %s = %s;\n" % (name, builtinNames[const.value.type.tag()], value))
|
||||
|
||||
return CGIndenter(CGList(stringDecl(m) for m in self.constants)).define()
|
||||
|
||||
|
@ -3889,7 +3889,7 @@ class CGDOMJSProxyHandler_obj_toString(CGAbstractExternMethod):
|
|||
return call.define() + """
|
||||
|
||||
JSString* jsresult;
|
||||
return xpc_qsStringToJsstring(cx, result, &jsresult) ? jsresult : NULL;"""
|
||||
return xpc_qsStringToJsstring(cx, result, &jsresult) ? jsresult : NULL;"""
|
||||
|
||||
return """let s = "%s".to_c_str();
|
||||
_obj_toString(cx, s.as_ptr())""" % self.descriptor.name
|
||||
|
@ -5166,7 +5166,7 @@ class CallbackMember(CGNativeMember):
|
|||
if arg.optional and not arg.defaultValue:
|
||||
argval += ".clone().unwrap()"
|
||||
|
||||
conversion = wrapForType("*argv.get_mut(%s)" % jsvalIndex,
|
||||
conversion = wrapForType("argv[%s]" % jsvalIndex,
|
||||
result=argval,
|
||||
successCode="continue;" if arg.variadic else "break;")
|
||||
if arg.variadic:
|
||||
|
@ -5183,7 +5183,7 @@ class CallbackMember(CGNativeMember):
|
|||
" // This is our current trailing argument; reduce argc\n"
|
||||
" argc -= 1;\n"
|
||||
"} else {\n"
|
||||
" *argv.get_mut(%d) = UndefinedValue();\n"
|
||||
" argv[%d] = UndefinedValue();\n"
|
||||
"}" % (i+1, i))
|
||||
return conversion
|
||||
|
||||
|
@ -5397,7 +5397,7 @@ class GlobalGenRoots():
|
|||
|
||||
return CGList([
|
||||
CGGeneric(AUTOGENERATED_WARNING_COMMENT),
|
||||
CGGeneric("pub static MAX_PROTO_CHAIN_LENGTH: uint = %d;\n\n" % config.maxProtoChainLength),
|
||||
CGGeneric("pub const MAX_PROTO_CHAIN_LENGTH: uint = %d;\n\n" % config.maxProtoChainLength),
|
||||
CGNamespacedEnum('id', 'ID', protos, [0], deriving="PartialEq"),
|
||||
CGNamespacedEnum('proxies', 'Proxy', proxies, [0], deriving="PartialEq"),
|
||||
])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue