1
- using Tricks: static_hasmethod
2
- # TODO use traits for static_hasmethod checks
1
+ using Tricks: compat_hasmethod
2
+ # TODO use traits for compat_hasmethod checks
3
3
4
4
# Scalar parsers
5
5
@@ -18,9 +18,9 @@ function nodeparse(type::Type, content::String)
18
18
# https://julialang.slack.com/archives/C6A044SQH/p1578442480438100
19
19
if hasmethod (type, Tuple{String}) && Core. Compiler. return_type (type, Tuple{Node})=== Union{}
20
20
return type (content)
21
- elseif static_hasmethod (convert, Tuple{String, type})
21
+ elseif compat_hasmethod (convert, Tuple{String, type})
22
22
return convert (type, content)
23
- elseif static_hasmethod (parse, Tuple{type, String})
23
+ elseif compat_hasmethod (parse, Tuple{type, String})
24
24
return parse (type, content)
25
25
else
26
26
error (" Could not parse a String as type $type " )
@@ -33,9 +33,9 @@ function nodeparse(type::Type, elm::Node)
33
33
content = elm. content
34
34
if hasmethod (type, Tuple{String}) && Core. Compiler. return_type (type, Tuple{Node})=== Union{}
35
35
return type (content)
36
- elseif static_hasmethod (convert, Tuple{String, type})
36
+ elseif compat_hasmethod (convert, Tuple{String, type})
37
37
return convert (type, content)
38
- elseif static_hasmethod (parse, Tuple{type, String})
38
+ elseif compat_hasmethod (parse, Tuple{type, String})
39
39
return parse (type, content)
40
40
else
41
41
# should be the last to avoid invoking generic methods
@@ -65,12 +65,12 @@ function nodeparse(::Type{T}, contents::Vector{String}) where {T}
65
65
elms_typed[i] = type (content)
66
66
i+= 1
67
67
end
68
- elseif static_hasmethod (convert, Tuple{String, type})
68
+ elseif compat_hasmethod (convert, Tuple{String, type})
69
69
for content in contents
70
70
elms_typed[i] = convert (type, content)
71
71
i+= 1
72
72
end
73
- elseif static_hasmethod (parse, Tuple{type, String})
73
+ elseif compat_hasmethod (parse, Tuple{type, String})
74
74
for content in contents
75
75
elms_typed[i] = parse (type, content)
76
76
i+= 1
@@ -90,12 +90,12 @@ function nodeparse(type::Type{T}, elms::Vector{Node}) where {T}
90
90
elms_typed[i] = type (elm. content)
91
91
i+= 1
92
92
end
93
- elseif static_hasmethod (convert, Tuple{String, type})
93
+ elseif compat_hasmethod (convert, Tuple{String, type})
94
94
for elm in elms
95
95
elms_typed[i] = convert (type, elm. content)
96
96
i+= 1
97
97
end
98
- elseif static_hasmethod (parse, Tuple{type, String})
98
+ elseif compat_hasmethod (parse, Tuple{type, String})
99
99
for elm in elms
100
100
elms_typed[i] = parse (type, elm. content)
101
101
i+= 1
0 commit comments