1/* 2 * Copyright (c) 2023-2025 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16function foo_test_1() { 17 console.log(arguments[0]); 18} 19 20function foo_test_2() { 21 console.log(arguments[1]); 22} 23 24function foo_test_3() { 25 for (let i = 0; i < arguments.length; i++) { 26 console.log(arguments[i]); 27 } 28} 29 30function foo_test_4() { 31 console.log('Number of arguments:', arguments.length); 32} 33 34function foo_test_5() { 35 console.log(arguments); 36} 37 38function foo_test_6() { 39 let args = Array.prototype.slice.call(arguments); 40 console.log(args); 41} 42 43function foo_test_7 { 44 console.log(Array.prototype.join.call(arguments, ', ')); 45} 46 47function foo_test_8 { 48 console.log(arguments); 49} 50 51function foo_test_9 { 52 let args = Array.prototype.slice.call(arguments); 53 console.log(args); 54} 55 56function foo_test_10() { 57 if (arguments.length > 0) { 58 console.log('Parameters received:', arguments); 59 } else { 60 console.log('No parameters received.'); 61 } 62} 63 64class C { 65 arguments: IArguments; // No error 66 67 constructor() { 68 this.arguments = arguments; // Error on right-hand side `arguments` 69 } 70 71 m() { 72 console.log(arguments); // Error 73 console.log(this.arguments) // No error 74 } 75} 76 77function foo_test_11() { 78 let c = new C(); 79 console.log(c.arguments[0]) // No error 80}