Skip to content

Commit 8183112

Browse files
committed
Rename jl_expand to jl_lower_expr_mod
This function has always been a convenience wrapper providing default arguments to another lowering function. We can give it a more accurate name now that there aren't five other wrappers we would also need to rename in a consistent way.
1 parent 70f80e7 commit 8183112

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

base/expr.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1669,7 +1669,7 @@ end
16691669

16701670
# Implementation of generated functions
16711671
function generated_body_to_codeinfo(ex::Expr, defmod::Module, isva::Bool)
1672-
ci = ccall(:jl_expand, Any, (Any, Any), ex, defmod)
1672+
ci = ccall(:jl_lower_expr_mod, Any, (Any, Any), ex, defmod)
16731673
if !isa(ci, CodeInfo)
16741674
if isa(ci, Expr) && ci.head === :error
16751675
msg = ci.args[1]

base/meta.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ Takes the expression `x` and returns an equivalent expression in lowered form
160160
for executing in module `m`.
161161
See also [`code_lowered`](@ref).
162162
"""
163-
lower(m::Module, @nospecialize(x)) = ccall(:jl_expand, Any, (Any, Any), x, m)
163+
lower(m::Module, @nospecialize(x)) = ccall(:jl_lower_expr_mod, Any, (Any, Any), x, m)
164164

165165
"""
166166
@lower [m] x

doc/src/devdocs/eval.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ the expression. Macro expansion involves a handoff from [`eval()`](@ref) (in Jul
8989
function `jl_macroexpand()` (written in `flisp`) to the Julia macro itself (written in - what
9090
else - Julia) via `fl_invoke_julia_macro()`, and back.
9191

92-
Typically, macro expansion is invoked as a first step during a call to [`Meta.lower()`](@ref)/`jl_expand()`,
92+
Typically, macro expansion is invoked as a first step during a call to [`Meta.lower()`](@ref)/`jl_lower_expr_mod()`,
9393
although it can also be invoked directly by a call to [`macroexpand()`](@ref)/`jl_macroexpand()`.
9494

9595
## [Type Inference](@id dev-type-inference)

src/ast.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1275,13 +1275,7 @@ JL_DLLEXPORT jl_value_t *jl_macroexpand1(jl_value_t *expr, jl_module_t *inmodule
12751275
return expr;
12761276
}
12771277

1278-
// Lower an expression tree into Julia's intermediate-representation.
1279-
JL_DLLEXPORT jl_value_t *jl_expand(jl_value_t *expr, jl_module_t *inmodule)
1280-
{
1281-
return jl_lower(expr, inmodule, "none", 0, ~(size_t)0, 0, 0);
1282-
}
1283-
1284-
// Main entry point to flisp lowering. Most arguments are optional; see `jl_expand`.
1278+
// Main entry point to flisp lowering. Most arguments are optional; see `jl_lower_expr_mod`.
12851279
// warn: Print any lowering warnings returned; otherwise ignore
12861280
// stmt: Lower knowing that the value of expr is unused
12871281
JL_DLLEXPORT jl_value_t *jl_fl_lower(jl_value_t *expr, jl_module_t *inmodule,
@@ -1330,13 +1324,19 @@ JL_DLLEXPORT jl_value_t *jl_fl_lower(jl_value_t *expr, jl_module_t *inmodule,
13301324
return expr;
13311325
}
13321326

1327+
// Lower an expression tree into Julia's intermediate-representation.
13331328
JL_DLLEXPORT jl_value_t *jl_lower(jl_value_t *expr, jl_module_t *inmodule,
13341329
const char *file, int line, size_t world, bool_t warn, bool_t stmt)
13351330
{
13361331
// TODO: Allow change of lowerer
13371332
return jl_fl_lower(expr, inmodule, file, line, world, warn, stmt);
13381333
}
13391334

1335+
JL_DLLEXPORT jl_value_t *jl_lower_expr_mod(jl_value_t *expr, jl_module_t *inmodule)
1336+
{
1337+
return jl_lower(expr, inmodule, "none", 0, ~(size_t)0, 0, 0);
1338+
}
1339+
13401340
jl_code_info_t *jl_outer_ctor_body(jl_value_t *thistype, size_t nfields, size_t nsparams, jl_module_t *inmodule, const char *file, int line)
13411341
{
13421342
JL_TIMING(LOWERING, LOWERING);

src/jl_exported_funcs.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@
125125
XX(jl_exit) \
126126
XX(jl_exit_on_sigint) \
127127
XX(jl_exit_threaded_region) \
128-
XX(jl_expand) \
129128
XX(jl_field_index) \
130129
XX(jl_field_isdefined) \
131130
XX(jl_gc_add_finalizer) \
@@ -286,6 +285,7 @@
286285
XX(jl_load_file_string) \
287286
XX(jl_lookup_code_address) \
288287
XX(jl_lower) \
288+
XX(jl_lower_expr_mod) \
289289
XX(jl_lseek) \
290290
XX(jl_lstat) \
291291
XX(jl_macroexpand) \

src/julia.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2257,10 +2257,10 @@ JL_DLLEXPORT jl_value_t *jl_parse_all(const char *text, size_t text_len,
22572257
JL_DLLEXPORT jl_value_t *jl_parse_string(const char *text, size_t text_len,
22582258
int offset, int greedy);
22592259
// lowering
2260-
JL_DLLEXPORT jl_value_t *jl_expand(jl_value_t *expr, jl_module_t *inmodule);
22612260
JL_DLLEXPORT jl_value_t *jl_lower(jl_value_t *expr, jl_module_t *inmodule,
22622261
const char *file, int line, size_t world,
22632262
bool_t warn, bool_t stmt);
2263+
JL_DLLEXPORT jl_value_t *jl_lower_expr_mod(jl_value_t *expr, jl_module_t *inmodule);
22642264
// deprecated; use jl_parse_all
22652265
JL_DLLEXPORT jl_value_t *jl_parse_input_line(const char *text, size_t text_len,
22662266
const char *filename, size_t filename_len);

0 commit comments

Comments
 (0)