From e0b1357f4d6d4cf64bef9781ac4485a7cd319ed9 Mon Sep 17 00:00:00 2001 From: izrik Date: Fri, 12 Nov 2021 12:13:32 -0600 Subject: [PATCH] Use the ready-made field, instead of a custom class. --- Expressions/ColorExpression.cs | 14 +------------- .../ExpressionsT/ColorExpressionT/ResultTest.cs | 5 ++++- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/Expressions/ColorExpression.cs b/Expressions/ColorExpression.cs index c42a79f8..6cf7dce9 100644 --- a/Expressions/ColorExpression.cs +++ b/Expressions/ColorExpression.cs @@ -105,18 +105,6 @@ public override void AcceptVisitor(IExpressionVisitor visitor) throw new NotImplementedException(); } - public override IMathObject Result { get; } = new ResultC(); - private class ResultC : IMathObject - { - public bool? IsScalar(SolusEnvironment env) => true; - public bool? IsVector(SolusEnvironment env) => false; - public bool? IsMatrix(SolusEnvironment env) => false; - public int? GetTensorRank(SolusEnvironment env) => 0; - public bool? IsString(SolusEnvironment env) => false; - public int? GetDimension(SolusEnvironment env, int index) => null; - public int[] GetDimensions(SolusEnvironment env) => null; - public int? GetVectorLength(SolusEnvironment env) => null; - public bool IsConcrete => false; - } + public override IMathObject Result => ScalarMathObject.Value; } } diff --git a/MetaphysicsIndustries.Solus.Test/ExpressionsT/ColorExpressionT/ResultTest.cs b/MetaphysicsIndustries.Solus.Test/ExpressionsT/ColorExpressionT/ResultTest.cs index 2178a5e5..4962c040 100644 --- a/MetaphysicsIndustries.Solus.Test/ExpressionsT/ColorExpressionT/ResultTest.cs +++ b/MetaphysicsIndustries.Solus.Test/ExpressionsT/ColorExpressionT/ResultTest.cs @@ -43,6 +43,9 @@ public void ResultIsScalar() Assert.IsFalse(result.IsMatrix(env)); Assert.AreEqual(0, result.GetTensorRank(env)); Assert.IsFalse(result.IsString(env)); + Assert.IsNull(result.GetDimension(env, 0)); + Assert.IsNull(result.GetDimensions(env)); + Assert.IsNull(result.GetVectorLength(env)); } } -} \ No newline at end of file +}