Bug 952073. Fix codegen to actually work correctly for the case of a nullable union dictionary member with no default value. r=dzbarsky

This fix just makes us take the normal Optional codepath for this case, since there is no weirdness here.
This commit is contained in:
Boris Zbarsky 2013-12-19 23:30:38 -05:00
Родитель fbaa80f98d
Коммит 3fa148f89a
2 изменённых файлов: 7 добавлений и 5 удалений

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

@ -3299,13 +3299,14 @@ for (uint32_t i = 0; i < length; ++i) {
holderType = CGTemplatedType("Maybe", holderType)
# If we're isOptional and not nullable the normal optional handling will
# handle lazy construction of our holder. If we're nullable we do it
# all by hand because we do not want our holder constructed if we're
# null.
# handle lazy construction of our holder. If we're nullable and not
# isMember we do it all by hand because we do not want our holder
# constructed if we're null. But if we're isMember we don't have a
# holder anyway, so we can do the normal Optional codepath.
declLoc = "${declName}"
constructDecl = None
if nullable:
if isOptional:
if isOptional and not isMember:
holderArgs = "${declName}.Value().SetValue()"
declType = CGTemplatedType("Optional", declType)
constructDecl = CGGeneric("${declName}.Construct();")
@ -3374,7 +3375,7 @@ for (uint32_t i = 0; i < length; ++i) {
declType=declType,
holderType=holderType,
holderArgs=holderArgs,
dealWithOptional=isOptional and not nullable)
dealWithOptional=isOptional and (not nullable or isMember))
if type.isGeckoInterface():
assert not isEnforceRange and not isClamp

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

@ -791,6 +791,7 @@ dictionary Dict : ParentDict {
#ifdef DEBUG
(EventInit or long) eventInitOrLong;
(EventInit or long)? nullableEventInitOrLong;
(Node or long)? nullableNodeOrLong;
// CustomEventInit is useful to test because it needs rooting.
(CustomEventInit or long) eventInitOrLong2;
(CustomEventInit or long)? nullableEventInitOrLong2;