mIRC Home    About    Download    Register    News    Help

Print Thread
duplicate goto is not reported on single line #270141 09/04/22 08:11 PM
Joined: Jul 2006
Posts: 3,889
W
Wims Offline OP
Hoopy frood
OP Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,889
Code
//var %a 0 | :sup | inc %a | if (%a == 2) return | noop | :sup | goto sup
does not report an error but it should
Code
 alias sup {
  var %a 0
  :sup
  inc %a
  if (%a == 2) return
  noop
  :sup 
  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?

Last edited by Wims; 09/04/22 08:35 PM.

#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Re: duplicate goto is not reported on single line [Re: Wims] #270145 10/04/22 09:06 AM
Joined: Dec 2002
Posts: 5,132
Khaled Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,132
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.