SpaceManiac / SpacemanDMM

A BYOND language smartness provider, map renderer, and more.
https://marketplace.visualstudio.com/items?itemName=platymuus.dm-langclient
GNU General Public License v3.0
83 stars 83 forks source link

Semicolons are being enforced in modified type expressions #403

Open Zandario opened 4 months ago

Zandario commented 4 months ago

image

https://www.byond.com/docs/ref/#/proc/newlist

The semicolon is necessary if you put several variable assignments on the same line. The braces are necessary, even though they are generally optional in DM (since the compiler looks at your indentation). The reason is that the path + initializations must be parsed as a single expression, which is a different context from the usual use of braces in DM when you are defining a true type. Also, indentation inside of an argument list is always ignored anyway.

Don't really know how to explain it other than ;'s aren't necessary within {}'s, unless it's multiple expressions on the same line.

Reproduction Code

/proc/test()
    return newlist(
        /obj{
            name = "bob"
            color = "red"
        },
        /obj{
            name = "joe"
            color = "blue"
        },
    )