Skip to content

Commit

Permalink
Handle var/list/foo[]= value in proc statements (#1984)
Browse files Browse the repository at this point in the history
Co-authored-by: ike709 <[email protected]>
  • Loading branch information
ike709 and ike709 authored Oct 5, 2024
1 parent bc123b6 commit 5424d99
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/proc/RunTest()
var/list/foo[]=new()
ASSERT(islist(foo))
14 changes: 11 additions & 3 deletions DMCompiler/Compiler/DM/DMParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,12 @@ public DMASTFile File() {
if (Check(TokenType.DM_Equals)) {
if (value != null) Warning("List doubly initialized");

Whitespace();
value = Expression();
RequireExpression(ref value);
} else if (Check(TokenType.DM_DoubleSquareBracketEquals)) {
if (value != null) Warning("List doubly initialized");

Whitespace();
value = Expression();
RequireExpression(ref value);
Expand Down Expand Up @@ -872,6 +878,10 @@ public DMASTFile File() {
Whitespace();
value = Expression();
RequireExpression(ref value);
} else if (Check(TokenType.DM_DoubleSquareBracketEquals)) {
Whitespace();
value = Expression();
RequireExpression(ref value);
}

var valType = AsComplexTypes() ?? DMValueType.Anything;
Expand Down Expand Up @@ -1722,9 +1732,7 @@ private List<DMASTDefinitionParameter> DefinitionParameters(out bool wasIndeterm
if (Check(TokenType.DM_DoubleSquareBracketEquals)) {
Whitespace();
value = Expression();
}

if (Check(TokenType.DM_Equals)) {
} else if (Check(TokenType.DM_Equals)) {
Whitespace();
value = Expression();
}
Expand Down

0 comments on commit 5424d99

Please sign in to comment.