mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: no dictionary variable and function expansion when discarding entry
- the 'protect' inputMode is used to supply defaults. If an entry already exists, it should act as a no-op without any side-effects whatsoever.
This commit is contained in:
@ -191,7 +191,7 @@ int main(int argc, char *argv[])
|
||||
<< endl;
|
||||
}
|
||||
|
||||
int oldFlag = entry::disableFunctionEntries;
|
||||
const int oldFlag = entry::disableFunctionEntries;
|
||||
if (!enableEntries)
|
||||
{
|
||||
// By default disable dictionary expansion for fields
|
||||
|
||||
@ -464,7 +464,7 @@ int main(int argc, char *argv[])
|
||||
<< endl;
|
||||
}
|
||||
|
||||
int oldFlag = entry::disableFunctionEntries;
|
||||
const int oldFlag = entry::disableFunctionEntries;
|
||||
if (!enableEntries)
|
||||
{
|
||||
// By default disable dictionary expansion for fields
|
||||
|
||||
@ -500,7 +500,7 @@ int main(int argc, char *argv[])
|
||||
IOobjectList objects(runTime, runTime.timeName());
|
||||
|
||||
|
||||
int oldFlag = entry::disableFunctionEntries;
|
||||
const int oldFlag = entry::disableFunctionEntries;
|
||||
if (!enableEntries)
|
||||
{
|
||||
// By default disable dictionary expansion for fields
|
||||
|
||||
@ -283,15 +283,21 @@ bool Foam::entry::New(dictionary& parentDict, Istream& is)
|
||||
}
|
||||
else if (functionEntries::inputModeEntry::protect())
|
||||
{
|
||||
// read and discard the entry
|
||||
// Read and discard the entry.
|
||||
// Disable function/variable expansion to avoid side-effects
|
||||
const int oldFlag = entry::disableFunctionEntries;
|
||||
entry::disableFunctionEntries = 1;
|
||||
|
||||
if (nextToken == token::BEGIN_BLOCK)
|
||||
{
|
||||
dictionaryEntry dummy(keyword, parentDict, is);
|
||||
dictionaryEntry dummy("dummy", parentDict, is);
|
||||
}
|
||||
else
|
||||
{
|
||||
primitiveEntry dummy(keyword, parentDict, is);
|
||||
primitiveEntry dummy("dummy", parentDict, is);
|
||||
}
|
||||
|
||||
entry::disableFunctionEntries = oldFlag;
|
||||
return true;
|
||||
}
|
||||
else if (functionEntries::inputModeEntry::error())
|
||||
|
||||
Reference in New Issue
Block a user