Skip to content

Commit

Permalink
Recursive constant list (OpenDreamProject#1641)
Browse files Browse the repository at this point in the history
Co-authored-by: wixoa <[email protected]>
  • Loading branch information
amylizzle and wixoaGit authored Jan 30, 2024
1 parent 0c18115 commit 143a44c
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions DMCompiler/Compiler/DM/DMAST.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1324,10 +1324,17 @@ public override void Visit(DMASTVisitor visitor) {
}

public bool AllValuesConstant() {
return Values.All(value => value is {
Key: DMASTExpressionConstant,
Value: DMASTExpressionConstant
});
return Values.All(
value => (value is {
Key: DMASTExpressionConstant,
Value: DMASTExpressionConstant
})
||
(value is {
Key: DMASTExpressionConstant,
Value: DMASTList valueList
} && valueList.AllValuesConstant())
);
}
}

Expand Down

0 comments on commit 143a44c

Please sign in to comment.