Question regarding variableidentifier shadowing

Post » Fri Aug 14, 2015 5:59 pm

For the longest time, I thought Papyrus didn't allow any form of shadowing. I decided to test that and came across some curious results.

Examples 1-3:
Spoiler

Scriptname tmpFunction f()    int a    If true        int a    EndIfEndFunction

Spoiler

Scriptname tmpint aFunction f()    int aEndFunction

Spoiler

Scriptname tmpint Property a autoFunction f()    int aEndFunction


In these examples, the compiler works as I thought it would and complains about shadowing.

Examples 4-7
Spoiler

Scriptname tmpint aint property a

Spoiler

Scriptname tmpint aFunction aEndFunction

Spoiler

Scriptname tmpint Property aFunction aEndFunction

Spoiler

Scriptname tmpint aint Property aFunction aEndFunction


In these examples, the compiler says nothing. Is this a compiler bug or is this intended behaviour? If it's intended, it seems like it could cause a fair bit of ambiguity.

I've looked through creationkit.com and didn't find a definitive answer (all I found was a paragraph on variables defined inside functions), so here I am. Any help or info is appreciated!
User avatar
Ryan Lutz
 
Posts: 3465
Joined: Sun Sep 09, 2007 12:39 pm

Return to V - Skyrim