Skip to content

Commit 5b1c479

Browse files
committed
Fix the syntax_interpolation prototype for the newer parser api
1 parent 248a6ed commit 5b1c479

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

test/syntax_interpolation.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# # Macros and expression interpolation
22

3-
using JuliaSyntax: SourceFile, SyntaxNode, parse_all, child, setchild!
3+
using JuliaSyntax: SourceFile, SyntaxNode, parseall, child, setchild!
44

55
# The following shows that SyntaxNode works nicely for simple macros which
66
# just interpolate expressions into one another. In particular it shows how
@@ -31,7 +31,7 @@ function at_show2(ex::SyntaxNode)
3131
# The following emulates the expression interpolation lowering which is
3232
# usually done by the compiler.
3333
# 1. Extract the expression literal as `block`
34-
tree = parse_all(SyntaxNode, SourceFile(String(read(@__FILE__)), filename=@__FILE__))
34+
tree = parseall(SyntaxNode, String(read(@__FILE__)), filename=@__FILE__)
3535
block = child(tree, 3, 2, 2, 1)
3636
# 2. Interpolate local variables into the block at positions of $'s
3737
# Interpolating a SyntaxNode `ex` is simple:
@@ -48,7 +48,7 @@ end
4848

4949
# Let's have some simple expression to pass to at_show2. This will be
5050
# attributed to a different file foo.jl
51-
s2 = child(parse_all(SyntaxNode, SourceFile("foo +\n42", filename="foo.jl")), 1)
51+
s2 = parseall(SyntaxNode, "foo +\n42", filename="foo.jl", rule=:statement)
5252

5353
# Calling at_show2, we see that the precise source information is preserved for
5454
# both the surrounding expression and the interpolated fragments.

0 commit comments

Comments
 (0)