JDK-8013325.js revision 226:7917ef020898
150472Speter/*
233975Sjdp * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
333975Sjdp * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
433975Sjdp *
533975Sjdp * This code is free software; you can redistribute it and/or modify it
633975Sjdp * under the terms of the GNU General Public License version 2 only, as
7218822Sdim * published by the Free Software Foundation.
884947Sobrien *
9215082Simp * This code is distributed in the hope that it will be useful, but WITHOUT
10239272Sgonzo * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11130575Sobrien * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12215082Simp * version 2 for more details (a copy is included in the LICENSE file that
13130575Sobrien * accompanied this code).
14215082Simp *
15218822Sdim * You should have received a copy of the GNU General Public License version
16218822Sdim * 2 along with this work; if not, write to the Free Software Foundation,
17215082Simp * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18218822Sdim *
19239272Sgonzo * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20233644Sjmallett * or visit www.oracle.com if you need additional information or have any
21215082Simp * questions.
22215082Simp */
2344360Simp
2433975Sjdp/**
2533975Sjdp * JDK-8013325: function named 'arguments' should still access arguments object within itself.
2633975Sjdp * Its parent should however see the function and not an arguments object.
2784902Sobrien *
2833975Sjdp * @test
2984902Sobrien * @run
3084902Sobrien */
3133975Sjdp
32215082Simpfunction x() {
33215276Simp  // x doesn't see an arguments object as it has a nested function with that name
34217942Sjchandra  // so it'll invoke the function.
35166638Smarcel  arguments("a", "b", "c");
36166638Smarcel
37166638Smarcel  function arguments(x, y, z) {
38166638Smarcel      // The function 'arguments' OTOH can't see itself; if it uses the
39166638Smarcel      // identifier 'arguments', it'll see its own arguments object.
4090353Sobrien      print(arguments)
4184902Sobrien      print(x + " " + y + " " + z)
42131832Sobrien  }
43130575Sobrien}
4484902Sobrienx()
4534495Sjdp