Skip to content

Commit

Permalink
recursive constant list
Browse files Browse the repository at this point in the history
  • Loading branch information
amylizzle committed Jan 28, 2024
1 parent 70774e4 commit 27466c9
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 @@ -1329,10 +1329,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
} && ((DMASTList) value.Value).AllValuesConstant())
);
}
}

Expand Down

0 comments on commit 27466c9

Please sign in to comment.