Skip to content

Conversation

@aspeddro
Copy link
Collaborator

@aspeddro aspeddro commented Sep 13, 2022

Currently the following code is parsed as a call_expression. Actually this is destructuring modules https://rescript-lang.org/docs/manual/latest/module#destructuring-modules

let {baz, _} = module(User.Inner)

Before:

(source_file [0, 0] - [1, 0]
  (let_binding [0, 0] - [0, 33]
    (record_pattern [0, 4] - [0, 12]
      (value_identifier [0, 5] - [0, 8])
      (value_identifier [0, 10] - [0, 11]))
    (call_expression [0, 15] - [0, 33]
      function: (value_identifier [0, 15] - [0, 21])
      arguments: (arguments [0, 21] - [0, 33]
        (variant [0, 22] - [0, 32]
          (nested_variant_identifier [0, 22] - [0, 32]
            (module_identifier [0, 22] - [0, 26])
            (variant_identifier [0, 27] - [0, 32])))))))

After:

let_binding [0, 0] - [0, 33]
  record_pattern [0, 4] - [0, 12]
    value_identifier [0, 5] - [0, 8]
    value_identifier [0, 10] - [0, 11]
  module_destructuring_expression [0, 15] - [0, 33]
    module_identifier_path [0, 22] - [0, 32]
      module_identifier [0, 22] - [0, 26]
      module_identifier [0, 27] - [0, 32]

@nkrkv
Copy link
Collaborator

nkrkv commented Sep 13, 2022

Great, thank you!

@nkrkv nkrkv merged commit 4282bfa into rescript-lang:main Sep 13, 2022
@aspeddro aspeddro deleted the module-destructuring branch September 18, 2022 02:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants