evalThisNested.js 844 B

123456789101112131415161718192021222324252627282930313233343536
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. var echo = WScript.Echo;
  6. function top1() {
  7. "use strict";
  8. function nested1() {
  9. echo(this);
  10. }
  11. echo(this);
  12. eval("nested1();");
  13. }
  14. function top2() {
  15. function nested2() {
  16. "use strict";
  17. echo(this);
  18. }
  19. echo(this);
  20. eval("nested2();");
  21. }
  22. function top3() {
  23. function nested3() {
  24. echo(this);
  25. }
  26. echo(this);
  27. eval("'use strict'; nested3();");
  28. }
  29. top1();
  30. top2();
  31. top3();