mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 20:05:49 +00:00
Bug 1011510 - Codegen.py: Add EndGuard to enum generation; r=bz
This commit is contained in:
parent
7481ee096f
commit
252c68c45e
@ -5196,6 +5196,8 @@ HTMLInputElement::SetRangeText(const nsAString& aReplacement, uint32_t aStart,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
MOZ_CRASH("Unknown mode!");
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<nsAString> direction;
|
Optional<nsAString> direction;
|
||||||
|
@ -985,6 +985,8 @@ HTMLTextAreaElement::SetRangeText(const nsAString& aReplacement,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
MOZ_CRASH("Unknown mode!");
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<nsAString> direction;
|
Optional<nsAString> direction;
|
||||||
|
@ -7582,7 +7582,12 @@ def getEnumValueName(value):
|
|||||||
raise SyntaxError('"_empty" is not an IDL enum value we support yet')
|
raise SyntaxError('"_empty" is not an IDL enum value we support yet')
|
||||||
if value == "":
|
if value == "":
|
||||||
return "_empty"
|
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):
|
class CGEnum(CGThing):
|
||||||
@ -7602,10 +7607,11 @@ class CGEnum(CGThing):
|
|||||||
|
|
||||||
MOZ_BEGIN_ENUM_CLASS(${name}, uint32_t)
|
MOZ_BEGIN_ENUM_CLASS(${name}, uint32_t)
|
||||||
$*{enums}
|
$*{enums}
|
||||||
|
EndGuard_
|
||||||
MOZ_END_ENUM_CLASS(${name})
|
MOZ_END_ENUM_CLASS(${name})
|
||||||
""",
|
""",
|
||||||
name=self.enum.identifier.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(),
|
strings = CGNamespace(self.stringsNamespace(),
|
||||||
CGGeneric(declare="extern const EnumEntry %s[%d];\n"
|
CGGeneric(declare="extern const EnumEntry %s[%d];\n"
|
||||||
% (ENUM_ENTRY_VARIABLE_NAME, self.nEnumStrings())))
|
% (ENUM_ENTRY_VARIABLE_NAME, self.nEnumStrings())))
|
||||||
|
Loading…
Reference in New Issue
Block a user