[Fixed] mysterious "Invalid statement" Zscript errors

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

mysterious "Invalid statement" Zscript errors

Postby JPL » Wed Feb 06, 2019 3:02 am

A mod I released last year has started failing on startup in recent-ish versions of GZDoom. 4 errors that all say "Invalid statement", two of them on the same line. A couple of the lines in question are simple function overrides, eg
Code: Select allExpand view
override void PostBeginPlay()
, and no further information is given so it's pretty unclear what the real problem is or how to fix it.

You can download the latest released version of the mod here: https://jp.itch.io/mr-friendly
User avatar
JPL
 
 
 
Joined: 09 Apr 2012

Re: mysterious "Invalid statement" Zscript errors

Postby _mental_ » Wed Feb 06, 2019 3:40 am

It's caused by no-op expressions, like
Code: Select allExpand view
if (const_evaluated_to_false) // ...

I think this should be fixed like this.
_mental_
 
 
 
Joined: 07 Aug 2011

Re: mysterious "Invalid statement" Zscript errors

Postby Graf Zahl » Wed Feb 06, 2019 3:45 am

Wouldn't it be better to give FxNop a non-error type instead?
User avatar
Graf Zahl
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: mysterious "Invalid statement" Zscript errors

Postby _mental_ » Wed Feb 06, 2019 3:47 am

Probably, yes. Actually, I thought TypeError was used to catch errors like this.
Last edited by _mental_ on Wed Feb 06, 2019 3:52 am, edited 2 times in total.
_mental_
 
 
 
Joined: 07 Aug 2011

Re: mysterious "Invalid statement" Zscript errors

Postby Graf Zahl » Wed Feb 06, 2019 3:51 am

Errors, yes, but this should at most be a warning.
User avatar
Graf Zahl
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: mysterious "Invalid statement" Zscript errors

Postby _mental_ » Wed Feb 06, 2019 3:53 am

It's a code generation error because construct with a constant condition is valid.

TypeVoid for FxNop fixes the issue as well. Should we prefer this solution over my PR?
_mental_
 
 
 
Joined: 07 Aug 2011

Re: mysterious "Invalid statement" Zscript errors

Postby Graf Zahl » Wed Feb 06, 2019 4:45 am

_mental_ wrote:It's a code generation error because construct with a constant condition is valid.


Yes, but that means that FxNop may not have an error type. FxNop is meant as a valid stand-in for an empty statement where null is not viable.
User avatar
Graf Zahl
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: mysterious "Invalid statement" Zscript errors

Postby _mental_ » Wed Feb 06, 2019 5:10 am

Fixed in 78c0b7f.
_mental_
 
 
 
Joined: 07 Aug 2011


Return to Closed Bugs

Who is online

Users browsing this forum: No registered users and 2 guests