default-splitscope-serialized.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. var f1 = (a = 10, b = function () { return a; }) => {
  6. if (a === 10) {
  7. print("PASSED");
  8. } else {
  9. print("FAILED");
  10. }
  11. var a = 20;
  12. if (a === 20) {
  13. print("PASSED");
  14. } else {
  15. print("FAILED");
  16. }
  17. return b;
  18. }
  19. if (f1()() === 10) {
  20. print("PASSED");
  21. } else {
  22. print("FAILED");
  23. }
  24. function f2(a = 10, b = function () { return a; }) {
  25. if (a === 10) {
  26. print("PASSED");
  27. } else {
  28. print("FAILED");
  29. }
  30. a = 20;
  31. if (a === 20) {
  32. print("PASSED");
  33. } else {
  34. print("FAILED");
  35. }
  36. return b;
  37. }
  38. if (f2()() === 20) {
  39. print("PASSED");
  40. } else {
  41. print("FAILED");
  42. }
  43. function f3(a = eval("10"), b = function () { return eval("a"); }) {
  44. if (a === 10) {
  45. print("PASSED");
  46. } else {
  47. print("FAILED");
  48. }
  49. var a = 20;
  50. if (a === 20) {
  51. print("PASSED");
  52. } else {
  53. print("FAILED");
  54. }
  55. return b;
  56. }
  57. if (f3()() === 10) {
  58. print("PASSED");
  59. } else {
  60. print("FAILED");
  61. }
  62. function f4(a = 10, b = function () { return eval("a"); }) {
  63. if (a === 10) {
  64. print("PASSED");
  65. } else {
  66. print("FAILED");
  67. }
  68. a = 20;
  69. if (a === 20) {
  70. print("PASSED");
  71. } else {
  72. print("FAILED");
  73. }
  74. return b;
  75. }
  76. if (f4()() === 20) {
  77. print("PASSED");
  78. } else {
  79. print("FAILED");
  80. }
  81. if ((({} = eval('')) => { return 10; })(1) === 10) {
  82. print("PASSED");
  83. }