inlineLocalCacheWithoutProperty.js 831 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. function test0() {
  6. function getp(o) {
  7. return o.p;
  8. }
  9. function setp(o) {
  10. o.p = 1;
  11. }
  12. function c1() { }
  13. c1.prototype = { p: 0 };
  14. function c2() { }
  15. var p1 = new c1();
  16. c2.prototype = p1;
  17. var o = new c2();
  18. var ptemp = new c1();
  19. c2.prototype = ptemp;
  20. var p2 = new c2();
  21. setp(ptemp);
  22. WScript.Echo(getp(o));
  23. setp(p1);
  24. WScript.Echo(getp(o));
  25. }
  26. test0();