Detect ref, null and unknown types in YYTypeof
#3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related to #4611,
object_index
was already working as intended, buttypeof(object_index)
was incorrectly returning "struct". This now returns "ref".While I was at it, I also added the cases for "null" and "unknown" (actually those that GameMaker wouldn't support) types.
Unrelated bug for future fix:
"caught a massive optimization problem in HTML5, where every time you move an object to a different depth, it grows an array, and the array doesn't shrink back down again, so now you have an O(n) performance problem where n is how many times you've moved depths"
"and the reason the array doesn't shrink back down again is specifically an optimization decision they made which is meant to avoid reallocating memory
BUT, array memory allocation in JS doesn't work quite in that way, because JS itself has its own optimizations for array allocation under the hood, so that optimization was self-defeating"
(note: GMS 1 is not affected)
Likely regressed by YoYoGames@0f4f72c