test103.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. // -maxinterpretcount:1 -off:objtypespec
  6. function test0(o2) {
  7. var o = {};
  8. var a = [1];
  9. var sum = a[0];
  10. sum += a[0];
  11. o.a = a;
  12. if(!o2)
  13. o.a = [];
  14. o2.b = a;
  15. var b = o.a;
  16. b[0] = 2;
  17. sum += b[0];
  18. return sum;
  19. }
  20. var o2 = {};
  21. Object.defineProperty(
  22. o2,
  23. "b",
  24. {
  25. configurable: true,
  26. enumerable: true,
  27. set: function(a) {
  28. Object.defineProperty(
  29. a,
  30. "0",
  31. {
  32. configurable: true,
  33. enumerable: true,
  34. writable: false,
  35. value: 999
  36. });
  37. }
  38. });
  39. WScript.Echo(test0({}));
  40. WScript.Echo(test0(o2));
  41. // -maxinterpretcount:1 -off:objtypespec
  42. function test1() {
  43. test1a({ p: 2 }, { p2: 0 }, 0);
  44. var o = { p: 2 };
  45. var o2 = {};
  46. Object.defineProperty(
  47. o2,
  48. 'p2',
  49. {
  50. configurable: true,
  51. enumerable: true,
  52. set: function() {
  53. o.p = 2;
  54. }
  55. });
  56. test1a(o, o2, 0);
  57. function test1a(o, o2, b) {
  58. o.p = true;
  59. if(b)
  60. o.p = true;
  61. o2.p2 = o2;
  62. return o.p >>> 2147483647;
  63. }
  64. };
  65. test1();