From 27466c9e0da3cc72d2d6af53249448387a1c3017 Mon Sep 17 00:00:00 2001 From: amylizzle Date: Sun, 28 Jan 2024 13:51:08 +0000 Subject: [PATCH 1/2] recursive constant list --- DMCompiler/Compiler/DM/DMAST.cs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/DMCompiler/Compiler/DM/DMAST.cs b/DMCompiler/Compiler/DM/DMAST.cs index 59f0f5c246..f6b493f551 100644 --- a/DMCompiler/Compiler/DM/DMAST.cs +++ b/DMCompiler/Compiler/DM/DMAST.cs @@ -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()) + ); } } From 18b57b17eb3023d44337115a69f0f41ee175235d Mon Sep 17 00:00:00 2001 From: wixoa Date: Mon, 29 Jan 2024 21:06:35 -0500 Subject: [PATCH 2/2] Update DMCompiler/Compiler/DM/DMAST.cs --- DMCompiler/Compiler/DM/DMAST.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DMCompiler/Compiler/DM/DMAST.cs b/DMCompiler/Compiler/DM/DMAST.cs index f6b493f551..c30e04ead1 100644 --- a/DMCompiler/Compiler/DM/DMAST.cs +++ b/DMCompiler/Compiler/DM/DMAST.cs @@ -1337,8 +1337,8 @@ public bool AllValuesConstant() { || (value is { Key: DMASTExpressionConstant, - Value: DMASTList - } && ((DMASTList) value.Value).AllValuesConstant()) + Value: DMASTList valueList + } && valueList.AllValuesConstant()) ); } }