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

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

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