accessing-lex-import-before-decl.mjs 639 B

1234567891011121314151617181920212223
  1. let passed = true;
  2. try {
  3. importedLexVariable;
  4. passed = false;
  5. } catch (e) {
  6. if (!(e instanceof ReferenceError))
  7. throw new Error("Expected importedLexVariable; to throw ReferenceError got " + e);
  8. }
  9. try {
  10. // Even though value is let, this should still throw TypeError because it is immutable!
  11. importedLexVariable = 0;
  12. passed = false;
  13. } catch (e) {
  14. if (!(e instanceof TypeError))
  15. throw new Error("Expected importedLexVariable = 0; to throw TypeError got " + e);
  16. }
  17. import { value as importedLexVariable } from "./accessing-lex-import-before-decl.mjs";
  18. export let value = 123;
  19. export { passed };