test/script/basic/JDK-8156714.js

Fri, 13 May 2016 18:38:15 +0200

author
hannesw
date
Fri, 13 May 2016 18:38:15 +0200
changeset 1832
133a3c6c906e
permissions
-rw-r--r--

8156714: Parsing issue with automatic semicolon insertion
Reviewed-by: jlaskey, sundar

hannesw@1832 1 /*
hannesw@1832 2 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
hannesw@1832 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
hannesw@1832 4 *
hannesw@1832 5 * This code is free software; you can redistribute it and/or modify it
hannesw@1832 6 * under the terms of the GNU General Public License version 2 only, as
hannesw@1832 7 * published by the Free Software Foundation.
hannesw@1832 8 *
hannesw@1832 9 * This code is distributed in the hope that it will be useful, but WITHOUT
hannesw@1832 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
hannesw@1832 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
hannesw@1832 12 * version 2 for more details (a copy is included in the LICENSE file that
hannesw@1832 13 * accompanied this code).
hannesw@1832 14 *
hannesw@1832 15 * You should have received a copy of the GNU General Public License version
hannesw@1832 16 * 2 along with this work; if not, write to the Free Software Foundation,
hannesw@1832 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
hannesw@1832 18 *
hannesw@1832 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
hannesw@1832 20 * or visit www.oracle.com if you need additional information or have any
hannesw@1832 21 * questions.
hannesw@1832 22 */
hannesw@1832 23
hannesw@1832 24 /**
hannesw@1832 25 * JDK-8156714: Parsing issue with automatic semicolon insertion
hannesw@1832 26 *
hannesw@1832 27 * @test
hannesw@1832 28 * @run
hannesw@1832 29 */
hannesw@1832 30
hannesw@1832 31 a = function() {
hannesw@1832 32 }
hannesw@1832 33
hannesw@1832 34 /* */ function b() {
hannesw@1832 35 }
hannesw@1832 36
hannesw@1832 37 c = function() {
hannesw@1832 38 } /*
hannesw@1832 39
hannesw@1832 40 */ function d() {
hannesw@1832 41 }
hannesw@1832 42
hannesw@1832 43 try {
hannesw@1832 44 eval("x = function() {} /* */ function y() {}");
hannesw@1832 45 throw new Error("Error expected");
hannesw@1832 46 } catch (e) {
hannesw@1832 47 if (!(e instanceof SyntaxError)) {
hannesw@1832 48 throw new Error("Unexpected error: " + e);
hannesw@1832 49 }
hannesw@1832 50 }

mercurial