Mon, 17 Apr 2017 11:46:11 -0700
Added tag jdk8u141-b05 for changeset f7fc5fc0e2cb
sundar@1372 | 1 | /* |
sundar@1372 | 2 | * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. |
sundar@1372 | 3 | * |
sundar@1372 | 4 | * Redistribution and use in source and binary forms, with or without |
sundar@1372 | 5 | * modification, are permitted provided that the following conditions |
sundar@1372 | 6 | * are met: |
sundar@1372 | 7 | * |
sundar@1372 | 8 | * - Redistributions of source code must retain the above copyright |
sundar@1372 | 9 | * notice, this list of conditions and the following disclaimer. |
sundar@1372 | 10 | * |
sundar@1372 | 11 | * - Redistributions in binary form must reproduce the above copyright |
sundar@1372 | 12 | * notice, this list of conditions and the following disclaimer in the |
sundar@1372 | 13 | * documentation and/or other materials provided with the distribution. |
sundar@1372 | 14 | * |
sundar@1372 | 15 | * - Neither the name of Oracle nor the names of its |
sundar@1372 | 16 | * contributors may be used to endorse or promote products derived |
sundar@1372 | 17 | * from this software without specific prior written permission. |
sundar@1372 | 18 | * |
sundar@1372 | 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS |
sundar@1372 | 20 | * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
sundar@1372 | 21 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
sundar@1372 | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
sundar@1372 | 23 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
sundar@1372 | 24 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
sundar@1372 | 25 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
sundar@1372 | 26 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
sundar@1372 | 27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
sundar@1372 | 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
sundar@1372 | 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
sundar@1372 | 30 | */ |
sundar@1372 | 31 | |
sundar@1372 | 32 | // Nashorn extension: __noSuchMethod__ |
sundar@1372 | 33 | // See also: https://wiki.openjdk.java.net/display/Nashorn/Nashorn+extensions#Nashornextensions-__noSuchMethod__ |
sundar@1372 | 34 | |
sundar@1372 | 35 | Object.prototype.__noSuchMethod__ = function(name) { |
sundar@1372 | 36 | print(name + " function is not defined in " + this); |
sundar@1372 | 37 | |
sundar@1372 | 38 | // Nashorn extension: stack property |
sundar@1372 | 39 | // gives stack trace as a string |
sundar@1372 | 40 | print(new Error().stack); |
sundar@1372 | 41 | } |
sundar@1372 | 42 | |
sundar@1372 | 43 | function func(obj) { |
sundar@1372 | 44 | obj.foo(); |
sundar@1372 | 45 | } |
sundar@1372 | 46 | |
sundar@1372 | 47 | func({}); |
sundar@1372 | 48 | func(this); |