rhino1.7.7.testsrc.tests.js1_7.block.regress-343765.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rhino Show documentation
Show all versions of rhino Show documentation
Rhino is an open-source implementation of JavaScript written entirely in Java. It is typically
embedded into Java applications to provide scripting to end users.
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
var gTestfile = 'regress-343765.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 343765;
var summary = 'Function defined in a let statement/expression does not work correctly outside the let scope';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
print("SECTION 1");
try {
let (a = 2, b = 3) { function f() { return String([a,b]); } f(); throw 42; }
} catch (e) {
f();
}
reportCompare(expect, actual, summary);
print("SECTION 2");
try {
with ({a:2,b:3}) { function f() { return String([a,b]); } f(); throw 42; }
} catch (e) {
f();
}
print("SECTION 3");
function g3() {
print("Here!");
with ({a:2,b:3}) {
function f() {
return String([a,b]);
}
f();
return f;
}
}
k = g3();
k();
print("SECTION 4");
function g4() {
print("Here!");
let (a=2,b=3) {
function f() {
return String([a,b]);
}
f();
return f;
}
}
k = g4();
k();
print("SECTION 5");
function g5() {
print("Here!");
let (a=2,b=3) {
function f() {
return String([a,b]);
}
f();
yield f;
}
}
k = g5().next();
k();
reportCompare(expect, actual, summary);
exitFunc ('test');
}
function returnResult(a)
{
return a + '';
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy