зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1011510 - Codegen.py: Add EndGuard to enum generation; r=bz
This commit is contained in:
Родитель
7481ee096f
Коммит
252c68c45e
|
@ -5196,6 +5196,8 @@ HTMLInputElement::SetRangeText(const nsAString& aReplacement, uint32_t aStart,
|
|||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
MOZ_CRASH("Unknown mode!");
|
||||
}
|
||||
|
||||
Optional<nsAString> direction;
|
||||
|
|
|
@ -985,6 +985,8 @@ HTMLTextAreaElement::SetRangeText(const nsAString& aReplacement,
|
|||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
MOZ_CRASH("Unknown mode!");
|
||||
}
|
||||
|
||||
Optional<nsAString> direction;
|
||||
|
|
|
@ -7582,7 +7582,12 @@ def getEnumValueName(value):
|
|||
raise SyntaxError('"_empty" is not an IDL enum value we support yet')
|
||||
if value == "":
|
||||
return "_empty"
|
||||
return MakeNativeName(value)
|
||||
nativeName = MakeNativeName(value)
|
||||
if nativeName == "EndGuard_":
|
||||
raise SyntaxError('Enum value "' + value + '" cannot be used because it'
|
||||
' collides with our internal EndGuard_ value. Please'
|
||||
' rename our internal EndGuard_ to something else')
|
||||
return nativeName
|
||||
|
||||
|
||||
class CGEnum(CGThing):
|
||||
|
@ -7602,10 +7607,11 @@ class CGEnum(CGThing):
|
|||
|
||||
MOZ_BEGIN_ENUM_CLASS(${name}, uint32_t)
|
||||
$*{enums}
|
||||
EndGuard_
|
||||
MOZ_END_ENUM_CLASS(${name})
|
||||
""",
|
||||
name=self.enum.identifier.name,
|
||||
enums=",\n".join(map(getEnumValueName, self.enum.values())) + "\n")
|
||||
enums=",\n".join(map(getEnumValueName, self.enum.values())) + ",\n")
|
||||
strings = CGNamespace(self.stringsNamespace(),
|
||||
CGGeneric(declare="extern const EnumEntry %s[%d];\n"
|
||||
% (ENUM_ENTRY_VARIABLE_NAME, self.nEnumStrings())))
|
||||
|
|
Загрузка…
Ссылка в новой задаче