Skip to content

Commit a2bc7c9

Browse files
authored
Merge pull request #344 from julia-vscode/sp/adjust-global-const
Adjust global const parsing
2 parents 0960480 + a68beed commit a2bc7c9

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/components/keywords.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ function parse_local_global(ps::ParseState, islocal = true)
9999
kw = EXPR(ps)
100100
if ps.nt.kind === Tokens.CONST
101101
arg1 = parse_const(next(ps))
102-
EXPR(:const, EXPR[EXPR(islocal ? :local : :global, EXPR[arg1.args[1]], nothing)], EXPR[kw, arg1.trivia[1]])
102+
EXPR(:const, EXPR[EXPR(islocal ? :local : :global, arg1.args, EXPR[kw])], arg1.trivia)
103103
else
104104
args, trivia = EXPR[], EXPR[kw]
105105
arg = parse_expression(ps)

test/iterate.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ end
3737
end
3838
@testset "simple" begin
3939
x = cst"global const a = 1"
40-
@test length(x) == 3
40+
@test length(x) == 2
4141
@test x[1] === x.trivia[1]
42-
@test x[2] === x.trivia[2]
43-
@test x[3] === x.args[1]
44-
@test length(x[3]) == 1
45-
@test x[3][1] === x.args[1].args[1]
42+
@test x[2] === x.args[1]
43+
@test length(x[2]) == 2
44+
@test x[2][1] === x.args[1].trivia[1]
45+
@test x[2][2] === x.args[1].args[1]
4646
end
4747

4848
@testset "return" begin

test/spec.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ end
4949
test_expr("global a", :global, 2)
5050
test_expr("global a, b", :global, 4)
5151
test_expr("global a, b = 2", :global, 2)
52-
test_expr("global const a = 1", :const, 3)
53-
test_expr("global const a = 1, b", :const, 3)
52+
test_expr("global const a = 1", :const, 2)
53+
test_expr("global const a = 1, b", :const, 2)
5454
end
5555

5656
@testset ":const" begin

0 commit comments

Comments
 (0)