File tree Expand file tree Collapse file tree 2 files changed +25
-3
lines changed Expand file tree Collapse file tree 2 files changed +25
-3
lines changed Original file line number Diff line number Diff line change @@ -257,10 +257,20 @@ function _const(x, i)
257
257
end
258
258
259
259
function _global (x, i)
260
- if hastrivia (x) && (headof (first (x. trivia)) === :GLOBAL || headof (first (x. trivia)) === :LOCAL )
261
- oddt_evena (x, i)
260
+ if length (x. trivia) > length (x. args) # probably :tuple
261
+ if i <= 2
262
+ x. trivia[i]
263
+ elseif isodd (i)
264
+ x. args[div (i - 1 , 2 )]
265
+ else
266
+ x. trivia[div (i - 2 , 2 ) + 2 ]
267
+ end
262
268
else
263
- odda_event (x, i)
269
+ if hastrivia (x) && (headof (first (x. trivia)) === :GLOBAL || headof (first (x. trivia)) === :LOCAL )
270
+ oddt_evena (x, i)
271
+ else
272
+ odda_event (x, i)
273
+ end
264
274
end
265
275
end
266
276
Original file line number Diff line number Diff line change 29
29
@test x[1 ] === x. trivia[1 ]
30
30
@test x[2 ] === x. args[1 ]
31
31
end
32
+
33
+ @testset " global tuple" begin
34
+ x = cst " global (a = 1,b = 2)"
35
+ @test length (x) == 6
36
+ @test x[1 ] === x. trivia[1 ]
37
+ @test x[2 ] === x. trivia[2 ]
38
+ @test x[3 ] === x. args[1 ]
39
+ @test x[4 ] === x. trivia[3 ]
40
+ @test x[5 ] === x. args[2 ]
41
+ @test x[6 ] === x. trivia[4 ]
42
+ end
43
+
32
44
@testset " const" begin
33
45
x = cst " const a = 1"
34
46
@test length (x) == 2
You can’t perform that action at this time.
0 commit comments