|
189 | 189 | LineNumberNode(3) |
190 | 190 | ) |
191 | 191 | ) |
| 192 | + if VERSION >= v"1.12-" |
| 193 | + @test parsestmt("for x=xs\ny\nelse\nz\nend") == |
| 194 | + Expr(:for, |
| 195 | + Expr(:(=), :x, :xs), |
| 196 | + Expr(:block, |
| 197 | + LineNumberNode(2), |
| 198 | + :y, |
| 199 | + ), |
| 200 | + Expr(:block, |
| 201 | + LineNumberNode(4), |
| 202 | + :z, |
| 203 | + LineNumberNode(5) |
| 204 | + ) |
| 205 | + ) |
| 206 | + end |
192 | 207 | @test parsestmt("while cond\n\nend") == |
193 | 208 | Expr(:while, |
194 | 209 | :cond, |
|
206 | 221 | LineNumberNode(3) |
207 | 222 | ) |
208 | 223 | ) |
| 224 | + if VERSION >= v"1.12-" |
| 225 | + @test parsestmt("while cond\ny\nelse\nz\nend") == |
| 226 | + Expr(:while, |
| 227 | + :cond, |
| 228 | + Expr(:block, |
| 229 | + LineNumberNode(2), |
| 230 | + :y, |
| 231 | + ), |
| 232 | + Expr(:block, |
| 233 | + LineNumberNode(4), |
| 234 | + :z, |
| 235 | + LineNumberNode(5) |
| 236 | + ) |
| 237 | + ) |
| 238 | + end |
209 | 239 | end |
210 | 240 | end |
211 | 241 |
|
|
361 | 391 | Expr(:call, :f, Expr(:parameters, Expr(:kw, :b, 2))) |
362 | 392 | @test parsestmt("f(a=1; b=2)") == |
363 | 393 | Expr(:call, :f, Expr(:parameters, Expr(:kw, :b, 2)), Expr(:kw, :a, 1)) |
364 | | - @test parsestmt("f(a; b; c)") == |
| 394 | + @test parsestmt("f(a; b; c)") == |
365 | 395 | Expr(:call, :f, Expr(:parameters, Expr(:parameters, :c), :b), :a) |
366 | 396 | @test parsestmt("+(a=1,)") == |
367 | 397 | Expr(:call, :+, Expr(:kw, :a, 1)) |
|
371 | 401 | # Operator calls: = is not :kw |
372 | 402 | @test parsestmt("(x=1) != 2") == |
373 | 403 | Expr(:call, :!=, Expr(:(=), :x, 1), 2) |
374 | | - @test parsestmt("+(a=1)") == |
| 404 | + @test parsestmt("+(a=1)") == |
375 | 405 | Expr(:call, :+, Expr(:(=), :a, 1)) |
376 | | - @test parsestmt("(a=1)'") == |
| 406 | + @test parsestmt("(a=1)'") == |
377 | 407 | Expr(Symbol("'"), Expr(:(=), :a, 1)) |
378 | | - @test parsestmt("(a=1)'ᵀ") == |
| 408 | + @test parsestmt("(a=1)'ᵀ") == |
379 | 409 | Expr(:call, Symbol("'ᵀ"), Expr(:(=), :a, 1)) |
380 | 410 |
|
381 | 411 | # Dotcall |
|
583 | 613 | Expr(:generator, :x, |
584 | 614 | Expr(:filter, :z, Expr(:(=), :a, :as), Expr(:(=), :b, :bs))) |
585 | 615 | @test parsestmt("(x for a in as, b in bs for c in cs, d in ds)") == |
586 | | - Expr(:flatten, |
587 | | - Expr(:generator, |
| 616 | + Expr(:flatten, |
| 617 | + Expr(:generator, |
588 | 618 | Expr(:generator, :x, Expr(:(=), :c, :cs), Expr(:(=), :d, :ds)), |
589 | 619 | Expr(:(=), :a, :as), Expr(:(=), :b, :bs))) |
590 | 620 | @test parsestmt("(x for a in as for b in bs if z)") == |
|
754 | 784 | @test parsestmt("global x ~ 1") == Expr(:global, Expr(:call, :~, :x, 1)) |
755 | 785 | @test parsestmt("global x += 1") == Expr(:global, Expr(:+=, :x, 1)) |
756 | 786 |
|
757 | | - # Parsing of global/local with |
| 787 | + # Parsing of global/local with |
758 | 788 | @test parsestmt("global (x,y)") == Expr(:global, :x, :y) |
759 | 789 | @test parsestmt("local (x,y)") == Expr(:local, :x, :y) |
760 | 790 | end |
|
0 commit comments