Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: Nested import declarations #646

Closed
wants to merge 8 commits into from

Commits on Jul 24, 2016

  1. Support CreateImportBinding for all declarative Environment Records.

    Previously, CreateImportBinding was only supported for module Environment
    Records. Supporting the CreateImportBinding method for declarative
    Environment Records will be important for nested |ImportDeclaration|s,
    since the declarative Environment Record for the nested block containing
    the |ImportDeclaration| will need to allow indirect bindings, too.
    
    Because declarative Environment Records may now have indirect bindings,
    the GetBindingValue method of declarative Environment Records now fully
    incorporates the logic of the GetBindingValue method of module Environment
    Records, and so the module-specific method has been removed.
    benjamn committed Jul 24, 2016
    Configuration menu
    Copy the full SHA
    2ac6e23 View commit details
    Browse the repository at this point in the history

Commits on Jul 25, 2016

  1. Make StatementListItem (instead of ModuleItem) produce ImportDeclarat…

    …ion.
    
    This change means |ImportDeclaration|s are no longer grammatically
    restricted to the top level of a module.
    
    It also means |ImportDeclaration|s are no longer grammatically restricted
    to |Module|s, and could potentially appear in |Script|s, which is a
    problem to be addressed in a follow-up commit.
    benjamn committed Jul 25, 2016
    Configuration menu
    Copy the full SHA
    e5f7acf View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    3a4faa7 View commit details
    Browse the repository at this point in the history
  3. Use CreateLexicalBindings for modules, functions, and blocks.

    Note that this change allows functions and blocks to define bindings for
    |ImportDeclaration|s, which was not previously possible.
    
    After this change, the [[ImportEntries]] field of Module Record is no
    longer used anywhere in this specification.
    benjamn committed Jul 25, 2016
    Configuration menu
    Copy the full SHA
    c4da2ad View commit details
    Browse the repository at this point in the history
  4. Remove unused [[ImportEntries]] field of Source Text Module Record.

    The top-level ImportEntries of a module are now extracted as part of the
    CreateLexicalBindings operation, based on the top-level
    LexicallyScopedDeclarations of the module, which now include
    |ImportDeclaration| productions in addition to other lexically scoped
    declarations like function/generator declarations and let/const variable
    declarations.
    
    Though it is possible that another specification might depend on this
    field, the only relevant specification that I'm aware of is the WHATWG
    Loader spec (https://whatwg.github.io/loader), and while it refers to the
    Source Text Module Record in many places, it never makes use of the
    [[ImportEntries]] field.
    
    Moreover, I think we should remove this field now rather than allowing it
    to persist, because any hypothetical auxiliary specification that relies
    on [[ImportEntries]] is likely to be treating top-level import
    declarations differently from nested import declarations, and thus runs
    the risk of mishandling nested import declarations.
    benjamn committed Jul 25, 2016
    Configuration menu
    Copy the full SHA
    25cd2a8 View commit details
    Browse the repository at this point in the history
  5. Note why EvalDeclarationInstantiation does not call CreateLexicalBind…

    …ings.
    
    Unless this note is wrong, we do not have to worry about import
    declarations in eval strings, which is good news because it would be
    impossible to determine statically what module identifiers are requested
    by a dynamic string of code.
    benjamn committed Jul 25, 2016
    Configuration menu
    Copy the full SHA
    f468a4f View commit details
    Browse the repository at this point in the history
  6. Define and use an abstract operation called EvaluateRequestedModules.

    This change means nested modules will be evaluated at the beginning of
    their enclosing blocks, if they have not already been evaluated.
    benjamn committed Jul 25, 2016
    Configuration menu
    Copy the full SHA
    ca0949b View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    0d578e5 View commit details
    Browse the repository at this point in the history