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

This commit is contained in:
Gijs Kruitbosch 2015-11-05 22:45:25 +00:00
parent 8300e7517f
commit bd81dcbb9c

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