| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- //-------------------------------------------------------------------------------------------------------
- // Copyright (C) Microsoft. All rights reserved.
- // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
- //-------------------------------------------------------------------------------------------------------
- function write(x) { WScript.Echo(x); }
- // var after let at function scope should be redeclaration error
- try {
- eval(
- "(function () {" +
- " let x = 'let x';" +
- " var x = 'redeclaration error';" +
- " write(x);" +
- "})();"
- );
- } catch (e) {
- write(e);
- }
- // var after let in non-function block scope should be valid;
- // var declaration should reassing let bound symbol, but should
- // also introduce function scoped variable, initialized to undefined
- // (Make sure there is no difference whether the let binding is used
- // or not before the var declaration)
- // (Blue bug 145660)
- try {
- eval(
- "(function () {" +
- " {" +
- " let x = 'let x';" +
- " var x = 'var x';" +
- " write(x);" +
- " }" +
- " write(x);" +
- " {" +
- " let y = 'let y';" +
- " write(y);" +
- " var y = 'var y';" +
- " write(y);" +
- " }" +
- " write(y);" +
- "})();"
- );
- } catch (e) {
- write(e);
- }
- // var before let in non-function block scope should raise a
- // Use Berfore Declaration error.
- try {
- eval(
- "(function () {" +
- " {" +
- " var x = 'var x';" +
- " let x = 'let x';" +
- " write(x);" +
- " }" +
- " write(x);" +
- "})();"
- );
- } catch (e) {
- write(e);
- }
|