Skip to content

Commit 14cf3b4

Browse files
srujzsCommit Queue
authored and
Commit Queue
committed
[dart:js_interop] Add Since('3.6') annotations to new APIs
Closes #56484 Change-Id: I9d3da568aafeccbb855892ea5c2ba647371170bc Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/380900 Reviewed-by: Kevin Moore <[email protected]> Reviewed-by: Leaf Petersen <[email protected]> Reviewed-by: Sigmund Cherem <[email protected]> Commit-Queue: Srujan Gaddam <[email protected]> Reviewed-by: Martin Kustermann <[email protected]>
1 parent d3f37ab commit 14cf3b4

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

sdk/lib/js_interop/js_interop.dart

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,18 +160,22 @@ extension type JSArray<T extends JSAny?>._(JSArrayRepType _jsArray)
160160
external JSArray.withLength(int length);
161161

162162
/// The length in elements of this `Array`.
163+
@Since('3.6')
163164
external int get length;
164165

165166
/// Sets the length in elements of this `Array`.
166167
///
167168
/// Setting it smaller than the current length truncates this `Array`, and
168169
/// setting it larger adds empty slots, which requires [T] to be nullable.
170+
@Since('3.6')
169171
external set length(int newLength);
170172

171173
/// The value at [position] in this `Array`.
174+
@Since('3.6')
172175
external T operator [](int position);
173176

174177
/// Sets the [value] at [position] in this `Array`.
178+
@Since('3.6')
175179
external void operator []=(int position, T value);
176180
}
177181

@@ -211,6 +215,7 @@ extension type JSArrayBuffer._(JSArrayBufferRepType _jsArrayBuffer)
211215
implements JSObject {
212216
/// Creates a JavaScript `ArrayBuffer` of size [length] using an optional
213217
/// [options] JavaScript object that sets the `maxByteLength`.
218+
@Since('3.6')
214219
external JSArrayBuffer(int length, [JSObject options]);
215220
}
216221

@@ -219,6 +224,7 @@ extension type JSArrayBuffer._(JSArrayBufferRepType _jsArrayBuffer)
219224
extension type JSDataView._(JSDataViewRepType _jsDataView) implements JSObject {
220225
/// Creates a JavaScript `DataView` with [buffer] as its backing storage,
221226
/// offset by [byteOffset] bytes, of size [byteLength].
227+
@Since('3.6')
222228
external JSDataView(JSArrayBuffer buffer, [int byteOffset, int byteLength]);
223229
}
224230

@@ -234,10 +240,12 @@ extension type JSInt8Array._(JSInt8ArrayRepType _jsInt8Array)
234240
/// offset by [byteOffset] bytes, of size [length].
235241
///
236242
/// If no [buffer] is provided, creates an empty `Int8Array`.
243+
@Since('3.6')
237244
external JSInt8Array([JSArrayBuffer buffer, int byteOffset, int length]);
238245

239246
/// Creates a JavaScript `Int8Array` of size [length] whose elements are
240247
/// initialized to 0.
248+
@Since('3.6')
241249
external JSInt8Array.withLength(int length);
242250
}
243251

@@ -249,10 +257,12 @@ extension type JSUint8Array._(JSUint8ArrayRepType _jsUint8Array)
249257
/// offset by [byteOffset] bytes, of size [length].
250258
///
251259
/// If no [buffer] is provided, creates an empty `Uint8Array`.
260+
@Since('3.6')
252261
external JSUint8Array([JSArrayBuffer buffer, int byteOffset, int length]);
253262

254263
/// Creates a JavaScript `Uint8Array` of size [length] whose elements are
255264
/// initialized to 0.
265+
@Since('3.6')
256266
external JSUint8Array.withLength(int length);
257267
}
258268

@@ -264,11 +274,13 @@ extension type JSUint8ClampedArray._(
264274
/// storage, offset by [byteOffset] bytes, of size [length].
265275
///
266276
/// If no [buffer] is provided, creates an empty `Uint8ClampedArray`.
277+
@Since('3.6')
267278
external JSUint8ClampedArray(
268279
[JSArrayBuffer buffer, int byteOffset, int length]);
269280

270281
/// Creates a JavaScript `Uint8ClampedArray` of size [length] whose elements
271282
/// are initialized to 0.
283+
@Since('3.6')
272284
external JSUint8ClampedArray.withLength(int length);
273285
}
274286

@@ -280,10 +292,12 @@ extension type JSInt16Array._(JSInt16ArrayRepType _jsInt16Array)
280292
/// offset by [byteOffset] bytes, of size [length].
281293
///
282294
/// If no [buffer] is provided, creates an empty `Int16Array`.
295+
@Since('3.6')
283296
external JSInt16Array([JSArrayBuffer buffer, int byteOffset, int length]);
284297

285298
/// Creates a JavaScript `Int16Array` of size [length] whose elements are
286299
/// initialized to 0.
300+
@Since('3.6')
287301
external JSInt16Array.withLength(int length);
288302
}
289303

@@ -295,10 +309,12 @@ extension type JSUint16Array._(JSUint16ArrayRepType _jsUint16Array)
295309
/// offset by [byteOffset] bytes, of size [length].
296310
///
297311
/// If no [buffer] is provided, creates an empty `Uint16Array`.
312+
@Since('3.6')
298313
external JSUint16Array([JSArrayBuffer buffer, int byteOffset, int length]);
299314

300315
/// Creates a JavaScript `Uint16Array` of size [length] whose elements are
301316
/// initialized to 0.
317+
@Since('3.6')
302318
external JSUint16Array.withLength(int length);
303319
}
304320

@@ -310,10 +326,12 @@ extension type JSInt32Array._(JSInt32ArrayRepType _jsInt32Array)
310326
/// offset by [byteOffset] bytes, of size [length].
311327
///
312328
/// If no [buffer] is provided, creates an empty `Int32Array`.
329+
@Since('3.6')
313330
external JSInt32Array([JSArrayBuffer buffer, int byteOffset, int length]);
314331

315332
/// Creates a JavaScript `Int32Array` of size [length] whose elements are
316333
/// initialized to 0.
334+
@Since('3.6')
317335
external JSInt32Array.withLength(int length);
318336
}
319337

@@ -325,10 +343,12 @@ extension type JSUint32Array._(JSUint32ArrayRepType _jsUint32Array)
325343
/// offset by [byteOffset] bytes, of size [length].
326344
///
327345
/// If no [buffer] is provided, creates an empty `Uint32Array`.
346+
@Since('3.6')
328347
external JSUint32Array([JSArrayBuffer buffer, int byteOffset, int length]);
329348

330349
/// Creates a JavaScript `Uint32Array` of size [length] whose elements are
331350
/// initialized to 0.
351+
@Since('3.6')
332352
external JSUint32Array.withLength(int length);
333353
}
334354

@@ -340,10 +360,12 @@ extension type JSFloat32Array._(JSFloat32ArrayRepType _jsFloat32Array)
340360
/// offset by [byteOffset] bytes, of size [length].
341361
///
342362
/// If no [buffer] is provided, creates an empty `Float32Array`.
363+
@Since('3.6')
343364
external JSFloat32Array([JSArrayBuffer buffer, int byteOffset, int length]);
344365

345366
/// Creates a JavaScript `Float32Array` of size [length] whose elements are
346367
/// initialized to 0.
368+
@Since('3.6')
347369
external JSFloat32Array.withLength(int length);
348370
}
349371

@@ -355,10 +377,12 @@ extension type JSFloat64Array._(JSFloat64ArrayRepType _jsFloat64Array)
355377
/// offset by [byteOffset] bytes, of size [length].
356378
///
357379
/// If no [buffer] is provided, creates an empty `Float64Array`.
380+
@Since('3.6')
358381
external JSFloat64Array([JSArrayBuffer buffer, int byteOffset, int length]);
359382

360383
/// Creates a JavaScript `Float64Array` of size [length] whose elements are
361384
/// initialized to 0.
385+
@Since('3.6')
362386
external JSFloat64Array.withLength(int length);
363387
}
364388

@@ -625,6 +649,7 @@ extension FunctionToJSExportedDartFunction on Function {
625649
/// [Function]. Any [Function] that is converted with this member should take
626650
/// in an extra parameter at the beginning of the parameter list to handle
627651
/// this.
652+
@Since('3.6')
628653
external JSExportedDartFunction get toJSCaptureThis;
629654
}
630655

0 commit comments

Comments
 (0)