test/script/basic/no_line_numbers.js

Wed, 18 Jun 2014 12:35:42 -0700

author
katleman
date
Wed, 18 Jun 2014 12:35:42 -0700
changeset 863
6e9c4e34bc61
parent 0
b1a7da25b547
child 962
ac62e33a99b0
permissions
-rw-r--r--

Added tag jdk8u20-b19 for changeset b047df215de4

     1 /*
     2  * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  * 
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     8  * 
     9  * This code is distributed in the hope that it will be useful, but WITHOUT
    10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    12  * version 2 for more details (a copy is included in the LICENSE file that
    13  * accompanied this code).
    14  * 
    15  * You should have received a copy of the GNU General Public License version
    16  * 2 along with this work; if not, write to the Free Software Foundation,
    17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    18  * 
    19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    20  * or visit www.oracle.com if you need additional information or have any
    21  * questions.
    22  */
    24 /**
    25  * no_line_numbers.js - make sure that switching off line number generation
    26  * doesn't break. Otherwise, this is just NASHORN-73, a unit test particularly
    27  * prone to label bugs in CodeGenerator
    28  *
    29  * @test
    30  * @run
    31  * @option --debug-lines=false
    32  */
    34 print("x = " + x);
    35 do {
    36    break;
    37    var x;
    38 } while (true);
    41 print("y = " + y);
    42 while (true) {
    43     break;
    44     var y;
    45 }
    47 print("z = " + z);
    48 for ( ; ; ) {
    49    break;
    50    var z;
    51    print("THIS SHOULD NEVER BE PRINTED!");
    52 }
    54 while (true) {
    55     break;
    56     if (true) { 
    57 	var s; 
    58     }
    59 }
    61 print("s = "+s);
    63 print("u = "+u);
    64 for ( ; ; ) {
    65     break;
    66     while (true) {
    67 	do {
    68 	    var u;
    69 	} while (true);
    70     }    
    71 }
    73 function terminal() {
    74     print("r = "+r);
    75     print("t = "+t);
    76     for (;;) {
    77 	var r;
    78 	return;
    79 	var t;
    80 	print("THIS SHOULD NEVER BE PRINTED!");
    81     }
    82     print("NEITHER SHOULD THIS");
    83 }
    85 terminal();
    87 function terminal2() {
    88     print("q = "+q);
    89     for (;;) {
    90 	return;
    91 	print("THIS SHOULD NEVER BE PRINTED!");
    92     }
    93     print("NEITHER SHOULD THIS");
    94 }
    96 try { 
    97     terminal2();
    98 } catch (e) {
    99     print(e);
   100 }
   102 function scope2() {
   103     var b = 10;
   104     print("b = "+b);
   105 }
   107 scope2();
   109 try {
   110     print("b is = "+b);
   111 }  catch (e) {
   112     print(e);
   113 }
   116 function disp_a() {
   117     var a = 20;
   118     print("Value of 'a' inside the function " + a);
   119 }
   121 var a = 10;
   123 disp_a();
   125 print("Value of 'a' outside the function " + a);

mercurial