In my fork I added a GET element/tag (which includes JavaScript code that’s executed on the server) and this caused some of the other tests to fail.
Looking into the issue, I was able to narrow it down to the compareTags() call in the scan_end_tag_name in src/scanner.c failing and resulting in ERRORNEOUS_END_TAG_NAME errors whenever a custom tag was encounter. Looking deeper, I saw that the comparison of a->type and b->type in compareTags was failing with -128 != 128. Given TagType should be unsigned, I started wondering where a negative value could have crept in and looked for any casts that might be happening, which led me to the one in the vc_vector_resize() function in this pull request.
Taking the absolute value of the value in the buffer before casting it seems to have solved the issue and all my tests are passing again.
This doesn’t affect the tree-sitter-svelte codebase as it stands currently but it should arise if you were to add another tag to TagType in the future.
Thank you for the pull request. I never faced any problems with the current state of the code. This is a really good addition to the library. It will definitely solve many issues with the library as it stands
In my fork I added a
GET
element/tag (which includes JavaScript code that’s executed on the server) and this caused some of the other tests to fail.Looking into the issue, I was able to narrow it down to the
compareTags()
call in thescan_end_tag_name
in src/scanner.c failing and resulting inERRORNEOUS_END_TAG_NAME
errors whenever a custom tag was encounter. Looking deeper, I saw that the comparison ofa->type
andb->type
incompareTags
was failing with-128 != 128
. GivenTagType
should be unsigned, I started wondering where a negative value could have crept in and looked for any casts that might be happening, which led me to the one in thevc_vector_resize()
function in this pull request.Taking the absolute value of the value in the buffer before casting it seems to have solved the issue and all my tests are passing again.
This doesn’t affect the tree-sitter-svelte codebase as it stands currently but it should arise if you were to add another tag to
TagType
in the future.