mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-04-01 18:04:29 +05:00
0022238: Study dump produced by SMESH refers to undefined variable names
Fix CheckObjectPresence() again + ASSERT( thePartIndex > 0 );
This commit is contained in:
parent
122c3311ae
commit
8329a633a4
@ -195,8 +195,16 @@ namespace {
|
|||||||
cmd->Clear();
|
cmd->Clear();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// comment a command having not created args
|
// check if an Object was created in the script
|
||||||
for ( int iArg = cmd->GetNbArgs(); iArg; --iArg )
|
_AString comment;
|
||||||
|
const _pyID& obj = cmd->GetObject();
|
||||||
|
if ( !obj.IsEmpty() && cmd->IsStudyEntry( obj ) && !presentObjects.count( obj ))
|
||||||
|
{
|
||||||
|
comment = "not created Object";
|
||||||
|
theGen->ObjectCreationRemoved( obj );
|
||||||
|
}
|
||||||
|
// check if a command has not created args
|
||||||
|
for ( int iArg = cmd->GetNbArgs(); iArg && comment.IsEmpty(); --iArg )
|
||||||
{
|
{
|
||||||
const _pyID& arg = cmd->GetArg( iArg );
|
const _pyID& arg = cmd->GetArg( iArg );
|
||||||
if ( arg.IsEmpty() || arg.Value( 1 ) == '"' || arg.Value( 1 ) == '\'' )
|
if ( arg.IsEmpty() || arg.Value( 1 ) == '"' || arg.Value( 1 ) == '\'' )
|
||||||
@ -206,35 +214,29 @@ namespace {
|
|||||||
for ( ; id != idList.end(); ++id )
|
for ( ; id != idList.end(); ++id )
|
||||||
if ( !theGen->IsGeomObject( *id ) && !presentObjects.count( *id ))
|
if ( !theGen->IsGeomObject( *id ) && !presentObjects.count( *id ))
|
||||||
{
|
{
|
||||||
cmd->Comment();
|
comment += *id + " has not been yet created";
|
||||||
cmd->GetString() += " ### " ;
|
break;
|
||||||
cmd->GetString() += *id + " has not been yet created";
|
|
||||||
for ( int i = 0; i < cmd->GetNbResultValues(); i++ ) {
|
|
||||||
_pyID objID = cmd->GetResultValue( i+1 );
|
|
||||||
theGen->ObjectCreationRemoved( objID ); // objID.SetName( name ) is not needed
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// comment a command with an Object that was not created in the script
|
// treat result objects
|
||||||
const _pyID& obj = cmd->GetObject();
|
const _pyID& result = cmd->GetResultValue();
|
||||||
if ( !obj.IsEmpty() && cmd->IsStudyEntry( obj ) && !presentObjects.count( obj ))
|
if ( !result.IsEmpty() && result.Value( 1 ) != '"' && result.Value( 1 ) != '\'' )
|
||||||
|
{
|
||||||
|
list< _pyID > idList = cmd->GetStudyEntries( result );
|
||||||
|
list< _pyID >::iterator id = idList.begin();
|
||||||
|
for ( ; id != idList.end(); ++id )
|
||||||
|
if ( comment.IsEmpty() )
|
||||||
|
presentObjects.insert( *id );
|
||||||
|
else
|
||||||
|
theGen->ObjectCreationRemoved( *id ); // objID.SetName( name ) is not needed
|
||||||
|
}
|
||||||
|
// comment the command
|
||||||
|
if ( !comment.IsEmpty() )
|
||||||
{
|
{
|
||||||
cmd->Comment();
|
cmd->Comment();
|
||||||
cmd->GetString() += " ### not created Object" ;
|
cmd->GetString() += " ### ";
|
||||||
for ( int i = 0; i < cmd->GetNbResultValues(); i++ ) {
|
cmd->GetString() += comment;
|
||||||
_pyID objID = cmd->GetResultValue( i+1 );
|
|
||||||
theGen->ObjectCreationRemoved( objID ); // objID.SetName( name ) is not needed
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
const _pyID& result = cmd->GetResultValue();
|
|
||||||
if ( result.IsEmpty() || result.Value( 1 ) == '"' || result.Value( 1 ) == '\'' )
|
|
||||||
return;
|
|
||||||
list< _pyID > idList = cmd->GetStudyEntries( result );
|
|
||||||
list< _pyID >::iterator id = idList.begin();
|
|
||||||
for ( ; id != idList.end(); ++id )
|
|
||||||
presentObjects.insert( *id );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
@ -3166,6 +3168,7 @@ int _pyCommand::GetBegPos( int thePartIndex )
|
|||||||
return EMPTY;
|
return EMPTY;
|
||||||
if ( myBegPos.Length() < thePartIndex )
|
if ( myBegPos.Length() < thePartIndex )
|
||||||
return UNKNOWN;
|
return UNKNOWN;
|
||||||
|
ASSERT( thePartIndex > 0 );
|
||||||
return myBegPos( thePartIndex );
|
return myBegPos( thePartIndex );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3181,6 +3184,7 @@ void _pyCommand::SetBegPos( int thePartIndex, int thePosition )
|
|||||||
{
|
{
|
||||||
while ( myBegPos.Length() < thePartIndex )
|
while ( myBegPos.Length() < thePartIndex )
|
||||||
myBegPos.Append( UNKNOWN );
|
myBegPos.Append( UNKNOWN );
|
||||||
|
ASSERT( thePartIndex > 0 );
|
||||||
myBegPos( thePartIndex ) = thePosition;
|
myBegPos( thePartIndex ) = thePosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3708,7 +3712,7 @@ void _pyCommand::Comment()
|
|||||||
if ( i <= Length() )
|
if ( i <= Length() )
|
||||||
{
|
{
|
||||||
myString.Insert( i, "#" );
|
myString.Insert( i, "#" );
|
||||||
for ( int iPart = 0; iPart < myBegPos.Length(); ++iPart )
|
for ( int iPart = 1; iPart <= myBegPos.Length(); ++iPart )
|
||||||
{
|
{
|
||||||
int begPos = GetBegPos( iPart );
|
int begPos = GetBegPos( iPart );
|
||||||
if ( begPos != UNKNOWN )
|
if ( begPos != UNKNOWN )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user