[lexer] Simplify GetLineOffsets#2735
Conversation
3089d34 to
03a4d75
Compare
|
I have also noticed that utf characters are not recognized, so a 3 byte long utf character increases the offset by 3. |
|
What is the benefit of coverting the Maybe make that change separately if you think its worth while? |
|
Negative lines and columns have no meaning. Using unsigned doubles the range. I can split the patch if it is really needed. |
|
The 32 bit part is not important, |
How about we just use of |
03a4d75 to
279fd07
Compare
|
|
But shouldn't we focus on correctness here? Does anyone actually care about the sizeof Location in practice? (i.e. are there wabt uses who would notice?). You wast to make a new |
|
I was born in an era when programs fit into 640 KB RAM, and just cannot stop optimizing code. Anyway, just tell me what to do, and I will do that. |
|
Can you split out the type change from the actually |
279fd07 to
84bbf67
Compare
|
Removed the unsigned part. |
|
Is this patch ok this way? |
|
Could you perhaps update the PR description with a little more context about what this change is actually doing? I don't know this part of the code very well. |
The new code directly scans the input buffer.
84bbf67 to
131730a
Compare
|
Patch and description is updated. |
The original code copies the webassembly source code into a 64K buffer, then searches the newline there. The buffer is refilled when the search reaches its end. The new code does not allocate any 64K buffer, just search the newline directly in the source code.
I suspect the old code assumed that the source code is not fully loaded, but then the lexer could not process it.