@@ -20,46 +20,42 @@ include(path::String) = include(Base, path)
20
20
const is_primary_base_module = ccall (:jl_module_parent , Ref{Module}, (Any,), Base) === Core. Main
21
21
ccall (:jl_set_istopmod , Cvoid, (Any, Bool), Base, is_primary_base_module)
22
22
23
- # The real @inline macro is not available until after array.jl, so this
24
- # internal macro splices the meta Expr directly into the function body.
25
- macro _inline_meta ()
26
- Expr (:meta , :inline )
27
- end
28
- macro _noinline_meta ()
29
- Expr (:meta , :noinline )
30
- end
23
+ # The @inline/@noinline macros that can be applied to a function declaration are not available
24
+ # until after array.jl, and so we will mark them within a function body instead.
25
+ macro inline () Expr (:meta , :inline ) end
26
+ macro noinline () Expr (:meta , :noinline ) end
31
27
32
28
# Try to help prevent users from shooting them-selves in the foot
33
29
# with ambiguities by defining a few common and critical operations
34
30
# (and these don't need the extra convert code)
35
- getproperty (x:: Module , f:: Symbol ) = (@_inline_meta ; getfield (x, f))
31
+ getproperty (x:: Module , f:: Symbol ) = (@inline ; getfield (x, f))
36
32
setproperty! (x:: Module , f:: Symbol , v) = setfield! (x, f, v) # to get a decent error
37
- getproperty (x:: Type , f:: Symbol ) = (@_inline_meta ; getfield (x, f))
33
+ getproperty (x:: Type , f:: Symbol ) = (@inline ; getfield (x, f))
38
34
setproperty! (x:: Type , f:: Symbol , v) = error (" setfield! fields of Types should not be changed" )
39
- getproperty (x:: Tuple , f:: Int ) = (@_inline_meta ; getfield (x, f))
35
+ getproperty (x:: Tuple , f:: Int ) = (@inline ; getfield (x, f))
40
36
setproperty! (x:: Tuple , f:: Int , v) = setfield! (x, f, v) # to get a decent error
41
37
42
- getproperty (x, f:: Symbol ) = (@_inline_meta ; getfield (x, f))
38
+ getproperty (x, f:: Symbol ) = (@inline ; getfield (x, f))
43
39
setproperty! (x, f:: Symbol , v) = setfield! (x, f, convert (fieldtype (typeof (x), f), v))
44
40
45
41
dotgetproperty (x, f) = getproperty (x, f)
46
42
47
- getproperty (x:: Module , f:: Symbol , order:: Symbol ) = (@_inline_meta ; getfield (x, f, order))
43
+ getproperty (x:: Module , f:: Symbol , order:: Symbol ) = (@inline ; getfield (x, f, order))
48
44
setproperty! (x:: Module , f:: Symbol , v, order:: Symbol ) = setfield! (x, f, v, order) # to get a decent error
49
- getproperty (x:: Type , f:: Symbol , order:: Symbol ) = (@_inline_meta ; getfield (x, f, order))
45
+ getproperty (x:: Type , f:: Symbol , order:: Symbol ) = (@inline ; getfield (x, f, order))
50
46
setproperty! (x:: Type , f:: Symbol , v, order:: Symbol ) = error (" setfield! fields of Types should not be changed" )
51
- getproperty (x:: Tuple , f:: Int , order:: Symbol ) = (@_inline_meta ; getfield (x, f, order))
47
+ getproperty (x:: Tuple , f:: Int , order:: Symbol ) = (@inline ; getfield (x, f, order))
52
48
setproperty! (x:: Tuple , f:: Int , v, order:: Symbol ) = setfield! (x, f, v, order) # to get a decent error
53
49
54
- getproperty (x, f:: Symbol , order:: Symbol ) = (@_inline_meta ; getfield (x, f, order))
55
- setproperty! (x, f:: Symbol , v, order:: Symbol ) = (@_inline_meta ; setfield! (x, f, convert (fieldtype (typeof (x), f), v), order))
50
+ getproperty (x, f:: Symbol , order:: Symbol ) = (@inline ; getfield (x, f, order))
51
+ setproperty! (x, f:: Symbol , v, order:: Symbol ) = (@inline ; setfield! (x, f, convert (fieldtype (typeof (x), f), v), order))
56
52
57
53
swapproperty! (x, f:: Symbol , v, order:: Symbol = :notatomic ) =
58
- (@_inline_meta ; Core. swapfield! (x, f, convert (fieldtype (typeof (x), f), v), order))
54
+ (@inline ; Core. swapfield! (x, f, convert (fieldtype (typeof (x), f), v), order))
59
55
modifyproperty! (x, f:: Symbol , op, v, order:: Symbol = :notatomic ) =
60
- (@_inline_meta ; Core. modifyfield! (x, f, op, v, order))
56
+ (@inline ; Core. modifyfield! (x, f, op, v, order))
61
57
replaceproperty! (x, f:: Symbol , expected, desired, success_order:: Symbol = :notatomic , fail_order:: Symbol = success_order) =
62
- (@_inline_meta ; Core. replacefield! (x, f, expected, convert (fieldtype (typeof (x), f), desired), success_order, fail_order))
58
+ (@inline ; Core. replacefield! (x, f, expected, convert (fieldtype (typeof (x), f), desired), success_order, fail_order))
63
59
64
60
65
61
include (" coreio.jl" )
@@ -107,9 +103,9 @@ include("options.jl")
107
103
include (" promotion.jl" )
108
104
include (" tuple.jl" )
109
105
include (" expr.jl" )
110
- Pair {A, B} (@nospecialize (a), @nospecialize (b)) where {A, B} = (@_inline_meta ; Pair {A, B} (convert (A, a):: A , convert (B, b):: B ))
111
- # Pair{Any, B}(@nospecialize(a::Any), b) where {B} = (@_inline_meta ; Pair{Any, B}(a, Base.convert(B, b)::B))
112
- # Pair{A, Any}(a, @nospecialize(b::Any)) where {A} = (@_inline_meta ; Pair{A, Any}(Base.convert(A, a)::A, b))
106
+ Pair {A, B} (@nospecialize (a), @nospecialize (b)) where {A, B} = (@inline ; Pair {A, B} (convert (A, a):: A , convert (B, b):: B ))
107
+ # Pair{Any, B}(@nospecialize(a::Any), b) where {B} = (@inline ; Pair{Any, B}(a, Base.convert(B, b)::B))
108
+ # Pair{A, Any}(a, @nospecialize(b::Any)) where {A} = (@inline ; Pair{A, Any}(Base.convert(A, a)::A, b))
113
109
include (" pair.jl" )
114
110
include (" traits.jl" )
115
111
include (" range.jl" )
0 commit comments