Bug 816842. Clean up jsval return values in quickstubs a bit. r=bholley, a=bajaj

This commit is contained in:
Boris Zbarsky 2012-12-06 15:21:18 -05:00
Родитель bed59909cc
Коммит 4379d6cfdd
1 изменённых файлов: 5 добавлений и 9 удалений

Просмотреть файл

@ -594,7 +594,8 @@ def writeResultDecl(f, type, varname):
f.write(" nsString %s;\n" % varname)
return
elif name == '[jsval]':
return # nothing to declare; see special case in outParamForm
f.write(" jsval %s;\n" % varname)
return
elif t.kind in ('interface', 'forward'):
f.write(" nsCOMPtr<%s> %s;\n" % (type.name, varname))
return
@ -604,15 +605,11 @@ def writeResultDecl(f, type, varname):
def outParamForm(name, type):
type = unaliasType(type)
# If we start allowing [jsval] return types here, we need to tack
# the return value onto the arguments list in the callers,
# possibly, and handle properly returning it too. See bug 604198.
assert getBuiltinOrNativeTypeName(type) is not '[jsval]'
if type.kind == 'builtin':
return '&' + name
elif type.kind == 'native':
if getBuiltinOrNativeTypeName(type) == '[jsval]':
return 'vp'
return '&' + name
elif type.modifier == 'ref':
return name
else:
@ -671,9 +668,8 @@ resultConvTemplates = {
" return xpc::StringToJsval(cx, result, ${jsvalPtr});\n",
'[jsval]':
# Here there's nothing to convert, because the result has already been
# written directly to *rv. See the special case in outParamForm.
" return JS_TRUE;\n"
" ${jsvalRef} = result;\n"
" return JS_WrapValue(cx, ${jsvalPtr});\n"
}
def isVariantType(t):