Made undefined variable names zero in compile step

This commit is contained in:
Thaum Rystra
2024-04-12 11:36:11 +02:00
parent 3a7c3765c6
commit 4793b34a55
5 changed files with 23 additions and 16 deletions

View File

@@ -87,6 +87,15 @@ const accessor: AccessorFactory = {
};
}
if (valueType === 'undefined') {
// Replace unknown variables with zero marked isUndefined
return {
result: constant.create({
value: 0,
isUndefined: true,
}),
context
};
// Old Behavior
// We are only at compile, if it isn't defined in the scope, return a copy of the accessor
return {
result: accessor.create({