Terry Dennis wrote:

> Much fiddling later, I discovered the issue.  It was a runtime
> “oops”.
> Check out the following code snippet, which shows the execution
> error.  I threw it into button “Capture”s script:
>
> on testOOPS
>    put 1 into t1  -- Superfluous for testing purposes
>    put 2 into t2  -- Superfluous for testing purposes
>    if true = true then  -- Runtime error here !!!
>       exit repeat
>    end if
>   put 3 into t3  -- Superfluous for testing purposes
> end testOOPS
>
> <<<<
> button "Capture": execution error at line 27 (Handler: error in statement),
> char 1
>>>>>
>
> I certainly didn’t expect an execution error on an “if true then”
> statement.
>
> The problem is the code I copied included an “exit repeat”, but the
> function I copied it into didn’t have a “repeat ... end repeat”.
> Thus, there was an “unmatched” exit from a repeat that didn’t
> exist.
...
> It seems to me this is a bug that should have been caught during the
> script compilation phase, instead of during execution.

Agreed. If you substitute "exit repeat" with any other equally irrelevant expression like "exit foo" or "exit if" etc. the compiler flags it immediately, and ideally it should do the same here too.

It may also be worth noting in the report that the error is flagged on the wrong line. Hopefully once they fix the compiler to catch this it'll identify the actual erroneous line as a compilation error and we won't ever see an incorrect line flagged for an execution error.

But since it is flagging the wrong line, drawing attention to that may provide an opportunity to review that part of the code to make sure incorrect lines aren't being flagged in other contexts.

If you file a report please note the number here so I can add myself to the report's CC list. Thanks.

--
 Richard Gaskin
 Fourth World Systems
 Software Design and Development for the Desktop, Mobile, and the Web
 ____________________________________________________________________
 [email protected]                http://www.FourthWorld.com

_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to