ID:2134818
 
BYOND Version:510
Operating System:Windows 10 Pro 64-bit
Web Browser:Firefox 47.0
Applies to:Dream Maker
Status: Open

Issue hasn't been assigned a status value.
Descriptive Problem Summary:
Subtypes of images get all variable definitions on them dumped into the root object, so it is impossible to distinguish between these and actual global variables.

When preceding a variable definition with a /, it does not show up in the outputted XML.

Numbered Steps to Reproduce Problem:
Compile the below code snipper with the CLI compiler's -o flag.

Code Snippet (if applicable) to Reproduce Problem:
/image/honk
icon_state = "hrm"

/var/nothingshere = "woosh"

/datum
/var/test1
var/test2

Expected Results:
<?xml version="1.0" encoding="Windows-1252" ?>
<dm>
<object file="test.dm:1">image
<object file="test.dm:1">honk
<var file="test.dm:2">icon_state
<val file="test.dm:2">"hrm"</val>
</var>
</object>
</object>
<var file="test.dm:4">nothingshere
<val file="test.dm:4">"woosh"</val>
</var>
<object file="test.dm:6">datum
<var file="test.dm:7">test1</var>
<var file="test.dm:8">test2</var>
</object>
</d m> // This line is NOT a bug, modified manually to make the website not parse it.


Actual Results:
<?xml version="1.0" encoding="Windows-1252" ?>
<dm>
<var file="test.dm:2">icon_state
<val file="test.dm:2">"hrm"</val>
</var>
<object file="test.dm:6">datum
<var file="test.dm:8">test2</var>
</object>
</d m> // This line is NOT a bug, modified manually to make the website not parse it.


Does the problem occur:
Every time? Or how often? Every Time
In other games? N/A
In other user accounts? Untested
On other computers? Untested

When does the problem NOT occur?
For problem 1: When you don't use a subtype of /image

For problem 2: When you don't put a / in front of variable definitions.

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)

Workarounds:
First issue: No idea.

Second: Don't put a / before var defs.
/datum
/var/test1
var/test2

This is equivalent to the following:
/datum/var/test2
/var/test1


A slash at the beginning makes the declaration start from the root again.

The issue stands, however:
var/test_noslash 
/var/test_slash
datum
var/test_datum

becomes
<dm>

<var file="slashvar.dme:2">test_noslash</var>
<object file="slashvar.dme:4">datum
<var file="slashvar.dme:5">test_datum</var>
</object>
</d m> // as above in PJB's outputs, edited to prevent forum parsing
Hrm, I seemed to recall that doing /var is valid in object-level definitions but it turns out I was wrong.
It's valid, it just creates a global variable;
/datum
var/noslash
/var/slash

/world/New()
var/datum/D = new

world.log << D.noslash
world.log << D.slash // error: D.slash: undefined var

world.log << noslash // error: noslash: undefined var
world.log << slash
Well that's what I meant, though yeah I used poor wording.