GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — [Implement] Naive Buffer.from, and friends by jtenner · Pull Request #6 · AssemblyScript/node Conversation
|
|
@RedDwarfian and @dcodeIO thoughts on this pull request? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
It is not clear in the Naive |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
We might like to pull the ASCII encoding pull request first. #27 Otherwise, this is ready for review. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| if (i32(byteOffset < 0) | i32(byteOffset > buffer.byteLength - length)) throw new RangeError(E_INDEXOUTOFRANGE); | ||
| if (length == 0) return new Buffer(0); | ||
|
|
||
| return assembleBuffer(changetype<usize>(buffer), <usize>byteOffset, <u32>length); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
@MaxGraey should this be min(length, buffer.byteLength - byteOffset)?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| return assembleBuffer(changetype<usize>(buffer), 0, buffer.byteLength); | ||
| } | ||
|
|
||
| public static fromArray<T extends ArrayBufferView>(value: T, offset: i32 = 0, length: i32 = -1): Buffer { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
@dcodeIO what is going to happen to this extends clause? Are we going to detach Array from ArrayBufferView?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| // return and retain | ||
| return changetype<Buffer>(result); | ||
| // @ts-ignore: Buffer returns on all valid branches |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
We can suppress this error by returning changetype<Buffer>(null) at the bottom here after the ERROR. What is the right way to do this?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.