callee_escape2.js 754 B

1234567891011121314151617181920212223242526272829303132
  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 glo;
  6. var doEscape = false;
  7. function test(param)
  8. {
  9. function nested()
  10. {
  11. escape();
  12. return param;
  13. }
  14. function escape()
  15. {
  16. if (doEscape && !glo)
  17. glo = arguments.callee.caller;
  18. }
  19. nested();
  20. }
  21. test("test3");
  22. test("test2"); // JIT
  23. doEscape = true;
  24. test("test1"); // box
  25. WScript.Echo(glo());