mIRC Homepage

duplicate goto is not reported on single line

Posted By: Wims

duplicate goto is not reported on single line - 09/04/22 08:11 PM

//var %a 0 | :sup | inc %a | if (%a == 2) return | noop | :sup | goto sup
does not report an error but it should
 alias sup {
  var %a 0
  inc %a
  if (%a == 2) return
  goto sup
This reports * /goto: duplicate 'sup' found (line 2, script.mrc) correctly

This issue gets weirder when it comes to :error goto label.

When you recover from an error with :error + /reseterror, if you get another error in the same routine, it won't jump again to :error.

I was writing a code and I needed to recover from two errors consecutively, (the error are controlled, on purpose), and without thinking twice after seeing it wasn't jumping a second time, I decided to add another :error + reseterror combo, and it worked.

That code is for a bug report I wanted to post, so I wanted to make the code prettier by making it multiline, imagine my surprise when mIRC reported an error about duplicate :error label.

I must say this is probably uncharted territory, I'm not sure which behavior was intended, it's possible that mIRC does not jump again to a single :error label to prevent infinite loop with error happening inbetween, but I believe we should be able to recover from as many errors we want.

If the concern is infinite looping, perhaps /reseterror could get a switch, indicating that a new error should jump to :error again?
Posted By: Khaled

Re: duplicate goto is not reported on single line - 10/04/22 09:06 AM

Thanks for your bug report. I implemented a fix for this but it required a cascade of changes to many parts of the script parser, not just for goto and error handling, and the odds are high that this will cause it to break backward compatibility with existing scripts in several ways. Because of this, I have reverted the fix for now to see if I can find an alternative solution and have added this to my to-do list.
© 2022 mIRC Discussion Forums