|
1 | 1 | // Auto-generated code, DO NOT EDIT DIRECTLY! |
2 | 2 | // To edit this generated file you have to edit `tasks/ast_tools/src/generators/raw_transfer.rs`. |
3 | 3 |
|
4 | | -let uint8, uint32, float64, sourceText, sourceIsAscii, sourceByteLen; |
| 4 | +let uint8, uint32, float64, sourceText, sourceIsAscii, sourceEndPos; |
5 | 5 |
|
6 | 6 | const textDecoder = new TextDecoder("utf-8", { ignoreBOM: true }), |
7 | 7 | decodeStr = textDecoder.decode.bind(textDecoder), |
8 | 8 | { fromCodePoint } = String; |
9 | 9 |
|
10 | 10 | export function deserialize(buffer, sourceText, sourceByteLen) { |
| 11 | + sourceEndPos = sourceByteLen; |
11 | 12 | let data = deserializeWith(buffer, sourceText, sourceByteLen, null, deserializeRawTransferData); |
12 | 13 | resetBuffer(); |
13 | 14 | return data; |
14 | 15 | } |
15 | 16 |
|
16 | | -function deserializeWith(buffer, sourceTextInput, sourceByteLenInput, getLocInput, deserialize) { |
| 17 | +function deserializeWith(buffer, sourceTextInput, sourceByteLen, getLocInput, deserialize) { |
17 | 18 | uint8 = buffer; |
18 | 19 | uint32 = buffer.uint32; |
19 | 20 | float64 = buffer.float64; |
20 | 21 | sourceText = sourceTextInput; |
21 | | - sourceByteLen = sourceByteLenInput; |
22 | 22 | sourceIsAscii = sourceText.length === sourceByteLen; |
23 | 23 | return deserialize(uint32[536870902]); |
24 | 24 | } |
@@ -4523,7 +4523,7 @@ function deserializeStr(pos) { |
4523 | 4523 | len = uint32[pos32 + 2]; |
4524 | 4524 | if (len === 0) return ""; |
4525 | 4525 | pos = uint32[pos32]; |
4526 | | - if (sourceIsAscii && pos < sourceByteLen) return sourceText.substr(pos, len); |
| 4526 | + if (sourceIsAscii && pos < sourceEndPos) return sourceText.substr(pos, len); |
4527 | 4527 | // Longer strings use `TextDecoder` |
4528 | 4528 | // TODO: Find best switch-over point |
4529 | 4529 | let end = pos + len; |
|
0 commit comments