mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32:20 +02:00
Added expected type (int) for indexer expressions with ptrs/sized arrays
This commit is contained in:
parent
7e75a24807
commit
9ac84e12e9
2 changed files with 7 additions and 1 deletions
|
@ -19603,7 +19603,7 @@ void BfExprEvaluator::Visit(BfIndexerExpression* indexerExpr)
|
|||
|
||||
bool isUndefIndex = false;
|
||||
|
||||
auto indexArgument = mModule->CreateValueFromExpression(indexerExpr->mArguments[0]);
|
||||
auto indexArgument = mModule->CreateValueFromExpression(indexerExpr->mArguments[0], mModule->GetPrimitiveType(BfTypeCode_IntPtr), BfEvalExprFlags_NoCast);
|
||||
if (!indexArgument)
|
||||
return;
|
||||
if (!indexArgument.mType->IsIntegral())
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#pragma warning disable 168
|
||||
|
||||
using System;
|
||||
namespace Tests
|
||||
{
|
||||
|
@ -22,6 +24,10 @@ namespace Tests
|
|||
Test.Assert(sa.mB == 22);
|
||||
Test.Assert(sa.mC == 33);
|
||||
|
||||
var val = arr[(.)1];
|
||||
int[3] arr2 = .(1, 2, 3);
|
||||
var val2 = arr2[(.)1];
|
||||
|
||||
#if BF_64_BIT
|
||||
/*int a = (int)(void*)&sa - (int)Internal.UnsafeCastToPtr(arr);
|
||||
int b = typeof(System.Array).InstanceSize;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue