blob: 4e40813d55df2c5ee09d39a2c12a2de2c83cd1df [file] [log] [blame]
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
"use strict";
function write(v) { WScript.Echo(v + ""); }
function exceptToString(ee) {
if (ee instanceof TypeError) return "TypeError";
if (ee instanceof ReferenceError) return "ReferenceError";
if (ee instanceof EvalError) return "EvalError";
if (ee instanceof SyntaxError) return "SyntaxError";
return "Unknown Error";
}
(function Test1() {
var str = "catch stmt having arguments as identifier";
try {
eval("try {} catch (arguments) {}");
} catch (e) {
write("Exception: " + str + " " + exceptToString(e));
return;
}
write("Return: " + str);
})();
(function Test2() {
var str = "catch stmt having eval as identifier";
try {
eval("try {} catch (eval) {}");
} catch (e) {
write("Exception: " + str + " " + exceptToString(e));
return;
}
write("Return: " + str);
})();