riej / lsl

Linden Script (LSL) language plugin for IntelliJ IDEA
MIT License
7 stars 2 forks source link

No jump to label awareness #20

Closed spflanze closed 11 months ago

spflanze commented 11 months ago

In the below code snippet this pluggin considers everything after the return; statement unreachable, and grays it out.

while( ++giCurrentNotecardName < gnCurrentNotecardName )
{
  gsCurrentNotecardName = llGetInventoryName(INVENTORY_NOTECARD, giCurrentNotecardName);
  // Test for the suffix that indicates this is an information notecard.
  if( ( llGetSubString( gsCurrentNotecardName, 1 - llStringLength( gsInfoNCSuf ), -1) == gsInfoNCSuf ))
  {
    jump nextInfoNC;
  }
}

// There are no more information notecards, so processing ends here
llOwnerSay( "### Information notecards processing completed. " + (string)gnInfoNCsProceossed + " processed. ###" );
return; // The IDE Asumes everything after this statement is unreachable, and grays it out, in spite of the jump statement in the while loop.

@nextInfoNC;
// Process this information notecard
spflanze commented 11 months ago

I found a work around to prevent the gray out. This is to make the return statement conditional: if( 1 ) return; After debug, and test, the "If(1)" part, which should not have been necessary, can be removed.

riej commented 11 months ago

fixed