Advertisement

Property accessors in mixins

Started by February 20, 2021 04:47 PM
14 comments, last by noizex 3 years, 8 months ago

Okay, that's weird then - I checked it and indeed this code is in my ScriptBuilder so something must be off. That's the snippet I managed to get the issue reproduced. The error is because the meta is not remved from the source code after it's been parsed for meta:

troll.as (14): Expected method or property
troll.as (14): Instead found '['
troll.as (16): Unexpected token '}'

Here is the code:

shared class Foo
{		
	[replication]
	int bar;				
}

It's pretty minimal as you can see, I thought maybe it was extrernal keywords I used but I kept removing and I still get the above error with just these few lines.

I realized I was on 2.34.0 too (but I copied addons from 2.35.0 couple of weeks ago so it shouldn't matter), so I upgraded to 2.35.0 just to be sure and it's still there. I can't easily use WIP since there is no zip file that I can download and I'm using Conan packaging for all my dependencies. But I will check this file with asrun on WIP version separately from my project just to see if this also fails there.

Maybe it's something messed on my side - some engine option or something? I know that putting that additional code from my .patch did solve this so maybe it's some edge case. Will post once I manage to verify on WIP, meanwhile that's as far as I got.


Where are we and when are we and who are we?
How many people in how many places at how many times?

I think I know what's causing this.

I don't have a test case for this yet, i.e. metadata on properties within a class that has been declared with decorators. I was assuming you were talking about metadata on the class declaration itself.

I'll look into this further later (it might be the solution you suggested is exactly what is needed to cover this case).

noizex said:
I can't easily use WIP since there is no zip file that I can download and I'm using Conan packaging for all my dependencies

The git hub mirror offer an option to download all source code as a zip. Just follow the links from the wip page ?

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Advertisement

WitchLord said:

I think I know what's causing this.

I don't have a test case for this yet, i.e. metadata on properties within a class that has been declared with decorators. I was assuming you were talking about metadata on the class declaration itself.

Hmm, not really to be honest - the other way around. This doesn't work:

shared class Foo
{		
	[replication]
	int bar;				
}

and gives me compile time error.

This on the other hand works fine:

[replication]
shared class Foo
{		
	int bar;				
}

So the meta for class itself works fine, but meta for property inside the class fails to be recognized, and that class doesn't need to have metadata on itself for it to break.


Where are we and when are we and who are we?
How many people in how many places at how many times?

I've fixed this now in rev 2707,

Regards,
Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Great, thanks!


Where are we and when are we and who are we?
How many people in how many places at how many times?

This topic is closed to new replies.

Advertisement