1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-15 06:44:10 +02:00

Warn on deprecated brace initializer syntax

This commit is contained in:
Brian Fiete 2020-08-29 07:26:22 -07:00
parent ffee0a2aa3
commit 4369e07a55
12 changed files with 36 additions and 34 deletions

View file

@ -83,7 +83,7 @@ namespace System
protected virtual void* AllocLarge(int size, int align) protected virtual void* AllocLarge(int size, int align)
{ {
return new uint8[size]* {?}; return new uint8[size]* (?);
} }
protected virtual void FreeLarge(void* ptr) protected virtual void FreeLarge(void* ptr)
@ -95,7 +95,7 @@ namespace System
{ {
int poolSize = (mPools != null) ? mPools.Count : 0; int poolSize = (mPools != null) ? mPools.Count : 0;
int allocSize = Math.Clamp((int)Math.Pow(poolSize, 1.5) * 4*1024, 4*1024, 64*1024); int allocSize = Math.Clamp((int)Math.Pow(poolSize, 1.5) * 4*1024, 4*1024, 64*1024);
return Span<uint8>(new uint8[allocSize]* {?}, allocSize); return Span<uint8>(new uint8[allocSize]* (?), allocSize);
} }
protected virtual void FreePool(Span<uint8> span) protected virtual void FreePool(Span<uint8> span)

View file

@ -59,10 +59,10 @@ namespace System
private const int32 DatePartMonth = 2; private const int32 DatePartMonth = 2;
private const int32 DatePartDay = 3; private const int32 DatePartDay = 3;
private static readonly int32[] DaysToMonth365 = new int32[]{ private static readonly int32[] DaysToMonth365 = new int32[](
0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365} ~ delete _; 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365) ~ delete _;
private static readonly int32[] DaysToMonth366 = new int32[]{ private static readonly int32[] DaysToMonth366 = new int32[](
0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366} ~ delete _; 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366) ~ delete _;
public static readonly DateTime MinValue = DateTime(MinTicks, DateTimeKind.Unspecified); public static readonly DateTime MinValue = DateTime(MinTicks, DateTimeKind.Unspecified);
public static readonly DateTime MaxValue = DateTime(MaxTicks, DateTimeKind.Unspecified); public static readonly DateTime MaxValue = DateTime(MaxTicks, DateTimeKind.Unspecified);

View file

@ -210,7 +210,7 @@ namespace System.Globalization
else else
{ {
// For all others just use the an empty string (doesn't matter we'll never ask for it for other calendars) // For all others just use the an empty string (doesn't matter we'll never ask for it for other calendars)
this.saAbbrevEnglishEraNames = new String[] { "" }; this.saAbbrevEnglishEraNames = new String[] ( "" );
} }
// Japanese is the only thing with > 1 era. Its current era # is how many ever // Japanese is the only thing with > 1 era. Its current era # is how many ever

View file

@ -126,18 +126,18 @@ namespace System {
static readonly TimeSpan NullOffset = TimeSpan.MinValue; static readonly TimeSpan NullOffset = TimeSpan.MinValue;
static char8[] allStandardFormats = new char8[] static char8[] allStandardFormats = new char8[]
{ (
'd', 'D', 'f', 'F', 'g', 'G', 'd', 'D', 'f', 'F', 'g', 'G',
'm', 'M', 'o', 'O', 'r', 'R', 'm', 'M', 'o', 'O', 'r', 'R',
's', 't', 'T', 'u', 'U', 'y', 'Y', 's', 't', 'T', 'u', 'U', 'y', 'Y',
} ~ delete _; ) ~ delete _;
const String RoundtripFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK"; const String RoundtripFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK";
const String RoundtripDateTimeUnfixed = "yyyy'-'MM'-'ddTHH':'mm':'ss zzz"; const String RoundtripDateTimeUnfixed = "yyyy'-'MM'-'ddTHH':'mm':'ss zzz";
private const int DEFAULT_ALL_DATETIMES_SIZE = 132; private const int DEFAULT_ALL_DATETIMES_SIZE = 132;
static String[] fixedNumberFormats = new String[] { static String[] fixedNumberFormats = new String[] (
"0", "0",
"00", "00",
"000", "000",
@ -145,7 +145,7 @@ namespace System {
"00000", "00000",
"000000", "000000",
"0000000", "0000000",
} ~ delete _; ) ~ delete _;
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
// //

View file

@ -54,14 +54,14 @@ namespace System.Globalization {
GregorianCalendarTypes m_type; GregorianCalendarTypes m_type;
static readonly int[] DaysToMonth365 = new int[] static readonly int[] DaysToMonth365 = new int[]
{ (
0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365
} ~ delete _; ) ~ delete _;
static readonly int[] DaysToMonth366 = new int[] static readonly int[] DaysToMonth366 = new int[]
{ (
0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366
} ~ delete _; ) ~ delete _;
private static volatile Calendar s_defaultInstance; private static volatile Calendar s_defaultInstance;
@ -426,7 +426,7 @@ namespace System.Globalization {
{ {
get get
{ {
return (new int[] {ADEra} ); return (new int[] (ADEra) );
} }
} }

View file

@ -90,9 +90,9 @@ namespace System.Globalization {
// DO NOT UPDATE THIS WITHOUT UPDATING THAT STRUCTURE. IF YOU ADD BOOL, ADD THEM AT THE END. // DO NOT UPDATE THIS WITHOUT UPDATING THAT STRUCTURE. IF YOU ADD BOOL, ADD THEM AT THE END.
// ALSO MAKE SURE TO UPDATE mscorlib.h in the VM directory to check field offsets. // ALSO MAKE SURE TO UPDATE mscorlib.h in the VM directory to check field offsets.
// READTHIS READTHIS READTHIS // READTHIS READTHIS READTHIS
protected int32[] numberGroupSizes = new int32[] {3} ~ delete _; protected int32[] numberGroupSizes = new int32[] (3) ~ delete _;
protected int32[] currencyGroupSizes = new int32[] {3} ~ delete _; protected int32[] currencyGroupSizes = new int32[] (3) ~ delete _;
protected int32[] percentGroupSizes = new int32[] {3} ~ delete _; protected int32[] percentGroupSizes = new int32[] (3) ~ delete _;
protected OwnedString positiveSign = .("+") ~ _.Dispose(); protected OwnedString positiveSign = .("+") ~ _.Dispose();
protected OwnedString negativeSign = .("-") ~ _.Dispose(); protected OwnedString negativeSign = .("-") ~ _.Dispose();
protected OwnedString numberDecimalSeparator = .(".") ~ _.Dispose(); protected OwnedString numberDecimalSeparator = .(".") ~ _.Dispose();
@ -112,7 +112,7 @@ namespace System.Globalization {
protected OwnedString percentSymbol = .("%") ~ _.Dispose(); protected OwnedString percentSymbol = .("%") ~ _.Dispose();
protected OwnedString perMilleSymbol = .("\u{2030}") ~ _.Dispose(); protected OwnedString perMilleSymbol = .("\u{2030}") ~ _.Dispose();
protected String[] nativeDigits = new .[] {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"} ~ DeleteNativeDigits(); protected String[] nativeDigits = new .[] ("0", "1", "2", "3", "4", "5", "6", "7", "8", "9") ~ DeleteNativeDigits();
protected int32 numberDecimalDigits = 2; protected int32 numberDecimalDigits = 2;
protected int32 currencyDecimalDigits = 2; protected int32 currencyDecimalDigits = 2;

View file

@ -375,7 +375,7 @@ namespace System.IO
} }
else else
{ {
buf = new char16[123]* { ? }; buf = new char16[123]* ( ? );
defer:mixin delete buf; defer:mixin delete buf;
} }
buf buf

View file

@ -139,7 +139,7 @@ namespace System.Reflection
if (!methodInfo.IsInitialized) if (!methodInfo.IsInitialized)
return .Err; return .Err;
void* data = new [Align(16)] uint8[mInstSize]* {?}; void* data = new [Align(16)] uint8[mInstSize]* (?);
if (methodInfo.Invoke(data) case .Err) if (methodInfo.Invoke(data) case .Err)
{ {

View file

@ -321,7 +321,7 @@ namespace System
protected virtual void* Alloc(int size, int align) protected virtual void* Alloc(int size, int align)
{ {
return new char8[size]* {?}; return new char8[size]* (?);
} }
protected virtual void Free(void* ptr) protected virtual void Free(void* ptr)
@ -2196,11 +2196,11 @@ namespace System
char16* buf; char16* buf;
if (encodedLen < 128) if (encodedLen < 128)
{ {
buf = scope:mixin char16[encodedLen]* { ? }; buf = scope:mixin char16[encodedLen]* ( ? );
} }
else else
{ {
buf = new char16[encodedLen]* { ? }; buf = new char16[encodedLen]* ( ? );
defer:mixin delete buf; defer:mixin delete buf;
} }
@ -3212,11 +3212,11 @@ namespace System
char16* buf; char16* buf;
if (encodedLen < 128) if (encodedLen < 128)
{ {
buf = scope:mixin char16[encodedLen]* { ? }; buf = scope:mixin char16[encodedLen]* ( ? );
} }
else else
{ {
buf = new char16[encodedLen]* { ? }; buf = new char16[encodedLen]* ( ? );
defer:mixin delete buf; defer:mixin delete buf;
} }

View file

@ -208,11 +208,11 @@ static
void* data; void* data;
if (size <= 128) if (size <= 128)
{ {
data = scope:mixin [Align(align)] uint8[size]* { ? }; data = scope:mixin [Align(align)] uint8[size]* ( ? );
} }
else else
{ {
data = new [Align(align)] uint8[size]* { ? }; data = new [Align(align)] uint8[size]* ( ? );
defer:mixin delete data; defer:mixin delete data;
} }
data data

View file

@ -3,7 +3,7 @@ namespace System.Text
class UTF8 class UTF8
{ {
public static int8* sTrailingBytesForUTF8 = new int8[]* public static int8* sTrailingBytesForUTF8 = new int8[]*
{ (
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@ -12,13 +12,13 @@ namespace System.Text
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5
} ~ delete _; ) ~ delete _;
public static uint32* sOffsetsFromUTF8 = new uint32[]* public static uint32* sOffsetsFromUTF8 = new uint32[]*
{ (
0x00000000, 0x00003080, 0x000E2080, 0x00000000, 0x00003080, 0x000E2080,
0x03C82080, 0xFA082080, 0x82082080 0x03C82080, 0xFA082080, 0x82082080
} ~ delete _; ) ~ delete _;
public static int GetEncodedLength(char32 c) public static int GetEncodedLength(char32 c)
{ {

View file

@ -7512,6 +7512,8 @@ BfObjectCreateExpression* BfReducer::CreateObjectCreateExpression(BfAstNode* all
if (auto block = BfNodeDynCast<BfBlock>(mVisitorPos.GetNext())) if (auto block = BfNodeDynCast<BfBlock>(mVisitorPos.GetNext()))
{ {
mPassInstance->Warn(0, "Expected '('", block->mOpenBrace);
mVisitorPos.MoveNext(); mVisitorPos.MoveNext();
MEMBER_SET(objectCreateExpr, mOpenToken, block->mOpenBrace); MEMBER_SET(objectCreateExpr, mOpenToken, block->mOpenBrace);
// //