Reduce deprecated script warning text

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is ON
[img] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Reduce deprecated script warning text

Re: Reduce deprecated script warning text

by Rachael » Wed Aug 28, 2019 7:49 am

If possible, I think the deprecation notices should suggest new functions for you to use. Of course, that requires contextually handling every deprecation, and that might be a bit messy... but it would still be really helpful.

Re: Reduce deprecated script warning text

by Nash » Wed Aug 28, 2019 5:46 am

Thanks _mental_! I'll try and add some message PRs as soon as I'm able (expect at least one more question thread about deprecated function replacements :P)

Re: Reduce deprecated script warning text

by Graf Zahl » Wed Aug 28, 2019 5:38 am

Merged. The last point about adding messages still stands, of course.

Re: Reduce deprecated script warning text

by _mental_ » Wed Aug 28, 2019 4:17 am

Doubling of depreciation warnings was fixed some time ago.

For optional depreciation messages, I made this PR. It doesn’t contain any messages, fill free to make PRs with then (if this change will be merged of course).

Re: Reduce deprecated script warning text

by Graf Zahl » Wed Aug 14, 2019 11:44 am

Code: Select all

decl_flags(X) ::= decl_flags(F) DEPRECATED(B) LPAREN STRCONST(A) COMMA STRCONST(C) RPAREN.	
{ 
	if (F == nullptr)
	{
		NEW_AST_NODE(DeclFlags,nil_f,B.SourceLoc);
		X = nil_f;
		X->Flags = ZCC_Deprecated;
		X->Id = nullptr;
		X->Version = { 0, 0 };
	}
	else
	{
		X = F;
		X->Flags |= ZCC_Deprecated;
	}
	X->Version = A.String->GetChars();
	// Do something with C here.
}
That's all you need in the parser.

Re: Reduce deprecated script warning text

by phantombeta » Wed Aug 14, 2019 11:40 am

Graf Zahl wrote:You'd have to make a change to the grammar but this won't have to filter down to the JIT, the message should be emitted in the resolving pass.
???
I never said it would affect the JIT, I was saying it would be a pain in the ass, because the lemon and the parser are ass.

Re: Reduce deprecated script warning text

by Graf Zahl » Wed Aug 14, 2019 11:35 am

You'd have to make a change to the grammar but this won't have to filter down to the JIT, the message should be emitted in the resolving pass.

Re: Reduce deprecated script warning text

by phantombeta » Wed Aug 14, 2019 11:24 am

Major Cooke wrote:I don't think that should be too hard, if the deprecated function is expanded to include an extra parameter.
It's not a function, it's an attribute. And ZScript's attributes are built into the ZScript parser. So, uh... Good luck. This is coming from someone who worked on the JIT and made several PRs for the ZScript compiler.

Re: Reduce deprecated script warning text

by Major Cooke » Wed Aug 14, 2019 6:09 am

I don't think that should be too hard, if the deprecated function is expanded to include an extra parameter.

Re: Reduce deprecated script warning text

by Nash » Tue Aug 13, 2019 5:59 pm

On a related note, would it be possible to suggest what to replace the deprecated function with, so that people can stop making forum posts asking "what should I use in place of CharAt"? :P

Reduce deprecated script warning text

by Major Cooke » Tue Aug 13, 2019 5:03 pm

I would like to suggest that warnings like this:

Code: Select all

Script warning, "AEoDdat.pk3:zaeod/eventhandler.txt" line 428:
Call to deprecated function CharAt
Script warning, "AEoDdat.pk3:zaeod/eventhandler.txt" line 428:
Accessing deprecated function CharAt - deprecated since 4.1.0
...be squished down to:

Code: Select all

Script warning, "AEoDdat.pk3:zaeod/eventhandler.txt" line 428:
Accessing deprecated function CharAt - deprecated since 4.1.0
When there's a lot to read, that's a lot of needless text being duplicated, especially the "script warning" lines being needlessly duplicated.

Top