forked from erlang/otp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
stdlib: allow variables in record definitions
Create an init function e.g. rec_init$^0, for each record with definitions containing variables. This function is created for each module using the record. In the shell they will belong to the shell_default module. e.g. -record(r, {f = fun(X)->case X of {y, Y} -> Y; _ -> X end, g=..., h=abc}). foo(X)->\#r{}. --> foo(X)->('rec_init$^0'()){}. rec_init$^0() will initialize all fields with the default values. If fields are set and the omitted field default value has variables, then a new init function is created that only initializes the omitted fields. e.g. foo(X)->\#r{g=X}. --> foo(X)->('rec_init$^1()){g=X}. - Removes lint error for variables in definitions. - Updates erl_lint_SUITE and erl_expand_records_SUITE to work with this new behavior. - Adds handling of read records that are calling local functions to the shell. - Records with default values calling local non exported functions will not compile when the function is not available, the shell will be able to import it, but the local functions will have to be defined manually.
- Loading branch information
1 parent
02189f7
commit c7acd9a
Showing
8 changed files
with
227 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.