@@ -71,25 +71,25 @@ isconst(m::Module, s::Symbol) =
71
71
object_id (x:: ANY ) = ccall (:jl_object_id , UInt, (Any,), x)
72
72
73
73
# type predicates
74
- isimmutable (x:: ANY ) = (isa (x,Tuple) || ! typeof (x). mutable)
75
- isstructtype (t:: DataType ) = nfields (t) != 0 || (t. size== 0 && ! t. abstract)
76
- isstructtype (x) = false
77
- isbits (t:: DataType ) = ! t. mutable & t. pointerfree & isleaftype (t)
78
- isbits (t:: Type ) = false
79
- isbits (x) = isbits (typeof (x))
80
- isleaftype (t:: ANY ) = ccall (:jl_is_leaf_type , Int32, (Any,), t) != 0
74
+ isimmutable (x:: ANY ) = (@_pure_meta ; ( isa (x,Tuple) || ! typeof (x). mutable) )
75
+ isstructtype (t:: DataType ) = ( @_pure_meta ; nfields (t) != 0 || (t. size== 0 && ! t. abstract) )
76
+ isstructtype (x) = ( @_pure_meta ; false )
77
+ isbits (t:: DataType ) = ( @_pure_meta ; ! t. mutable & t. pointerfree & isleaftype (t) )
78
+ isbits (t:: Type ) = ( @_pure_meta ; false )
79
+ isbits (x) = ( @_pure_meta ; isbits (typeof (x) ))
80
+ isleaftype (t:: ANY ) = ( @_pure_meta ; ccall (:jl_is_leaf_type , Int32, (Any,), t) != 0 )
81
81
82
- typeintersect (a:: ANY ,b:: ANY ) = ccall (:jl_type_intersection , Any, (Any,Any), a, b)
83
- typeseq (a:: ANY ,b:: ANY ) = a<: b && b<: a
82
+ typeintersect (a:: ANY ,b:: ANY ) = ( @_pure_meta ; ccall (:jl_type_intersection , Any, (Any,Any), a, b) )
83
+ typeseq (a:: ANY ,b:: ANY ) = ( @_pure_meta ; a<: b && b<: a )
84
84
85
85
function fieldoffsets (x:: DataType )
86
86
offsets = Array (Int, nfields (x))
87
87
ccall (:jl_field_offsets , Void, (Any, Ptr{Int}), x, offsets)
88
88
offsets
89
89
end
90
90
91
- type_alignment (x:: DataType ) = ccall (:jl_get_alignment ,Csize_t,(Any,),x)
92
- field_offset (x:: DataType ,idx) = ccall (:jl_get_field_offset ,Csize_t,(Any,Int32),x,idx)
91
+ type_alignment (x:: DataType ) = ( @_pure_meta ; ccall (:jl_get_alignment ,Csize_t,(Any,),x) )
92
+ field_offset (x:: DataType ,idx) = ( @_pure_meta ; ccall (:jl_get_field_offset ,Csize_t,(Any,Int32),x,idx) )
93
93
94
94
# return all instances, for types that can be enumerated
95
95
function instances end
@@ -114,11 +114,12 @@ subtypes(m::Module, x::DataType) = sort(collect(_subtypes(m, x)), by=string)
114
114
subtypes (x:: DataType ) = subtypes (Main, x)
115
115
116
116
# function reflection
117
- isgeneric (f:: ANY ) = (isa (f,Function) && isa (f. env,MethodTable))
117
+ isgeneric (f:: ANY ) = (@_pure_meta ; ( isa (f,Function) && isa (f. env,MethodTable) ))
118
118
119
119
function_name (f:: Function ) = isgeneric (f) ? f. env. name : (:anonymous )
120
120
121
121
function to_tuple_type (t:: ANY )
122
+ @_pure_meta
122
123
if isa (t,Tuple) || isa (t,AbstractArray) || isa (t,SimpleVector)
123
124
t = Tuple{t... }
124
125
end
@@ -132,7 +133,7 @@ function to_tuple_type(t::ANY)
132
133
t
133
134
end
134
135
135
- tt_cons (t:: ANY , tup:: ANY ) = Tuple{t, (isa (tup, Type) ? tup. parameters : tup). .. }
136
+ tt_cons (t:: ANY , tup:: ANY ) = ( @_pure_meta ; Tuple{t, (isa (tup, Type) ? tup. parameters : tup). .. })
136
137
137
138
code_lowered (f, t:: ANY ) = map (m-> uncompressed_ast (m. func. code), methods (f, t))
138
139
function methods (f:: Function ,t:: ANY )
0 commit comments