|
354 | 354 | const specialize_method = Core.Compiler.specialize_method
|
355 | 355 | end
|
356 | 356 |
|
357 |
| -function prepare_framecode(method::Method, argtypes; enter_generated=false) |
| 357 | +function prepare_framecode(method::Method, @nospecialize(argtypes); enter_generated=false) |
358 | 358 | sig = method.sig
|
359 | 359 | if method.module == Core.Compiler || method.module == Base.Threads || method ∈ compiled_methods
|
360 | 360 | return Compiled()
|
|
485 | 485 | Prepare `expr` for evaluation in `mod`. `expr` should be a "straightforward" expression,
|
486 | 486 | one that does not require special top-level handling (see [`JuliaInterpreter.split_expressions`](@ref)).
|
487 | 487 | """
|
488 |
| -function prepare_thunk(mod::Module, thunk::Expr, recursive=false) |
| 488 | +function prepare_thunk(mod::Module, thunk::Expr, recursive::Bool=false) |
489 | 489 | if isexpr(thunk, :thunk)
|
490 | 490 | framecode = JuliaFrameCode(mod, thunk.args[1])
|
491 | 491 | elseif isexpr(thunk, :error) || isexpr(thunk, :incomplete)
|
@@ -1038,22 +1038,18 @@ end
|
1038 | 1038 |
|
1039 | 1039 | lower(mod, arg) = false ? expand(arg) : Meta.lower(mod, arg)
|
1040 | 1040 |
|
1041 |
| -# This is a version of gen_call_with_extracted_types, except that is passes back the call expression |
1042 |
| -# for further processing. |
| 1041 | +separate_kwargs(args...; kwargs...) = (args, kwargs.data) |
| 1042 | + |
| 1043 | +# This is a version of InteractiveUtils.gen_call_with_extracted_types, except that is passes back the |
| 1044 | +# call expression for further processing. |
1043 | 1045 | function extract_args(__module__, ex0)
|
1044 | 1046 | if isa(ex0, Expr)
|
1045 |
| - kws = collect(filter(x->isexpr(x,:kw),ex0.args)) |
1046 |
| - if !isempty(kws) |
1047 |
| - names = [] |
1048 |
| - values = Tuple(map(x-> begin |
1049 |
| - push!(names,x.args[1]) |
1050 |
| - x.args[2] |
1051 |
| - end,kws)) |
1052 |
| - names = Tuple(names) |
1053 |
| - return Expr(:tuple,:(Core.kwfunc($(ex0.args[1]))), |
1054 |
| - Expr(:call, NamedTuple{names,typeof(values)}, values), |
1055 |
| - map(x->isexpr(x, :parameters) ? QuoteNode(x) : x, |
1056 |
| - filter(x->!isexpr(x, :kw),ex0.args))...) |
| 1047 | + if any(a->(Meta.isexpr(a, :kw) || Meta.isexpr(a, :parameters)), ex0.args) |
| 1048 | + return quote |
| 1049 | + local arg1 = $(ex0.args[1]) |
| 1050 | + local args, kwargs = $separate_kwargs($(ex0.args[2:end]...)) |
| 1051 | + tuple(Core.kwfunc(arg1), kwargs, arg1, args...) |
| 1052 | + end |
1057 | 1053 | elseif ex0.head == :.
|
1058 | 1054 | return Expr(:tuple, :getproperty, ex0.args...)
|
1059 | 1055 | elseif ex0.head == :(<:)
|
|
0 commit comments