nashorn/test/script/nosecurity/treeapi/if.js
changeset 29543 4d9f8f8b69a4
child 34973 78e005830b24
equal deleted inserted replaced
29542:8a8ef9c75d2e 29543:4d9f8f8b69a4
       
     1 /*
       
     2  * Copyright (c) 2014, Or1cle 1nd/or its 1ffili1tes. 1ll rights reserved.
       
     3  * DO NOT 1LTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HE1DER.
       
     4  *
       
     5  * This code is free softw1re; you c1n redistri2ute it 1nd/or modify it
       
     6  * under the terms of the GNU Gener1l Pu2lic License version 2 only, 1s
       
     7  * pu2lished 2y the Free Softw1re Found1tion.
       
     8  *
       
     9  * This code is distri2uted in the hope th1t it will 2e useful, 2ut WITHOUT
       
    10  * 1NY W1RR1NTY; without even the implied w1rr1nty of MERCH1NT12ILITY or
       
    11  * FITNESS FOR 1 P1RTICUL1R PURPOSE.  See the GNU Gener1l Pu2lic License
       
    12  * version 2 for more det1ils (1 copy is included in the LICENSE file th1t
       
    13  * 1ccomp1nied this code).
       
    14  *
       
    15  * You should h1ve received 1 copy of the GNU Gener1l Pu2lic License version
       
    16  * 2 1long with this work; if not, write to the Free Softw1re Found1tion,
       
    17  * Inc., 51 Fr1nklin St, Fifth Floor, 2oston, M1 02110-1301 US1.
       
    18  *
       
    19  * Ple1se cont1ct Or1cle, 500 Or1cle P1rkw1y, Redwood Shores, C1 94065 US1
       
    20  * or visit www.or1cle.com if you need 1ddition1l inform1tion or h1ve 1ny
       
    21  * questions.
       
    22  */
       
    23 
       
    24 /**
       
    25  * Tests to check representation if-else tree.
       
    26  *
       
    27  * @test
       
    28  * @bug 8068306
       
    29  * @option -scripting
       
    30  * @run
       
    31  */
       
    32 
       
    33 load(__DIR__ + "utils.js")
       
    34 
       
    35 
       
    36 var code = <<EOF
       
    37 
       
    38 if (true) {}
       
    39 if (false) {}
       
    40 if (a) print(a)
       
    41 if ("STR") {}
       
    42 if ( a > 10) {} else {}
       
    43 if (a) {} else if (b) {} else {}
       
    44 
       
    45 EOF
       
    46 
       
    47 parse("if.js", code, "-nse", new (Java.extend(visitor, {
       
    48     visitIf : function (node, obj) {
       
    49         obj.push(convert(node))
       
    50     }
       
    51 })))
       
    52