mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 05:15:45 +00:00
Bug 1451169 - Reduce indirection for static pointers in txCoreFunctionCall.cpp. r=erahm
--HG-- extra : rebase_source : 847baf81592f5ae87dc2eee09a74dddbf8d82162
This commit is contained in:
parent
f3cf78e19d
commit
7c53c2d5e2
@ -21,46 +21,46 @@ using namespace mozilla;
|
||||
|
||||
struct txCoreFunctionDescriptor
|
||||
{
|
||||
int8_t mMinParams;
|
||||
int8_t mMaxParams;
|
||||
Expr::ResultType mReturnType;
|
||||
nsStaticAtom** mName;
|
||||
const int8_t mMinParams;
|
||||
const int8_t mMaxParams;
|
||||
const Expr::ResultType mReturnType;
|
||||
const nsStaticAtom* const mName;
|
||||
};
|
||||
|
||||
// This must be ordered in the same order as txCoreFunctionCall::eType.
|
||||
// If you change one, change the other.
|
||||
static const txCoreFunctionDescriptor descriptTable[] =
|
||||
{
|
||||
{ 1, 1, Expr::NUMBER_RESULT, &nsGkAtoms::count }, // COUNT
|
||||
{ 1, 1, Expr::NODESET_RESULT, &nsGkAtoms::id }, // ID
|
||||
{ 0, 0, Expr::NUMBER_RESULT, &nsGkAtoms::last }, // LAST
|
||||
{ 0, 1, Expr::STRING_RESULT, &nsGkAtoms::localName }, // LOCAL_NAME
|
||||
{ 0, 1, Expr::STRING_RESULT, &nsGkAtoms::namespaceUri }, // NAMESPACE_URI
|
||||
{ 0, 1, Expr::STRING_RESULT, &nsGkAtoms::name }, // NAME
|
||||
{ 0, 0, Expr::NUMBER_RESULT, &nsGkAtoms::position }, // POSITION
|
||||
{ 1, 1, Expr::NUMBER_RESULT, nsGkAtoms::count }, // COUNT
|
||||
{ 1, 1, Expr::NODESET_RESULT, nsGkAtoms::id }, // ID
|
||||
{ 0, 0, Expr::NUMBER_RESULT, nsGkAtoms::last }, // LAST
|
||||
{ 0, 1, Expr::STRING_RESULT, nsGkAtoms::localName }, // LOCAL_NAME
|
||||
{ 0, 1, Expr::STRING_RESULT, nsGkAtoms::namespaceUri }, // NAMESPACE_URI
|
||||
{ 0, 1, Expr::STRING_RESULT, nsGkAtoms::name }, // NAME
|
||||
{ 0, 0, Expr::NUMBER_RESULT, nsGkAtoms::position }, // POSITION
|
||||
|
||||
{ 2, -1, Expr::STRING_RESULT, &nsGkAtoms::concat }, // CONCAT
|
||||
{ 2, 2, Expr::BOOLEAN_RESULT, &nsGkAtoms::contains }, // CONTAINS
|
||||
{ 0, 1, Expr::STRING_RESULT, &nsGkAtoms::normalizeSpace }, // NORMALIZE_SPACE
|
||||
{ 2, 2, Expr::BOOLEAN_RESULT, &nsGkAtoms::startsWith }, // STARTS_WITH
|
||||
{ 0, 1, Expr::STRING_RESULT, &nsGkAtoms::string }, // STRING
|
||||
{ 0, 1, Expr::NUMBER_RESULT, &nsGkAtoms::stringLength }, // STRING_LENGTH
|
||||
{ 2, 3, Expr::STRING_RESULT, &nsGkAtoms::substring }, // SUBSTRING
|
||||
{ 2, 2, Expr::STRING_RESULT, &nsGkAtoms::substringAfter }, // SUBSTRING_AFTER
|
||||
{ 2, 2, Expr::STRING_RESULT, &nsGkAtoms::substringBefore }, // SUBSTRING_BEFORE
|
||||
{ 3, 3, Expr::STRING_RESULT, &nsGkAtoms::translate }, // TRANSLATE
|
||||
{ 2, -1, Expr::STRING_RESULT, nsGkAtoms::concat }, // CONCAT
|
||||
{ 2, 2, Expr::BOOLEAN_RESULT, nsGkAtoms::contains }, // CONTAINS
|
||||
{ 0, 1, Expr::STRING_RESULT, nsGkAtoms::normalizeSpace }, // NORMALIZE_SPACE
|
||||
{ 2, 2, Expr::BOOLEAN_RESULT, nsGkAtoms::startsWith }, // STARTS_WITH
|
||||
{ 0, 1, Expr::STRING_RESULT, nsGkAtoms::string }, // STRING
|
||||
{ 0, 1, Expr::NUMBER_RESULT, nsGkAtoms::stringLength }, // STRING_LENGTH
|
||||
{ 2, 3, Expr::STRING_RESULT, nsGkAtoms::substring }, // SUBSTRING
|
||||
{ 2, 2, Expr::STRING_RESULT, nsGkAtoms::substringAfter }, // SUBSTRING_AFTER
|
||||
{ 2, 2, Expr::STRING_RESULT, nsGkAtoms::substringBefore }, // SUBSTRING_BEFORE
|
||||
{ 3, 3, Expr::STRING_RESULT, nsGkAtoms::translate }, // TRANSLATE
|
||||
|
||||
{ 0, 1, Expr::NUMBER_RESULT, &nsGkAtoms::number }, // NUMBER
|
||||
{ 1, 1, Expr::NUMBER_RESULT, &nsGkAtoms::round }, // ROUND
|
||||
{ 1, 1, Expr::NUMBER_RESULT, &nsGkAtoms::floor }, // FLOOR
|
||||
{ 1, 1, Expr::NUMBER_RESULT, &nsGkAtoms::ceiling }, // CEILING
|
||||
{ 1, 1, Expr::NUMBER_RESULT, &nsGkAtoms::sum }, // SUM
|
||||
{ 0, 1, Expr::NUMBER_RESULT, nsGkAtoms::number }, // NUMBER
|
||||
{ 1, 1, Expr::NUMBER_RESULT, nsGkAtoms::round }, // ROUND
|
||||
{ 1, 1, Expr::NUMBER_RESULT, nsGkAtoms::floor }, // FLOOR
|
||||
{ 1, 1, Expr::NUMBER_RESULT, nsGkAtoms::ceiling }, // CEILING
|
||||
{ 1, 1, Expr::NUMBER_RESULT, nsGkAtoms::sum }, // SUM
|
||||
|
||||
{ 1, 1, Expr::BOOLEAN_RESULT, &nsGkAtoms::boolean }, // BOOLEAN
|
||||
{ 0, 0, Expr::BOOLEAN_RESULT, &nsGkAtoms::_false }, // _FALSE
|
||||
{ 1, 1, Expr::BOOLEAN_RESULT, &nsGkAtoms::lang }, // LANG
|
||||
{ 1, 1, Expr::BOOLEAN_RESULT, &nsGkAtoms::_not }, // _NOT
|
||||
{ 0, 0, Expr::BOOLEAN_RESULT, &nsGkAtoms::_true } // _TRUE
|
||||
{ 1, 1, Expr::BOOLEAN_RESULT, nsGkAtoms::boolean }, // BOOLEAN
|
||||
{ 0, 0, Expr::BOOLEAN_RESULT, nsGkAtoms::_false }, // _FALSE
|
||||
{ 1, 1, Expr::BOOLEAN_RESULT, nsGkAtoms::lang }, // LANG
|
||||
{ 1, 1, Expr::BOOLEAN_RESULT, nsGkAtoms::_not }, // _NOT
|
||||
{ 0, 0, Expr::BOOLEAN_RESULT, nsGkAtoms::_true } // _TRUE
|
||||
};
|
||||
|
||||
|
||||
@ -723,7 +723,7 @@ txCoreFunctionCall::getTypeFromAtom(nsAtom* aName, eType& aType)
|
||||
{
|
||||
uint32_t i;
|
||||
for (i = 0; i < ArrayLength(descriptTable); ++i) {
|
||||
if (aName == *descriptTable[i].mName) {
|
||||
if (aName == descriptTable[i].mName) {
|
||||
aType = static_cast<eType>(i);
|
||||
|
||||
return true;
|
||||
@ -737,6 +737,6 @@ txCoreFunctionCall::getTypeFromAtom(nsAtom* aName, eType& aType)
|
||||
void
|
||||
txCoreFunctionCall::appendName(nsAString& aDest)
|
||||
{
|
||||
aDest.Append((*descriptTable[mType].mName)->GetUTF16String());
|
||||
aDest.Append(descriptTable[mType].mName->GetUTF16String());
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user