Răsfoiți Sursa

Fixed IsInitializerStatement with indexed Add initializer

Brian Fiete 8 luni în urmă
părinte
comite
d8be440cb6
2 a modificat fișierele cu 15 adăugiri și 1 ștergeri
  1. 0 1
      IDEHelper/Compiler/BfReducer.cpp
  2. 15 0
      IDEHelper/Tests/src/Anonymous.bf

+ 0 - 1
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:

+ 15 - 0
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<StructC> scList = scope .() { sc };
+		List<StructC> scList2 = scope List<StructC>()
+			{
+				(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)