27
27
```
28
28
to:
29
29
```julia
30
- Derive.call(::typeof( SparseArrayInterface() ), Base.getindex, a, I...)
30
+ Derive.call(SparseArrayInterface(), Base.getindex, a, I...)
31
31
```
32
32
=#
33
33
function interface_call (interface:: Union{Symbol,Expr} , func:: Expr )
@@ -48,7 +48,7 @@ Rewrite:
48
48
```
49
49
to:
50
50
```julia
51
- Derive.call(::typeof( SparseArrayInterface() ), Base.getindex, a, I...)
51
+ Derive.call(SparseArrayInterface(), Base.getindex, a, I...)
52
52
```
53
53
=#
54
54
function interface_ref (interface:: Union{Symbol,Expr} , func:: Expr )
@@ -65,7 +65,7 @@ Rewrite:
65
65
```
66
66
to:
67
67
```julia
68
- Derive.call(::typeof( SparseArrayInterface() ), Base.setindex!, a, value, I...)
68
+ Derive.call(SparseArrayInterface(), Base.setindex!, a, value, I...)
69
69
```
70
70
=#
71
71
function interface_setref (interface:: Union{Symbol,Expr} , func:: Expr )
78
78
#=
79
79
Rewrite:
80
80
```julia
81
- @interface SparseArrayInterface() function Base.getindex(a, I::Int...)
81
+ @interface SparseArrayInterface function Base.getindex(a, I::Int...)
82
82
!isstored(a, I...) && return getunstoredindex(a, I...)
83
83
return getstoredindex(a, I...)
84
84
end
85
85
```
86
86
to:
87
87
```julia
88
- function Derive.call(::typeof( SparseArrayInterface()) , Base.getindex, a, I::Int...)
88
+ function Derive.call(::SparseArrayInterface, Base.getindex, a, I::Int...)
89
89
!isstored(a, I...) && return getunstoredindex(a, I...)
90
90
return getstoredindex(a, I...)
91
91
end
@@ -98,7 +98,7 @@ function interface_definition(interface::Union{Symbol,Expr}, func::Expr)
98
98
# We use `Core.Typeof` here because `name` can either be a function or type,
99
99
# and `typeof(T::Type)` outputs things like `DataType`, `UnionAll`, etc.
100
100
# while `Core.Typeof(T::Type)` returns `Type{T}`.
101
- new_args = [:(:: typeof ( $ interface) ); :(:: Core.Typeof ($ name)); args]
101
+ new_args = [:(:: $interface ); :(:: Core.Typeof ($ name)); args]
102
102
return globalref_derive (
103
103
codegen_ast (
104
104
JLFunction (; name= new_name, args= new_args, kwargs, rettype, whereparams, body)
0 commit comments