anon-func-decl-default-export.mjs 614 B

1234567891011121314151617181920212223242526
  1. try {
  2. f();
  3. } catch (e) {
  4. if (!(e instanceof ReferenceError)) throw e;
  5. if (!e.message.includes("bindingUsedInFunction")) throw e;
  6. }
  7. let bindingUsedInFunction = 0;
  8. const immediateResult = f();
  9. const immediateName = f.name + "";
  10. import f from "./anon-func-decl-default-export.mjs";
  11. export default function () {
  12. return bindingUsedInFunction++;
  13. }
  14. const postImportResult = f();
  15. const postImportName = f.name + "";
  16. export const passed =
  17. immediateResult === 0 &&
  18. postImportResult === 1 &&
  19. bindingUsedInFunction === 2 &&
  20. immediateName === "default" &&
  21. postImportName === "default";