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

Fixed zeroing of paramdecl in lambdas

This commit is contained in:
Brian Fiete 2020-05-17 06:58:03 -07:00
parent 6976de31af
commit 3d3cde906b
2 changed files with 12 additions and 0 deletions

View file

@ -1399,6 +1399,17 @@ public:
val->InitWithTypeId(T::sTypeInfo.mTypeId);
return val;
}
template <typename T>
static void Zero(T* val)
{
#ifdef BF_AST_COMPACT
memset((uint8*)val + offsetof(T, mAstInfo), 0, sizeof(T) - offsetof(T, mAstInfo));
#else
memset((uint8*)val + offsetof(T, mTriviaStart), 0, sizeof(T) - offsetof(T, mTriviaStart));
#endif
val->InitWithTypeId(T::sTypeInfo.mTypeId);
}
#endif
};
#ifdef BF_AST_DO_IMPL

View file

@ -10058,6 +10058,7 @@ BfLambdaInstance* BfExprEvaluator::GetLambdaInstance(BfLambdaBindExpression* lam
BfParameterDef* paramDef = new BfParameterDef();
paramDef->mParamDeclaration = tempParamDecls.Alloc();
BfAstNode::Zero(paramDef->mParamDeclaration);
BfLocalVariable* localVar = new BfLocalVariable();
if (paramIdx < (int)lambdaBindExpr->mParams.size())