object_literal_bug.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. WScript.LoadScriptFile("..\\UnitTestFramework\\UnitTestFramework.js");
  6. var tests = [
  7. {
  8. name: "Object literal shorthand syntax with symbol lookup",
  9. body: function () {
  10. (function () {
  11. let a = 1;
  12. {
  13. let a = 2;
  14. var m = {a};
  15. assert.areEqual(m.a, 2, "Name node in object literal shorthand is binding correctly with inner block");
  16. }
  17. })();
  18. {
  19. let a2 = 1;
  20. ({a2} = {a2:2});
  21. assert.areEqual(a2, 2, "Destructuring object pattern : Name node in object literal shorthand is binding correctly with inner block");
  22. }
  23. {
  24. // Object literal shorthand - referenced in different scopoe works correctly.
  25. { d; }
  26. {
  27. { { d;} };
  28. var c = {d};
  29. }
  30. {
  31. var d = [];
  32. }
  33. }
  34. }
  35. }
  36. ];
  37. testRunner.runTests(tests, { verbose: WScript.Arguments[0] != "summary" });