1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-09 12:02:21 +02:00

Fixed IsInitializerStatement with indexed Add initializer

This commit is contained in:
Brian Fiete 2025-01-08 07:16:02 -08:00
parent 6514416908
commit d8be440cb6
2 changed files with 15 additions and 1 deletions

View file

@ -11021,7 +11021,6 @@ bool BfReducer::IsInitializerStatement(int checkIdx)
case BfToken_Internal: case BfToken_Internal:
case BfToken_Protected: case BfToken_Protected:
case BfToken_This: case BfToken_This:
case BfToken_LBracket:
case BfToken_Semicolon: case BfToken_Semicolon:
case BfToken_Case: case BfToken_Case:
case BfToken_Const: case BfToken_Const:

View file

@ -1,4 +1,5 @@
using System; using System;
using System.Collections;
namespace Tests; namespace Tests;
class Anonymous class Anonymous
@ -38,6 +39,8 @@ class Anonymous
{ {
mA = a; mA = a;
} }
public Self Clone() => this;
} }
class ClassA class ClassA
@ -77,6 +80,18 @@ class Anonymous
Test.Assert(sc.mA == 456); Test.Assert(sc.mA == 456);
Test.Assert(sc.mB == 11567); 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() var ca = scope ClassA()
{ {
public override void ToString(String strBuffer) public override void ToString(String strBuffer)