From 04c67da5b455416c71fe9bc4c70fe61ceb7aad79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Tue, 16 Aug 2016 14:19:59 +0200 Subject: erl_internal: Add add_predefined_functions/1 The sys_pre_expand module used to do a lot more (translate records and funs, for example), but now it does very little. Most of the code is an identify transformation of the abstract format. The identity transformation part of the code must be maintained and kept correct when new forms are added to the abstract format. That adds to the maintance burden. It also adds (slightly) to compilation times. Therefore, we want to eliminate sys_pre_expand, moving all of its (non-identity) transformations to better places. As a preliminary first step, move the code that adds the pre-defined functions (such as module_info/0) to a new function in erl_internal. --- lib/stdlib/doc/src/erl_internal.xml | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib/stdlib/doc') diff --git a/lib/stdlib/doc/src/erl_internal.xml b/lib/stdlib/doc/src/erl_internal.xml index cf49df0972..17cd0fb240 100644 --- a/lib/stdlib/doc/src/erl_internal.xml +++ b/lib/stdlib/doc/src/erl_internal.xml @@ -43,6 +43,16 @@ + + + Add code for pre-defined functions. + +

Adds to Forms the code for the standard + pre-defined functions (such as module_info/0) that are + to be included in every module.

+
+
+ Test for an arithmetic operator. -- cgit v1.2.3 From 44c5d0a729387273a604f687fa2a9d50989f87d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Wed, 24 Aug 2016 14:09:46 +0200 Subject: Teach erl_expand_records to translate module-less calls As the next step in eliminating sys_pre_expand, teach erl_expand_records to handle calls without explicit module name. If such call refer to a BIF or imported function, add an explicit module name. That means that any subsequent pass will know that a call without a module name is always to a local function defined in the module. --- lib/stdlib/doc/src/erl_expand_records.xml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/stdlib/doc') diff --git a/lib/stdlib/doc/src/erl_expand_records.xml b/lib/stdlib/doc/src/erl_expand_records.xml index 7e4aa2db37..b6aa75ed03 100644 --- a/lib/stdlib/doc/src/erl_expand_records.xml +++ b/lib/stdlib/doc/src/erl_expand_records.xml @@ -45,8 +45,10 @@ Expand all records in a module. -

Expands all records in a module. The returned module has no - references to records, attributes, or code.

+

Expands all records in a module to use explicit tuple + operations and adds explicit module names to calls to BIFs and + imported functions. The returned module has no references to + records, attributes, or code.

-- cgit v1.2.3