Bug 1223142 - make XPIDL set default nullptrs for optional out parameters, r=bz

--HG--
extra : commitid : 8pSPKD5AdOY
extra : transplant_source : %F2%8D%0D%20D4%98%7C%2A%16L%04%C0%88%24%AB%19%19%B2s
This commit is contained in:
Gijs Kruitbosch 2015-11-05 22:45:25 +00:00
parent f7b2001d62
commit 463f87d708

View File

@ -111,6 +111,19 @@ def paramlistAsNative(m, empty='void'):
location=None,
realtype=m.realtype)))
# Set any optional out params to default to nullptr. Skip if we just added
# extra non-optional args to l.
if len(l) == len(m.params):
paramIter = len(m.params) - 1
while (paramIter >= 0 and m.params[paramIter].optional and
m.params[paramIter].paramtype == "out"):
t = m.params[paramIter].type
# Strings can't be optional, so this shouldn't happen, but let's make sure:
if t == "AString" or t == "ACString" or t == "DOMString" or t == "AUTF8String":
break
l[paramIter] += " = nullptr"
paramIter -= 1
if len(l) == 0:
return empty