Don't mark new methods as unsafe in code generation

This commit is contained in:
marmeladema 2019-07-27 17:05:35 +01:00
parent 914bda9cd4
commit 8968286aa1

View file

@ -6355,8 +6355,9 @@ class CGDictionary(CGThing):
return string.Template(
"impl ${selfName} {\n"
"${empty}\n"
" pub unsafe fn new(cx: SafeJSContext, val: HandleValue) \n"
" pub fn new(cx: SafeJSContext, val: HandleValue) \n"
" -> Result<ConversionResult<${actualType}>, ()> {\n"
" unsafe {\n"
" let object = if val.get().is_null_or_undefined() {\n"
" ptr::null_mut()\n"
" } else if val.get().is_object() {\n"
@ -6371,6 +6372,7 @@ class CGDictionary(CGThing):
"${postInitial}"
" Ok(ConversionResult::Success(dictionary))\n"
" }\n"
" }\n"
"}\n"
"\n"
"impl FromJSValConvertible for ${actualType} {\n"
@ -6391,11 +6393,11 @@ class CGDictionary(CGThing):
"selfName": selfName,
"actualType": actualType,
"empty": CGIndenter(CGGeneric(self.makeEmpty()), indentLevel=4).define(),
"initParent": CGIndenter(CGGeneric(initParent), indentLevel=12).define(),
"initMembers": CGIndenter(memberInits, indentLevel=12).define(),
"initParent": CGIndenter(CGGeneric(initParent), indentLevel=16).define(),
"initMembers": CGIndenter(memberInits, indentLevel=16).define(),
"insertMembers": CGIndenter(memberInserts, indentLevel=8).define(),
"preInitial": CGIndenter(CGGeneric(preInitial), indentLevel=12).define(),
"postInitial": CGIndenter(CGGeneric(postInitial), indentLevel=12).define(),
"preInitial": CGIndenter(CGGeneric(preInitial), indentLevel=16).define(),
"postInitial": CGIndenter(CGGeneric(postInitial), indentLevel=16).define(),
})
def membersNeedTracing(self):