From 741634be10a978430eb85663a87b2ad12c57a1be Mon Sep 17 00:00:00 2001 From: yjhmelody <465402634@qq.com> Date: Mon, 19 Apr 2021 17:02:43 +0800 Subject: [PATCH] feat: make Array.buffer public --- std/assembly/array.ts | 2 +- std/assembly/index.d.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/std/assembly/array.ts b/std/assembly/array.ts index cc54a6be57..4dccd5287f 100644 --- a/std/assembly/array.ts +++ b/std/assembly/array.ts @@ -33,7 +33,7 @@ export class Array { // `dataStart` (equals `buffer`) and `byteLength` (equals computed `buffer.byteLength`), but the // block is 16 bytes anyway so it's fine to have a couple extra fields in there. - private buffer: ArrayBuffer; + readonly buffer: ArrayBuffer; private dataStart: usize; private byteLength: i32; diff --git a/std/assembly/index.d.ts b/std/assembly/index.d.ts index af2c7f4181..3933899552 100644 --- a/std/assembly/index.d.ts +++ b/std/assembly/index.d.ts @@ -1575,11 +1575,12 @@ declare class Array { static isArray(value: any): value is Array; [key: number]: T; + /** The {@link ArrayBuffer} referenced by this view. */ + readonly buffer: ArrayBuffer; /** Current length of the array. */ length: i32; /** Constructs a new array. */ constructor(capacity?: i32); - at(index: i32): T; fill(value: T, start?: i32, end?: i32): this; every(callbackfn: (element: T, index: i32, array?: Array) => bool): bool;