deadstore_field.js 654 B

1234567891011121314151617181920212223242526
  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 func()
  6. {
  7. WScript.Echo(i);
  8. }
  9. var i;
  10. i = 0; // dead store
  11. i = 1;
  12. WScript.Echo(i);
  13. i = 0; // no deadstore
  14. func();
  15. i = 1;
  16. WScript.Echo(i);
  17. i = 0; // no deadstore
  18. var obj = this;
  19. var j = obj.i;
  20. obj.i = -1;
  21. i = 1; // no deadstore
  22. WScript.Echo(i);