11using JuliaSyntax: ParseStream, @K_str , build_tree, bump_trivia, kind, parse!, peek_full_token, peek_token
22using StringViews
33
4- function include_test_file (ti_filter, path:: String )
4+ function include_test_file (ti_filter:: TestItemFilter , path:: String )
55 bytes = read (path)
66 stream = ParseStream (bytes)
77 tls = task_local_storage ()
@@ -43,22 +43,22 @@ function _eval_from_stream(stream, path)
4343end
4444
4545# test_rel -> apply ti_filter on the parsed ast
46- function _eval_from_stream (stream, path, ti_filter)
46+ function _eval_from_stream (stream, path, ti_filter:: TestItemFilter )
4747 parse! (stream; rule= :statement )
4848 ast = build_tree (Expr, stream; filename= path)
49- filtered = ti_filter (ast)
50- filtered === nothing || Core. eval (Main, filtered)
49+ filtered = ti_filter (ast):: Union{Nothing, Expr}
50+ filtered === nothing || Core. eval (Main, filtered:: Expr )
5151 return nothing
5252end
5353
5454# like above, but tries to avoid parsing the ast if it sees from the name identifier token
5555# it won't pass the filter
56- function _eval_from_stream (stream, path, ti_filter, bytes)
56+ function _eval_from_stream (stream, path, ti_filter:: TestItemFilter , bytes)
5757 if ti_filter. name isa Nothing
5858 parse! (stream; rule= :statement )
5959 ast = build_tree (Expr, stream; filename= path)
60- filtered = ti_filter (ast)
61- filtered === nothing || Core. eval (Main, filtered)
60+ filtered = ti_filter (ast):: Union{Nothing, Expr}
61+ filtered === nothing || Core. eval (Main, filtered:: Expr )
6262 return nothing
6363 end
6464
@@ -67,8 +67,8 @@ function _eval_from_stream(stream, path, ti_filter, bytes)
6767 parse! (stream; rule= :statement )
6868 if _contains (name, ti_filter. name)
6969 ast = build_tree (Expr, stream; filename= path)
70- filtered = ti_filter (ast)
71- filtered === nothing || Core. eval (Main, filtered)
70+ filtered = ti_filter (ast):: Union{Nothing, Expr}
71+ filtered === nothing || Core. eval (Main, filtered:: Expr )
7272 end
7373 return nothing
7474end
0 commit comments