nashorn/test/script/basic/evalreturn.js
changeset 31193 f019295fdeb3
parent 24778 2ff5d7041566
equal deleted inserted replaced
31192:1e019aeea9b5 31193:f019295fdeb3
    57     throw "error";
    57     throw "error";
    58 }
    58 }
    59 
    59 
    60 print("Scoping OK");
    60 print("Scoping OK");
    61 
    61 
    62 var f = eval("function cookie() { print('sweet and crunchy!'); } function cake() { print('moist and delicious!'); }");
    62 // According to the spec, evaluation of function declarations should not return a value,
       
    63 // but we return values of anonymous function declarations (Nashorn extension).
       
    64 var e = eval("function cookie() { print('sweet and crunchy!'); } function cake() { print('moist and delicious!'); }");
       
    65 print(e);
       
    66 var f = eval("function cookie() { print('sweet and crunchy!'); } function() { print('moist and delicious!'); }");
    63 print(f);
    67 print(f);
    64 f();
    68 f();
    65 var g = eval("function cake() { print('moist and delicious!'); } function cookie() { print('sweet and crunchy!'); }");
    69 var g = eval("function cake() { print('moist and delicious!'); } function() { print('sweet and crunchy!'); }");
    66 print(g);
    70 print(g);
    67 g();
    71 g();
    68 
    72 
    69 
    73 
    70 
    74