Skip to content

Commit a8aa478

Browse files
committed
Add nkw meta to keyword function bodies
1 parent bd6b7bb commit a8aa478

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

src/desugaring.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2684,7 +2684,12 @@ function keyword_function_defs(ctx, srcref, callex_srcref, name_str,
26842684
[K"block"
26852685
# TODO: nkw
26862686
method_def_expr(ctx, srcref, callex_srcref, "nothing"::K"core",
2687-
typevar_names, body_arg_names, body_arg_types, body, ret_var)
2687+
typevar_names, body_arg_names, body_arg_types,
2688+
[K"block"
2689+
[K"meta" "nkw"::K"Symbol" numchildren(keywords)::K"Integer"]
2690+
body
2691+
],
2692+
ret_var)
26882693
]
26892694
]
26902695
[K"method_defs"

test/functions_ir.jl

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -991,8 +991,9 @@ end
991991
14 (call core.svec %₁₁ %₁₂ %₁₃)
992992
15 --- method core.nothing %₁₄
993993
slots: [slot₁/#self#(!read) slot₂/x slot₃/y slot₄/#self#(!read) slot₅/a slot₆/b]
994-
1 (call core.tuple slot₅/a slot₆/b slot₂/x slot₃/y)
995-
2 (return %₁)
994+
1 (meta :nkw 2)
995+
2 (call core.tuple slot₅/a slot₆/b slot₂/x slot₃/y)
996+
3 (return %₂)
996997
16 (call core.typeof core.kwcall)
997998
17 TestMod.f_kw_simple
998999
18 (call core.Typeof %₁₇)
@@ -1123,8 +1124,9 @@ end
11231124
11 (call core.svec %%%₁₀)
11241125
12 --- method core.nothing %₁₁
11251126
slots: [slot₁/#self#(!read) slot₂/all_kws slot₃/#self#(!read)]
1126-
1 slot₂/all_kws
1127-
2 (return %₁)
1127+
1 (meta :nkw 1)
1128+
2 slot₂/all_kws
1129+
3 (return %₂)
11281130
13 (call core.typeof core.kwcall)
11291131
14 TestMod.f_kw_slurp_simple
11301132
15 (call core.Typeof %₁₄)
@@ -1174,8 +1176,9 @@ end
11741176
11 (call core.svec %%%₁₀)
11751177
12 --- method core.nothing %₁₁
11761178
slots: [slot₁/#self#(!read) slot₂/x(!read) slot₃/non_x_kws(!read) slot₄/#self#(!read)]
1177-
1 TestMod.all_kws
1178-
2 (return %₁)
1179+
1 (meta :nkw 2)
1180+
2 TestMod.all_kws
1181+
3 (return %₂)
11791182
13 (call core.typeof core.kwcall)
11801183
14 TestMod.f_kw_slurp
11811184
15 (call core.Typeof %₁₄)
@@ -1248,10 +1251,11 @@ end
12481251
17 (call core.svec %₁₂ %₁₅ %₁₆)
12491252
18 --- method core.nothing %₁₇
12501253
slots: [slot₁/#self#(!read) slot₂/a(!read) slot₃/b(!read) slot₄/#self#(!read) slot₅/x(!read)]
1251-
1 static_parameter₁
1252-
2 static_parameter₂
1253-
3 (call core.tuple %%₂)
1254-
4 (return %₃)
1254+
1 (meta :nkw 2)
1255+
2 static_parameter₁
1256+
3 static_parameter₂
1257+
4 (call core.tuple %%₃)
1258+
5 (return %₄)
12551259
19 (call core.typeof core.kwcall)
12561260
20 TestMod.f_kw_sparams
12571261
21 (call core.Typeof %₂₀)

0 commit comments

Comments
 (0)