ICU-1779 set data object for entire tree of functors under a rule

X-SVN-Rev: 8132
This commit is contained in:
Alan Liu 2002-03-20 00:53:49 +00:00
parent c5d4c5ee6c
commit 1d263414fa
2 changed files with 7 additions and 5 deletions

View File

@ -34,8 +34,6 @@ TransliterationRuleData::TransliterationRuleData(const TransliterationRuleData&
variablesBase(other.variablesBase),
variablesLength(other.variablesLength)
{
ruleSet.setData(this); // ruleSet must already be frozen
UErrorCode status = U_ZERO_ERROR;
variableNames = new Hashtable(status);
if (U_SUCCESS(status)) {
@ -56,6 +54,9 @@ TransliterationRuleData::TransliterationRuleData(const TransliterationRuleData&
variables[i] = other.variables[i]->clone();
}
}
// Do this last, _after_ setting up variables[].
ruleSet.setData(this); // ruleSet must already be frozen
}
TransliterationRuleData::~TransliterationRuleData() {

View File

@ -488,9 +488,10 @@ UnicodeString& TransliterationRule::toRule(UnicodeString& rule,
void TransliterationRule::setData(const TransliterationRuleData* d) {
data = d;
anteContext->setData(d);
postContext->setData(d);
key->setData(d);
if (anteContext != NULL) anteContext->setData(d);
if (postContext != NULL) postContext->setData(d);
if (key != NULL) key->setData(d);
// assert(output != NULL);
output->setData(d);
// Don't have to do segments since they are in the context or key
}