|
101 | 101 |
|
102 | 102 | rmlines(a) = a
|
103 | 103 |
|
| 104 | +function no_ana(ex) |
| 105 | + @match ex begin |
| 106 | + # inline |
| 107 | + Expr(:meta, _...) || |
| 108 | + # @label, @goto |
| 109 | + Expr(:symboliclabel, _...) || |
| 110 | + Expr(:symbolicgoto, _...) || |
| 111 | + # @inbounds |
| 112 | + Expr(:inbounds, _...) || |
| 113 | + # @generated |
| 114 | + Expr(:generated, _...) || |
| 115 | + # @ boundscheck |
| 116 | + Expr(:boundscheck, _...) || |
| 117 | + # @locals |
| 118 | + Expr(:locals) => true |
| 119 | + _ => false |
| 120 | + end |
| 121 | +end |
| 122 | + |
104 | 123 | function quick_lambda(ex)
|
105 | 124 | @when Expr(:call, args...) && if any(==(:_), args) end = ex begin
|
106 | 125 | quick_arg = gensym("quick_arg")
|
@@ -189,7 +208,8 @@ function solve(ana, sym :: Symbol, ctx_flag::CtxFlag)
|
189 | 208 | ScopedVar(ana.solved, sym)
|
190 | 209 | end
|
191 | 210 |
|
192 |
| -function solve(ana, ex, ctx_flag::CtxFlag = CtxFlag()) |
| 211 | +function solve(ana, ex::Expr, ctx_flag::CtxFlag) |
| 212 | + no_ana(ex) && return ex |
193 | 213 | @match ex begin
|
194 | 214 | # give up analysing macrocall expressions.
|
195 | 215 | Expr(:macrocall, _...) => ex
|
@@ -341,10 +361,17 @@ function solve(ana, ex, ctx_flag::CtxFlag = CtxFlag())
|
341 | 361 | args = map(solve(ana, _, ctx_flag), args)
|
342 | 362 | Expr(hd, args...)
|
343 | 363 | end
|
344 |
| - a => a |
345 | 364 | end
|
346 | 365 | end
|
347 | 366 |
|
| 367 | +function solve(ana, ex, ctx_flag::CtxFlag) |
| 368 | + ex |
| 369 | +end |
| 370 | + |
| 371 | +function solve(ana, ex) |
| 372 | + solve(ana, ex, CtxFlag()) |
| 373 | +end |
| 374 | + |
348 | 375 | function solve(ex)
|
349 | 376 | ana = top_analyzer()
|
350 | 377 | ex = solve(ana, ex)
|
|
0 commit comments