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

Removed sized array initialization from tuples

This commit is contained in:
Brian Fiete 2020-02-28 13:58:12 -08:00
parent bb34a468bb
commit 5bed292e87
7 changed files with 24 additions and 40 deletions

View file

@ -109,7 +109,7 @@ namespace System
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
};*/
private static uint64[2048] MantissaBitsTable = (
private static uint64[2048] MantissaBitsTable = .(
4556951262222748432UL, 9113902524445496865UL, 1822780504889099373UL,
3645561009778198746UL, 7291122019556397492UL, 14582244039112794984UL,
2916448807822558996UL, 5832897615645117993UL, 11665795231290235987UL,
@ -794,7 +794,7 @@ namespace System
4602094425247528723UL, 9204188850495057447UL, 1840837770099011489UL,
3681675540198022979UL, 7363351080396045958UL);
private static int32[2048] TensExponentTable = (
private static int32[2048] TensExponentTable = .(
-323, -323, -322, -322, -322, -322, -321, -321, -321, -320, -320, -320,
-319, -319, -319, -319, -318, -318, -318, -317, -317, -317, -316, -316,
-316, -316, -315, -315, -315, -314, -314, -314, -313, -313, -313, -313,
@ -966,9 +966,9 @@ namespace System
284, 284, 284, 285, 285, 285, 286, 286, 286, 286, 287, 287,
287, 288, 288, 288, 289, 289, 289, 289, 290, 290, 290, 291,
291, 291, 292, 292, 292, 293, 293, 293 );
private static char8[16] DigitLowerTable = ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f');
private static char8[16] DigitUpperTable = ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F');
private static int64[19] TenPowersList = (
private static char8[16] DigitLowerTable = .('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f');
private static char8[16] DigitUpperTable = .('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F');
private static int64[19] TenPowersList = .(
1L,
10L,
100L,
@ -991,7 +991,7 @@ namespace System
// DecHexDigits s a translation table from a decimal number to its
// digits hexadecimal representation (e.g. DecHexDigits [34] = 0x34).
private static int32[100] DecHexDigits = (
private static int32[100] DecHexDigits = .(
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29,
@ -2749,7 +2749,7 @@ namespace System
public static void GetActiveSection (StringView format, ref bool positive, bool zero, ref int32 offset, ref int32 length)
{
int32[3] lens = (0,);
int32[3] lens = .(0,);
int32 index = 0;
int32 lastPos = 0;
bool quoted = false;

View file

@ -86,7 +86,7 @@ namespace System.Security.Cryptography
(ROTRIGHT!(x,17) ^ ROTRIGHT!(x,19) ^ ((x) >> 10))
}
const uint32[64] k = (
const uint32[64] k = .(
0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,
0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,
0xe49b69c1,0xefbe4786,0x0fc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,

View file

@ -31,10 +31,9 @@ namespace IDE.ui
mSelection = EditSelection(lineStart, lineEnd);
var selectionText = scope String();
GetSelectionText(selectionText);
//if (selectionText.Length > 512)
//return false;
//int idx = selectionText.IndexOf("line ");
if (selectionText.Length > 1024) // Remove middle
selectionText.Remove(1024/2, selectionText.Length - 1024);
int32 errLine = 0;
int32 errLineChar = 0;
@ -50,7 +49,7 @@ namespace IDE.ui
int32 inTextPos = -1;
for (int32 i = 1; i < Math.Min(512, selectionText.Length); i++)
for (int32 i = 1; i < selectionText.Length; i++)
{
if (success)
break;

View file

@ -15554,16 +15554,7 @@ void BfExprEvaluator::InitializedSizedArray(BfSizedArrayType* arrayType, BfToken
}
void BfExprEvaluator::Visit(BfTupleExpression* tupleExpr)
{
if (mExpectingType != NULL)
{
if (mExpectingType->IsSizedArray())
{
InitializedSizedArray((BfSizedArrayType*)mExpectingType, tupleExpr->mOpenParen, tupleExpr->mValues, tupleExpr->mCommas, tupleExpr->mCloseParen);
return;
}
}
{
BfTupleType* tupleType = NULL;
bool hadFullMatch = false;
if ((mExpectingType != NULL) && (mExpectingType->IsTuple()))

View file

@ -2415,7 +2415,7 @@ void BfIRBuilder::CreateDbgTypeDefinition(BfType* type)
bool useIntConstant = false;
bool wasMadeAddr = false;
String fieldName = fieldDef->mName;
BfIRValue intConstant;
if (constant != NULL)
@ -2424,7 +2424,8 @@ void BfIRBuilder::CreateDbgTypeDefinition(BfType* type)
if (isOptimized)
continue;
if (constant->mConstType == BfConstType_Array)
if ((constant->mConstType == BfConstType_Array) ||
(constant->mConstType == BfConstType_AggZero))
{
staticValue = ConstToMemory(staticValue);
wasMadeAddr = true;

View file

@ -2436,7 +2436,8 @@ int BfResolvedTypeSet::Hash(BfTypeReference* typeRef, LookupContext* ctx, BfHash
{
if ((arrayType->mDimensions == 1) && (arrayType->mParams.size() != 0))
{
int elemHash = Hash(arrayType->mElementType, ctx) ^ HASH_SIZED_ARRAY;
int rawElemHash = Hash(arrayType->mElementType, ctx);
int elemHash = rawElemHash ^ HASH_SIZED_ARRAY;
int hashVal = (elemHash << 5) - elemHash;
// Sized array
@ -2460,25 +2461,15 @@ int BfResolvedTypeSet::Hash(BfTypeReference* typeRef, LookupContext* ctx, BfHash
if (typedVal.mKind == BfTypedValueKind_GenericConstValue)
{
int elemHash = Hash(typedVal.mType, ctx);
/*BF_ASSERT(typedVal.mType->IsGenericParam());
auto genericParamInstance = ctx->mModule->GetGenericParamInstance((BfGenericParamType*)typedVal.mType);
if ((genericParamInstance->mTypeConstraint == NULL) ||
(!ctx->mModule->CanCast(BfTypedValue(ctx->mModule->mBfIRBuilder->GetFakeVal(), genericParamInstance->mTypeConstraint),
ctx->mModule->GetPrimitiveType(BfTypeCode_IntPtr))))
{
ctx->mModule->Fail(StrFormat("Generic constraint '%s' is not convertible to 'int'", ctx->mModule->TypeToString(typedVal.mType).c_str()), sizeExpr);
}*/
hashVal = ((hashVal ^ elemHash) << 5) - hashVal;
return hashVal;
}
if (!typedVal)
ctx->mFailed = true;
ctx->mFailed = true;
if (typedVal)
typedVal = ctx->mModule->Cast(sizeExpr, typedVal, intType);
if (typedVal)
{
{
auto constant = ctx->mModule->mBfIRBuilder->GetConstant(typedVal.mValue);
if (constant->mConstType == BfConstType_Undef)
{
@ -3133,6 +3124,8 @@ bool BfResolvedTypeSet::Equals(BfType* lhs, BfTypeReference* rhs, LookupContext*
auto rhsArrayTypeRef = BfNodeDynCastExact<BfArrayTypeRef>(rhs);
if (rhsArrayTypeRef == NULL)
return false;
if (!rhsArrayTypeRef->mParams.IsEmpty())
return false;
BfArrayType* lhsArrayType = (BfArrayType*) lhs;
if (lhsArrayType->mDimensions != rhsArrayTypeRef->mDimensions)
return false;

View file

@ -2247,15 +2247,15 @@ public:
BfHashFlag_AllowRef = 1,
BfHashFlag_AllowGenericParamConstValue = 2
};
class LookupContext
{
{
public:
BfModule* mModule;
BfTypeReference* mRootTypeRef;
BfTypeDef* mRootTypeDef;
BfType* mResolvedType;
bool mFailed;
bool mFailed;
public:
LookupContext()