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

Cache sized array length during typeref resolution

This commit is contained in:
Brian Fiete 2022-06-24 07:35:02 -07:00
parent b1023ff36a
commit 0cf3e2283d
7 changed files with 20 additions and 15 deletions

View file

@ -11272,16 +11272,10 @@ BfType* BfModule::ResolveTypeRef(BfTypeReference* typeRef, BfPopulateType popula
BfExpression* sizeExpr = BfNodeDynCast<BfExpression>(arrayTypeRef->mParams[0]);
BF_ASSERT(sizeExpr != NULL);
if (sizeExpr != NULL)
{
BfConstResolver constResolver(this);
{
BfType* intType = GetPrimitiveType(BfTypeCode_IntPtr);
constResolver.mExpectingType = intType;
constResolver.mBfEvalExprFlags = (BfEvalExprFlags)(constResolver.mBfEvalExprFlags | BfEvalExprFlags_AllowGenericConstValue);
BfTypedValue typedVal;
{
SetAndRestoreValue<bool> prevIgnoreErrors(mIgnoreErrors, true);
typedVal = constResolver.Resolve(sizeExpr, NULL, BfConstResolveFlag_ArrayInitSize);
}
lookupCtx.mResolvedValueMap.TryGetValue(sizeExpr, &typedVal);
if (typedVal.mKind == BfTypedValueKind_GenericConstValue)
{
BfUnknownSizedArrayType* arrayType = new BfUnknownSizedArrayType();