Skip to content

Commit 6747b08

Browse files
authored
Merge pull request #24 from fcard/fix_deprecations_05
Remove deprecated syntax and functions (call,symbol,readall)
2 parents af7d269 + 8b8ffc9 commit 6747b08

File tree

9 files changed

+20
-22
lines changed

9 files changed

+20
-22
lines changed

examples/classprep.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ abstract Object
4545
immutable Method{T <: Object}
4646
func :: Function
4747
end
48-
Base.call(m::Method, args...) = m.func(args...)
48+
(m::Method)(args...) = m.func(args...)
4949

5050
class_field_values(obj) =
5151
filter(x->!isa(x, Method), map(x->getfield(obj, x), fieldnames(obj)))

src/Analyzer/Function.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ function is_macro_name(x::Symbol)
181181
end
182182

183183
function newbinding(ex)
184-
name = is_macro_name(ex)? symbol(string(ex)[2:end]) : ex
184+
name = is_macro_name(ex)? Symbol(string(ex)[2:end]) : ex
185185
Binding(name)
186186
end
187187

src/Dispatch/Applications.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ const MACROMETHODS = TopMetaTable()
1919
end
2020

2121
function macromet(name, patterns, label, body, mod)
22-
init_metatable!(MACROMETHODS, mod, symbol("@$name"), "macromethod $name")
23-
macrotable = get_metatable(MACROMETHODS, mod, symbol("@$name"))
22+
init_metatable!(MACROMETHODS, mod, Symbol("@$name"), "macromethod $name")
23+
macrotable = get_metatable(MACROMETHODS, mod, Symbol("@$name"))
2424
undefined = isempty(macrotable.methods)
2525

2626
code =

src/Dispatch/BaseImplementations.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
module BaseImplementation
22
using ...Dispatch.Structure
3-
import Base: showerror, ==, call, show, display
3+
import Base: showerror, ==, show, display
44

55

6-
call(met::MetaMethod, exprs...) = met.method(exprs...)
6+
(met::MetaMethod)(exprs...) = met.method(exprs...)
77

88
function show(io::IO, met::MetaMethod)
99
args = map(met.tree.child.children) do tree
@@ -33,4 +33,4 @@ end
3333
showerror(io::IO, err::MetaMethodError) =
3434
print(io, "$(err.name) has no method that matches $(err.expr).")
3535

36-
end
36+
end

src/Dispatch/MetaModule.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function importallcode(path)
5757

5858
for exp in $union(metafun_exports, macromet_exports)
5959
imp = Expr(:import, $vcat($path, exp)...)
60-
eval(Expr(:macrocall, symbol("@metamodule"), imp))
60+
eval(Expr(:macrocall, Symbol("@metamodule"), imp))
6161
end
6262
end
6363
end
@@ -70,4 +70,4 @@ gettable(name) =
7070
startswith(string(name), "@")? MM : MF
7171

7272

73-
end
73+
end

src/Dispatch/Reflection.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import ...Dispatch.TableManipulation: print_conflicts
77
import Base.Meta: quot
88
export @prefer, @whichmeta, @remove, @importmeta, @metamethods, @metaconflicts
99

10-
name(macroname) = symbol(string(macroname)[1:end])
10+
name(macroname) = Symbol(string(macroname)[1:end])
1111

1212
macrotable(macroname,M) =
1313
get_metatable(MACROMETHODS, M, name(macroname))
@@ -97,4 +97,4 @@ conflictscode(m, typ, M=current_module()) =
9797
@macromethod metaconflicts(M.@m) = esc(conflictscode(m, :macro, M))
9898

9999

100-
end
100+
end

src/PatternStructure/Checks.jl

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,13 @@ immutable QuoteStep <: PatternStep end
2424
immutable IterStep <: PatternStep end
2525
immutable SlurpStep <: PatternStep end
2626

27-
import Base: call
27+
(::ArgsStep)(ex) = ex.args
28+
(::BlockStep)(ex) = linesof(ex)
2829

29-
call(::ArgsStep, ex) = ex.args
30-
call(::BlockStep, ex) = linesof(ex)
30+
(::QuoteStep)(ex::Expr) = ex.args
31+
(::QuoteStep)(ex::QuoteNode) = [ex.value]
3132

32-
call(::QuoteStep, ex::Expr) = ex.args
33-
call(::QuoteStep, ex::QuoteNode) = [ex.value]
34-
35-
call(::IterStep, ex) = ex
36-
call(::SlurpStep, ex) = error("Called the step of slurp.")
33+
(::IterStep)(ex) = ex
34+
(::SlurpStep)(ex) = error("Called the step of slurp.")
3735

3836
end

src/PatternStructure/Printing.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function expr(p::PatternNode)
1717
children::Vector{Any} = map(expr, p.children)
1818

1919
if is_macrocall(p.head)
20-
children[1] = symbol("@$(children[1])")
20+
children[1] = Symbol("@$(children[1])")
2121
end
2222

2323
is_special(p)?

test/reflection.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ MF = Dispatch.Applications.METAFUNCTIONS[ReflectionTests]
8888
@metafunction m(x) = [x]
8989
@metafunction m(x+y) = [x,y]
9090

91-
const mmac = symbol("@m")
91+
const mmac = Symbol("@m")
9292
const mfun = :m
9393

9494
@test MM[mmac].methods[1] == @whichmeta @m(x+y)
@@ -145,4 +145,4 @@ end
145145

146146
@test B.@m(x+y,y+x) == (:x,:y)
147147

148-
end
148+
end

0 commit comments

Comments
 (0)