Skip to content

Commit a21ad39

Browse files
authored
don't specialize functions (#54)
1 parent 263314f commit a21ad39

File tree

6 files changed

+22
-22
lines changed

6 files changed

+22
-22
lines changed

src/CSTParser.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ Handles cases where an expression - `ret` - is not followed by
174174
+ an expression preceded by a unary operator
175175
+ A number followed by an expression (with no seperating white space)
176176
"""
177-
function parse_compound(ps::ParseState, ret)
177+
function parse_compound(ps::ParseState, ret::ANY)
178178
if ps.nt.kind == Tokens.FOR
179179
ret = parse_generator(ps, ret)
180180
elseif ps.nt.kind == Tokens.DO

src/components/controlflow.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
function parse_do(ps::ParseState, ret)
1+
function parse_do(ps::ParseState, ret::ANY)
22
kw = KEYWORD(next(ps))
33

44
args = EXPR{TupleH}(Any[])

src/components/functions.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,36 +48,36 @@ end
4848
4949
Parses a function call. Expects to start before the opening parentheses and is passed the expression declaring the function name, `ret`.
5050
"""
51-
function parse_call_exor(ps::ParseState, ret)
51+
function parse_call_exor(ps::ParseState, ret::ANY)
5252
arg = @precedence ps 20 parse_expression(ps)
5353
ret = UnarySyntaxOpCall(ret, arg)
5454
return ret
5555
end
56-
function parse_call_decl(ps::ParseState, ret)
56+
function parse_call_decl(ps::ParseState, ret::ANY)
5757
arg = @precedence ps 20 parse_expression(ps)
5858
ret = UnarySyntaxOpCall(ret, arg)
5959
return ret
6060
end
61-
function parse_call_and(ps::ParseState, ret)
61+
function parse_call_and(ps::ParseState, ret::ANY)
6262
arg = @precedence ps 20 parse_expression(ps)
6363
ret = UnarySyntaxOpCall(ret, arg)
6464
return ret
6565
end
6666

6767
# NEEDS FIX: these are broken (i.e. `<:(a,b) where T = 1`)
68-
function parse_call_issubt(ps::ParseState, ret)
68+
function parse_call_issubt(ps::ParseState, ret::ANY)
6969
arg = @precedence ps 13 parse_expression(ps)
7070
ret = EXPR{Call}(Any[ret; arg.args])
7171
return ret
7272
end
7373

74-
function parse_call_issupt(ps::ParseState, ret)
74+
function parse_call_issupt(ps::ParseState, ret::ANY)
7575
arg = @precedence ps 13 parse_expression(ps)
7676
ret = EXPR{Call}(Any[ret; arg.args])
7777
return ret
7878
end
7979

80-
function parse_call_PlusOp(ps::ParseState, ret)
80+
function parse_call_PlusOp(ps::ParseState, ret::ANY)
8181
arg = @precedence ps 13 parse_expression(ps)
8282
if arg isa EXPR{TupleH}
8383
ret = EXPR{Call}(Any[ret; arg.args])
@@ -89,7 +89,7 @@ function parse_call_PlusOp(ps::ParseState, ret)
8989
return ret
9090
end
9191

92-
function parse_call(ps::ParseState, ret)
92+
function parse_call(ps::ParseState, ret::ANY)
9393
if is_plus(ret) || is_minus(ret) || is_not(ret)
9494
return parse_call_PlusOp(ps, ret)
9595
elseif is_and(ret)

src/components/lists.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ parse_tuple(ps, ret)
44
`ret` is followed by a comma so tries to parse the rest of the
55
tuple.
66
"""
7-
function parse_tuple(ps::ParseState, ret)
7+
function parse_tuple(ps::ParseState, ret::ANY)
88
op = PUNCTUATION(next(ps))
99

1010
if closer(ps) || (isassignment(ps.nt) && ps.nt.kind != Tokens.APPROX)

src/components/loops.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ parse_generator(ps)
6969
Having hit `for` not at the beginning of an expression return a generator.
7070
Comprehensions are parsed as SQUAREs containing a generator.
7171
"""
72-
function parse_generator(ps::ParseState, ret)
72+
function parse_generator(ps::ParseState, ret::ANY)
7373
kw = KEYWORD(next(ps))
7474
ret = EXPR{Generator}(Any[ret, kw])
7575
@catcherror ps ranges = @closer ps paren @closer ps square parse_ranges(ps)

src/components/operators.jl

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ function parse_unary_colon(ps::ParseState, op)
189189
end
190190

191191
# Parse assignments
192-
function parse_operator_eq(ps::ParseState, ret, op)
192+
function parse_operator_eq(ps::ParseState, ret::ANY, op)
193193
# Parsing
194194
@catcherror ps nextarg = @precedence ps AssignmentOp - LtoR(AssignmentOp) parse_expression(ps)
195195

@@ -205,7 +205,7 @@ function parse_operator_eq(ps::ParseState, ret, op)
205205
end
206206

207207
# Parse conditionals
208-
function parse_operator_cond(ps::ParseState, ret, op)
208+
function parse_operator_cond(ps::ParseState, ret::ANY, op)
209209
@catcherror ps nextarg = @closer ps ifop parse_expression(ps)
210210
@catcherror ps op2 = OPERATOR(next(ps))
211211
@catcherror ps nextarg2 = @closer ps comma @precedence ps 0 parse_expression(ps)
@@ -214,7 +214,7 @@ function parse_operator_cond(ps::ParseState, ret, op)
214214
end
215215

216216
# Parse comparisons
217-
function parse_comp_operator(ps::ParseState, ret, op)
217+
function parse_comp_operator(ps::ParseState, ret::ANY, op)
218218
@catcherror ps nextarg = @precedence ps ComparisonOp - LtoR(ComparisonOp) parse_expression(ps)
219219
if ret isa EXPR{Comparison}
220220
push!(ret, op)
@@ -232,7 +232,7 @@ function parse_comp_operator(ps::ParseState, ret, op)
232232
end
233233

234234
# Parse ranges
235-
function parse_operator_colon(ps::ParseState, ret, op)
235+
function parse_operator_colon(ps::ParseState, ret::ANY, op)
236236
@catcherror ps nextarg = @precedence ps ColonOp - LtoR(ColonOp) parse_expression(ps)
237237
if ret isa BinarySyntaxOpCall && is_colon(ret.op)
238238
ret = EXPR{ColonOpCall}(Any[ret.arg1, ret.op, ret.arg2])
@@ -248,7 +248,7 @@ end
248248

249249

250250
# Parse power (special case for preceding unary ops)
251-
function parse_operator_power(ps::ParseState, ret, op)
251+
function parse_operator_power(ps::ParseState, ret::ANY, op)
252252
@catcherror ps nextarg = @precedence ps PowerOp - LtoR(PowerOp) @closer ps inwhere parse_expression(ps)
253253

254254
# Construction
@@ -269,7 +269,7 @@ end
269269

270270

271271
# parse where
272-
function parse_operator_where(ps::ParseState, ret, op)
272+
function parse_operator_where(ps::ParseState, ret::ANY, op)
273273
args = Any[]
274274
if ps.nt.kind == Tokens.LBRACE
275275
next(ps)
@@ -290,7 +290,7 @@ function parse_operator_where(ps::ParseState, ret, op)
290290
end
291291

292292
# parse dot access
293-
function parse_operator_dot(ps::ParseState, ret, op)
293+
function parse_operator_dot(ps::ParseState, ret::ANY, op)
294294
if ps.nt.kind == Tokens.LPAREN
295295
@catcherror ps sig = @default ps @closer ps paren parse_call(ps, ret)
296296
args = EXPR{TupleH}(sig.args[2:end])
@@ -330,20 +330,20 @@ function parse_operator_dot(ps::ParseState, ret, op)
330330
end
331331

332332

333-
function parse_operator_dddot(ps::ParseState, ret, op)
333+
function parse_operator_dddot(ps::ParseState, ret::ANY, op)
334334
return UnarySyntaxOpCall(ret, op)
335335
end
336336

337-
function parse_operator_prime(ps::ParseState, ret, op)
337+
function parse_operator_prime(ps::ParseState, ret::ANY, op)
338338
return UnarySyntaxOpCall(ret, op)
339339
end
340340

341-
function parse_operator_anon_func(ps::ParseState, ret, op)
341+
function parse_operator_anon_func(ps::ParseState, ret::ANY, op)
342342
@catcherror ps arg = @closer ps comma @precedence ps 0 parse_expression(ps)
343343
return BinarySyntaxOpCall(ret, op, EXPR{Block}(Any[arg]))
344344
end
345345

346-
function parse_operator(ps::ParseState, ret, op)
346+
function parse_operator(ps::ParseState, ret::ANY, op)
347347
K,dot = op.kind, op.dot
348348
P = precedence(K)
349349

0 commit comments

Comments
 (0)