Bug 1250985 - Part 1: Add a way to identify whether a WebIDL dictionary has any members present; r=bzbarsky

This commit is contained in:
Ehsan Akhgari 2016-02-24 13:45:46 -05:00
Родитель 6e150071f6
Коммит afaabe46dc
2 изменённых файлов: 12 добавлений и 0 удалений

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

@ -50,11 +50,19 @@ protected:
struct FastDictionaryInitializer {
};
bool mIsAnyMemberPresent = false;
private:
// aString is expected to actually be an nsAString*. Should only be
// called from StringifyToJSON.
static bool AppendJSONToString(const char16_t* aJSONData,
uint32_t aDataLength, void* aString);
public:
bool IsAnyMemberPresent() const
{
return mIsAnyMemberPresent;
}
};
// Struct that serves as a base class for all typed arrays and array buffers and

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

@ -12530,6 +12530,10 @@ class CGDictionary(CGThing):
"convert": string.Template(conversionInfo.template).substitute(replacements),
"propGet": propGet
}
# The conversion code will only run where a default value or a value passed
# by the author needs to get converted, so we can remember if we have any
# members present here.
conversionReplacements["convert"] += "mIsAnyMemberPresent = true;\n"
conversion = ("if (!isNull && !${propGet}) {\n"
" return false;\n"
"}\n")