implicit_nosideeffect.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 print(s) {}
  6. function f(a) {
  7. for (var vxmvvw = 0; vxmvvw < 1; ++vxmvvw) { if (vxmvvw % 10 == 3) { print(x); } else
  8. { ( eval('"" <<= a') ); } }
  9. }
  10. function Ctor()
  11. {
  12. }
  13. Ctor.prototype.toString = Number.prototype.toString;
  14. try { f(new Ctor()); } catch (e) { WScript.Echo(e); }
  15. Ctor.prototype.toString = RegExp.prototype.toString;
  16. try { f(new Ctor()); } catch (e) { WScript.Echo(e); }
  17. Ctor.prototype.toString = Function.prototype.toString;
  18. try { f(new Ctor()); } catch (e) { WScript.Echo(e); }
  19. Ctor.prototype.toString = Object.prototype.toString;
  20. try { f(new Ctor()); } catch (e) { WScript.Echo(e); }
  21. Ctor.prototype.toString = Error.prototype.toString;
  22. try { f(new Ctor()); } catch (e) { WScript.Echo(e); }
  23. Ctor.prototype.toString = Boolean.prototype.toString;
  24. try { f(new Ctor()); } catch (e) { WScript.Echo(e); }
  25. Ctor.prototype.toString = Array.prototype.toString;
  26. try { f(new Ctor()); } catch (e) { WScript.Echo(e); }
  27. Ctor.prototype.toString = String.prototype.toString;
  28. try { f(new Ctor()); } catch (e) { WScript.Echo(e); }
  29. Ctor.prototype.toString = Date.prototype.toString;
  30. try { f(new Ctor()); } catch (e) { WScript.Echo(e); }
  31. Ctor.prototype = new Object();
  32. Ctor.prototype.valueOf = Boolean.prototype.valueOf;
  33. try { f(new Ctor()); } catch (e) { WScript.Echo(e); }
  34. Ctor.prototype.valueOf = Date.prototype.valueOf;
  35. try { f(new Ctor()); } catch (e) { WScript.Echo(e); }
  36. Ctor.prototype.valueOf = Number.prototype.valueOf;
  37. try { f(new Ctor()); } catch (e) { WScript.Echo(e); }
  38. Ctor.prototype.valueOf = Object.prototype.valueOf;
  39. try { f(new Ctor()); } catch (e) { WScript.Echo(e); }
  40. Ctor.prototype.valueOf = String.prototype.valueOf;
  41. try { f(new Ctor()); } catch (e) { WScript.Echo(e); }