Skip to content

Commit b1489d0

Browse files
authored
Fix nested object var blocks (#2463)
1 parent 920b982 commit b1489d0

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

DMCompiler/Compiler/DM/DMParser.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,12 @@ public DMASTFile File() {
214214
Whitespace();
215215
CurrentPath = CurrentPath.Combine(path.Path);
216216

217+
//Object definition
218+
if (Block() is { } block) {
219+
Compiler.VerbosePrint($"Parsed object {CurrentPath}");
220+
return new DMASTObjectDefinition(loc, CurrentPath, block);
221+
}
222+
217223
//Proc definition
218224
if (Check(TokenType.DM_LeftParenthesis)) {
219225
Compiler.VerbosePrint($"Parsing proc {CurrentPath}()");
@@ -365,12 +371,6 @@ public DMASTFile File() {
365371
return new DMASTObjectVarOverride(loc, CurrentPath, value);
366372
}
367373

368-
//Object definition
369-
if (Block() is { } block) {
370-
Compiler.VerbosePrint($"Parsed object {CurrentPath}");
371-
return new DMASTObjectDefinition(loc, CurrentPath, block);
372-
}
373-
374374
//Empty object definition
375375
Compiler.VerbosePrint($"Parsed object {CurrentPath} - empty");
376376
return new DMASTObjectDefinition(loc, CurrentPath, null);

TestGame/code.dm

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,4 @@
411411

412412
/world/New()
413413
..()
414-
world.log << "World loaded!"
415-
var/particles/A = new()
416-
A.width = null
414+
world.log << "World loaded!"

0 commit comments

Comments
 (0)