mysterious "Invalid statement" Zscript errors

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Post Reply
User avatar
JPL
 
 
Posts: 523
Joined: Mon Apr 09, 2012 12:27 pm
Contact:

mysterious "Invalid statement" Zscript errors

Post by JPL »

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 all

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
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: mysterious "Invalid statement" Zscript errors

Post by _mental_ »

It's caused by no-op expressions, like

Code: Select all

if (const_evaluated_to_false) // ...
I think this should be fixed like this.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: mysterious "Invalid statement" Zscript errors

Post by Graf Zahl »

Wouldn't it be better to give FxNop a non-error type instead?
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: mysterious "Invalid statement" Zscript errors

Post by _mental_ »

Probably, yes. Actually, I thought TypeError was used to catch errors like this.
Last edited by _mental_ on Wed Feb 06, 2019 2:52 am, edited 2 times in total.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: mysterious "Invalid statement" Zscript errors

Post by Graf Zahl »

Errors, yes, but this should at most be a warning.
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: mysterious "Invalid statement" Zscript errors

Post by _mental_ »

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?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: mysterious "Invalid statement" Zscript errors

Post by Graf Zahl »

_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.
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: mysterious "Invalid statement" Zscript errors

Post by _mental_ »

Fixed in 78c0b7f.
Post Reply

Return to “Closed Bugs [GZDoom]”