From d8be440cb6015670718d94c48a8235aa55ec21c3 Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Wed, 8 Jan 2025 07:16:02 -0800 Subject: [PATCH] Fixed IsInitializerStatement with indexed Add initializer --- IDEHelper/Compiler/BfReducer.cpp | 1 - IDEHelper/Tests/src/Anonymous.bf | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/IDEHelper/Compiler/BfReducer.cpp b/IDEHelper/Compiler/BfReducer.cpp index a8f15284..98d6afcf 100644 --- a/IDEHelper/Compiler/BfReducer.cpp +++ b/IDEHelper/Compiler/BfReducer.cpp @@ -11021,7 +11021,6 @@ bool BfReducer::IsInitializerStatement(int checkIdx) case BfToken_Internal: case BfToken_Protected: case BfToken_This: - case BfToken_LBracket: case BfToken_Semicolon: case BfToken_Case: case BfToken_Const: diff --git a/IDEHelper/Tests/src/Anonymous.bf b/IDEHelper/Tests/src/Anonymous.bf index 0caeff07..5461f7d1 100644 --- a/IDEHelper/Tests/src/Anonymous.bf +++ b/IDEHelper/Tests/src/Anonymous.bf @@ -1,4 +1,5 @@ using System; +using System.Collections; namespace Tests; class Anonymous @@ -38,6 +39,8 @@ class Anonymous { mA = a; } + + public Self Clone() => this; } class ClassA @@ -77,6 +80,18 @@ class Anonymous Test.Assert(sc.mA == 456); Test.Assert(sc.mB == 11567); + List scList = scope .() { sc }; + List scList2 = scope List() + { + (int, float) GetTuple() => default; + int this[float f] => 99; + + scList[0].Clone(), + (scList[0].Clone()), + (.)(scList[0].Clone()) + }; + Test.Assert(scList2.Count == 3); + var ca = scope ClassA() { public override void ToString(String strBuffer)