author | hannesw |
Mon, 15 Sep 2014 17:51:11 +0200 | |
changeset 26648 | 9a64e15eff37 |
parent 24778 | 2ff5d7041566 |
permissions | -rw-r--r-- |
17744
65849f87aa28
8011718: binding already bound function with extra arguments fails
attila
parents:
diff
changeset
|
1 |
/* |
65849f87aa28
8011718: binding already bound function with extra arguments fails
attila
parents:
diff
changeset
|
2 |
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. |
65849f87aa28
8011718: binding already bound function with extra arguments fails
attila
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
65849f87aa28
8011718: binding already bound function with extra arguments fails
attila
parents:
diff
changeset
|
4 |
* |
65849f87aa28
8011718: binding already bound function with extra arguments fails
attila
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
65849f87aa28
8011718: binding already bound function with extra arguments fails
attila
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
65849f87aa28
8011718: binding already bound function with extra arguments fails
attila
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
65849f87aa28
8011718: binding already bound function with extra arguments fails
attila
parents:
diff
changeset
|
8 |
* |
65849f87aa28
8011718: binding already bound function with extra arguments fails
attila
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
65849f87aa28
8011718: binding already bound function with extra arguments fails
attila
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
65849f87aa28
8011718: binding already bound function with extra arguments fails
attila
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
65849f87aa28
8011718: binding already bound function with extra arguments fails
attila
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
65849f87aa28
8011718: binding already bound function with extra arguments fails
attila
parents:
diff
changeset
|
13 |
* accompanied this code). |
65849f87aa28
8011718: binding already bound function with extra arguments fails
attila
parents:
diff
changeset
|
14 |
* |
65849f87aa28
8011718: binding already bound function with extra arguments fails
attila
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
65849f87aa28
8011718: binding already bound function with extra arguments fails
attila
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
65849f87aa28
8011718: binding already bound function with extra arguments fails
attila
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
65849f87aa28
8011718: binding already bound function with extra arguments fails
attila
parents:
diff
changeset
|
18 |
* |
65849f87aa28
8011718: binding already bound function with extra arguments fails
attila
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
65849f87aa28
8011718: binding already bound function with extra arguments fails
attila
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
65849f87aa28
8011718: binding already bound function with extra arguments fails
attila
parents:
diff
changeset
|
21 |
* questions. |
65849f87aa28
8011718: binding already bound function with extra arguments fails
attila
parents:
diff
changeset
|
22 |
*/ |
65849f87aa28
8011718: binding already bound function with extra arguments fails
attila
parents:
diff
changeset
|
23 |
|
65849f87aa28
8011718: binding already bound function with extra arguments fails
attila
parents:
diff
changeset
|
24 |
/** |
65849f87aa28
8011718: binding already bound function with extra arguments fails
attila
parents:
diff
changeset
|
25 |
* JDK-8011718: binding already bound function with extra arguments fails. |
65849f87aa28
8011718: binding already bound function with extra arguments fails
attila
parents:
diff
changeset
|
26 |
* |
65849f87aa28
8011718: binding already bound function with extra arguments fails
attila
parents:
diff
changeset
|
27 |
* @test |
65849f87aa28
8011718: binding already bound function with extra arguments fails
attila
parents:
diff
changeset
|
28 |
* @run |
65849f87aa28
8011718: binding already bound function with extra arguments fails
attila
parents:
diff
changeset
|
29 |
*/ |
65849f87aa28
8011718: binding already bound function with extra arguments fails
attila
parents:
diff
changeset
|
30 |
|
24778
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
17744
diff
changeset
|
31 |
var obj = { |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
17744
diff
changeset
|
32 |
hello:"From obj", |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
17744
diff
changeset
|
33 |
}; |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
17744
diff
changeset
|
34 |
var obj2 = { |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
17744
diff
changeset
|
35 |
hello:"From obj2", |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
17744
diff
changeset
|
36 |
}; |
17744
65849f87aa28
8011718: binding already bound function with extra arguments fails
attila
parents:
diff
changeset
|
37 |
|
24778
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
17744
diff
changeset
|
38 |
function doit(cb){ |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
17744
diff
changeset
|
39 |
cb(); |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
17744
diff
changeset
|
40 |
var cb2 = cb.bind(obj2, "This one is not acccepted"); |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
17744
diff
changeset
|
41 |
cb2(); |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
17744
diff
changeset
|
42 |
} |
17744
65849f87aa28
8011718: binding already bound function with extra arguments fails
attila
parents:
diff
changeset
|
43 |
|
24778
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
17744
diff
changeset
|
44 |
doit(function(){ |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
17744
diff
changeset
|
45 |
print(this.hello); |
17744
65849f87aa28
8011718: binding already bound function with extra arguments fails
attila
parents:
diff
changeset
|
46 |
}.bind(obj)); |