Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Content.Tests/DMProject/Tests/Statements/Switch/else_colon.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// RETURN TRUE

/proc/RunTest()
var/foo = 5
switch(foo)
if(2)
return FALSE
else:
return TRUE
return FALSE
2 changes: 2 additions & 0 deletions DMCompiler/Compiler/DM/DMParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@
}

if (path.IsOperator) {
List<DMASTProcStatement> procStatements = procBlock.Statements.ToList();

Check warning on line 269 in DMCompiler/Compiler/DM/DMParser.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Dereference of a possibly null reference.
Location tokenLoc = procBlock.Location;
//add ". = src" as the first expression in the operator
DMASTProcStatementExpression assignEqSrc = new DMASTProcStatementExpression(tokenLoc,
Expand Down Expand Up @@ -1547,6 +1547,8 @@

return new DMASTProcStatementSwitch.SwitchCaseValues(expressions.ToArray(), body);
} else if (Check(TokenType.DM_Else)) {
Whitespace();
Check(TokenType.DM_Colon); // Someone wrote "else:" instead of "else"
Comment thread
wixoaGit marked this conversation as resolved.
Whitespace();
var loc = Current().Location;
if (Current().Type == TokenType.DM_If) {
Expand Down
Loading