blue_102584_2.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. // bailout on implicit call for CoerseRegex
  6. var i;
  7. function test0(a) {
  8. var x = 0;
  9. for(i = 0;i < 4;i++) {
  10. x += "".match({});
  11. x += a[i];
  12. }
  13. return x;
  14. };
  15. function test1(a) {
  16. var x = 0;
  17. for(i = 0;i < 4;i++) {
  18. x += /a/.exec({});
  19. x += a[i];
  20. }
  21. return x;
  22. };
  23. function test2(a) {
  24. var x = 0;
  25. for(i = 0;i < 4;i++) {
  26. x += "".replace({}, "a");
  27. x += a[i];
  28. }
  29. return x;
  30. };
  31. var arr = [1,2,3,4,5,6];
  32. test0(arr);
  33. test1(arr);
  34. test2(arr);
  35. Object.prototype.toString = function(x) { WScript.Echo("implicit" + i); return ""; }
  36. test0(arr);
  37. test1(arr);
  38. test2(arr);