simple_namedstackfunc.js 704 B

123456789101112131415161718192021222324
  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 o = {}
  6. function test()
  7. {
  8. var i = 0;
  9. function simple_stackfunc() // this can be stack allocated
  10. {
  11. if (i == 0)
  12. {
  13. i++;
  14. return simple_stackfunc();
  15. }
  16. return i;
  17. }
  18. return simple_stackfunc();
  19. }
  20. WScript.Echo(test());
  21. WScript.Echo(test());