cse2.js 872 B

12345678910111213141516171819202122232425262728293031
  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. function foo(arg1, arg2, arg3, arg4) {
  6. var y = 1;
  7. if (arg3) {
  8. Object.defineProperty(arg1, arg4, getProp);
  9. }
  10. y = arg1[arg4];
  11. if (arg3)
  12. y = arg1[arg4];
  13. return y;
  14. }
  15. o1 = { "prop4": 4 };
  16. var count = 0;
  17. for (var i = 0; i < 200; i++) {
  18. foo(o1, "text", false, "prop4");
  19. }
  20. var getProp = { get: function () { return count++; } };
  21. if (foo(o1, "text", true, "prop4") != 1)
  22. WScript.Echo("FAILED");
  23. else
  24. WScript.Echo("Passed");