take a step back

This commit is contained in:
dcode
2019-03-14 04:33:58 +01:00
parent e38f627c8b
commit 6163a73ab5
30 changed files with 645 additions and 1287 deletions

View File

@ -1,4 +1,5 @@
import { ArrayBuffer } from "./arraybuffer";
import { ArrayBufferView } from "./runtime";
export class DataView {
@ -12,7 +13,7 @@ export class DataView {
byteLength: i32 = i32.MIN_VALUE // FIXME
) {
if (byteLength === i32.MIN_VALUE) byteLength = buffer.byteLength - byteOffset; // FIXME
if (<u32>byteLength > <u32>ArrayBuffer.MAX_BYTELENGTH) throw new RangeError("Invalid byteLength");
if (<u32>byteLength > <u32>ArrayBufferView.MAX_BYTELENGTH) throw new RangeError("Invalid byteLength");
if (<u32>byteOffset + byteLength > <u32>buffer.byteLength) throw new RangeError("Invalid length");
this.data = buffer; // links
var dataStart = changetype<usize>(buffer) + <usize>byteOffset;