File tree Expand file tree Collapse file tree 3 files changed +57
-0
lines changed
src/com/google/javascript/jscomp/js/es6 Expand file tree Collapse file tree 3 files changed +57
-0
lines changed Original file line number Diff line number Diff line change @@ -709,6 +709,16 @@ TypedArray.prototype.subarray = function(begin, opt_end) {};
709
709
*/
710
710
TypedArray . prototype . values = function ( ) { } ;
711
711
712
+ /**
713
+ * NOTE: this is an ES2023 extern.
714
+ * @return {THIS }
715
+ * @this {THIS}
716
+ * @template THIS
717
+ * @nosideeffects
718
+ * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/toReversed
719
+ */
720
+ TypedArray . prototype . toReversed = function ( ) { } ;
721
+
712
722
/**
713
723
* @return {string }
714
724
* @nosideeffects
Original file line number Diff line number Diff line change 23
23
'require es6/typedarray/fill' ;
24
24
'require es6/typedarray/findlast' ;
25
25
'require es6/typedarray/findlastindex' ;
26
+ 'require es6/typedarray/toreversed' ;
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2025 The Closure Compiler Authors.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ 'require util/polyfill' ;
18
+
19
+ /**
20
+ * @param {* } orig
21
+ * @return {* }
22
+ */
23
+ $jscomp . typedArrayToReversed = function ( orig ) {
24
+ if ( orig ) return orig ;
25
+
26
+ /**
27
+ * Returns a new typed array with all elements reversed.
28
+ *
29
+ * Note: This polyfill purposefully is NOT spec compliant in order to minimize
30
+ * code size. See skipped unit tests for specific gaps.
31
+ *
32
+ * @see https://tc39.es/ecma262/multipage/indexed-collections.html#sec-%typedarray%.prototype.toreversed
33
+ *
34
+ * @return {THIS }
35
+ * @this {THIS}
36
+ * @template THIS
37
+ */
38
+ var polyfill = function ( ) {
39
+ return this . slice ( ) . reverse ( ) ;
40
+ } ;
41
+
42
+ return polyfill ;
43
+ } ;
44
+
45
+ $jscomp . polyfillTypedArrayMethod (
46
+ 'toReversed' , $jscomp . typedArrayToReversed , 'es_next' , 'es5' ) ;
You can’t perform that action at this time.
0 commit comments