Add error, if there's an unfinished block in a procedure
Framework for numerical computations, data analysis and visualisation
Brought to you by:
numere
Add an exception, if the current block is not closed until the procedure is left like in this case
procedure $some_procedure()
var some_var
if (some_var)
print #some_var
return false;
endprocedure
Analysis:
This can be done simply by adding the following lines in "procedure.cpp":
if (getLoop())
{
if (_option.getUseDebugger())
_option._debug.gatherInformations(_varfactory.sLocalVars,
_varfactory.nLocalVarMapSize, _varfactory.dLocalVars,
_varfactory.sLocalStrings, _varfactory.nLocalStrMapSize,
_data.getStringVars(), sProcCommandLine, sCurrentProcedureName,
nCurrentLine);
resetProcedure(_parser, bSupressAnswer_back);
throw SyntaxError(SyntaxError::IF_OR_LOOP_SEEMS_NOT_TO_BE_CLOSED,
"endprocedure", SyntaxError::invalid_position, "$" + sProc + "()");
}
and this to the catches in "kernel.cpp": _procedure.reset().
Implementation:
The change was implemented as proposed by the analysis. Implementation tests were passed successfully.
Documentation:
Not needed - Internal change.
Tests:
The change was tested and no deviations were detected. Change implemented successfully.
Anonymous
Diff:
Diff:
Diff:
Diff: