Skip to content

Commit fef902d

Browse files
Merge pull request #86 from ArnoStrouwen/formatter
reapply formatter
2 parents 33271f4 + cf2b432 commit fef902d

File tree

4 files changed

+45
-44
lines changed

4 files changed

+45
-44
lines changed

.JuliaFormatter.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
style = "sciml"
2-
format_markdown = true
2+
format_markdown = true
3+
format_docstrings = true

docs/make.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ makedocs(sitename = "RuntimeGeneratedFunctions.jl",
1212
canonical = "https://docs.sciml.ai/RuntimeGeneratedFunctions/stable/"),
1313
pages = [
1414
"RuntimeGeneratedFunctions.jl: Efficient Staged Compilation" => "index.md",
15-
"API" => "api.md",
15+
"API" => "api.md"
1616
])
1717

1818
deploydocs(;

src/RuntimeGeneratedFunctions.jl

Lines changed: 42 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -67,27 +67,27 @@ struct RuntimeGeneratedFunction{argnames, cache_tag, context_tag, id, B} <: Func
6767

6868
# For internal use in deserialize() - doesen't check whether the body is in the cache!
6969
function RuntimeGeneratedFunction{
70-
argnames,
71-
cache_tag,
72-
context_tag,
73-
id,
70+
argnames,
71+
cache_tag,
72+
context_tag,
73+
id
7474
}(body) where {
75-
argnames,
76-
cache_tag,
77-
context_tag,
78-
id,
75+
argnames,
76+
cache_tag,
77+
context_tag,
78+
id
7979
}
8080
new{argnames, cache_tag, context_tag, id, typeof(body)}(body)
8181
end
8282
end
8383

8484
function drop_expr(::RuntimeGeneratedFunction{
85-
a,
86-
cache_tag,
87-
c,
88-
id,
85+
a,
86+
cache_tag,
87+
c,
88+
id
8989
}) where {a, cache_tag, c,
90-
id}
90+
id}
9191
# When dropping the reference to the body from an RGF, we need to upgrade
9292
# from a weak to a strong reference in the cache to prevent the body being
9393
# GC'd.
@@ -111,7 +111,7 @@ function _check_rgf_initialized(mods...)
111111
end
112112

113113
function RuntimeGeneratedFunction(cache_module::Module, context_module::Module, code;
114-
opaque_closures = true)
114+
opaque_closures = true)
115115
_check_rgf_initialized(cache_module, context_module)
116116
RuntimeGeneratedFunction(getfield(cache_module, _tagname),
117117
getfield(context_module, _tagname),
@@ -133,11 +133,11 @@ macro RuntimeGeneratedFunction(context_module, code, opaque_closures = true)
133133
end
134134

135135
function Base.show(io::IO, ::MIME"text/plain",
136-
f::RuntimeGeneratedFunction{argnames, cache_tag, context_tag, id}) where {
137-
argnames,
138-
cache_tag,
139-
context_tag,
140-
id,
136+
f::RuntimeGeneratedFunction{argnames, cache_tag, context_tag, id}) where {
137+
argnames,
138+
cache_tag,
139+
context_tag,
140+
id
141141
}
142142
cache_mod = parentmodule(cache_tag)
143143
context_mod = parentmodule(context_tag)
@@ -250,16 +250,17 @@ function init(mod)
250250
# or so. See:
251251
# https://github.com/JuliaLang/julia/pull/32902
252252
# https://github.com/NHDaly/StagedFunctions.jl/blob/master/src/StagedFunctions.jl#L30
253-
@inline @generated function $RuntimeGeneratedFunctions.generated_callfunc(f::$RuntimeGeneratedFunctions.RuntimeGeneratedFunction{
253+
@inline @generated function $RuntimeGeneratedFunctions.generated_callfunc(
254+
f::$RuntimeGeneratedFunctions.RuntimeGeneratedFunction{
255+
argnames,
256+
cache_tag,
257+
$_tagname,
258+
id
259+
},
260+
__args...) where {
254261
argnames,
255262
cache_tag,
256-
$_tagname,
257-
id,
258-
},
259-
__args...) where {
260-
argnames,
261-
cache_tag,
262-
id,
263+
id
263264
}
264265
$RuntimeGeneratedFunctions.generated_callfunc_body(argnames,
265266
cache_tag,
@@ -334,13 +335,13 @@ end
334335
# the body on a remote node when using Serialization.jl (in Distributed.jl
335336
# and elsewhere)
336337
function Serialization.serialize(s::AbstractSerializer,
337-
rgf::RuntimeGeneratedFunction{argnames, cache_tag,
338-
context_tag, id, B}) where {
339-
argnames,
340-
cache_tag,
341-
context_tag,
342-
id,
343-
B,
338+
rgf::RuntimeGeneratedFunction{argnames, cache_tag,
339+
context_tag, id, B}) where {
340+
argnames,
341+
cache_tag,
342+
context_tag,
343+
id,
344+
B
344345
}
345346
body = _lookup_body(cache_tag, id)
346347
Serialization.serialize_type(s,
@@ -350,14 +351,14 @@ function Serialization.serialize(s::AbstractSerializer,
350351
end
351352

352353
function Serialization.deserialize(s::AbstractSerializer,
353-
::Type{
354-
<:RuntimeGeneratedFunction{argnames, cache_tag,
354+
::Type{
355+
<:RuntimeGeneratedFunction{argnames, cache_tag,
355356
context_tag, id, B}}) where {
356-
argnames,
357-
cache_tag,
358-
context_tag,
359-
id,
360-
B,
357+
argnames,
358+
cache_tag,
359+
context_tag,
360+
id,
361+
B
361362
}
362363
body = deserialize(s)
363364
cached_body = _cache_body(cache_tag, id, body)

test/runtests.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ using RuntimeGeneratedFunctions
153153
f = @RuntimeGeneratedFunction(:(x -> x + y))
154154
end)
155155

156-
157156
ex = :(x -> (y -> x + y))
158157
@test @RuntimeGeneratedFunction(ex)(2)(3) === 5
159158

0 commit comments

Comments
 (0)