Skip to content

Commit

Permalink
Add compat for const struct fields.
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikekre committed May 24, 2024
1 parent 0322254 commit 99d18f1
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/Runic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,22 @@ module Runic
using JuliaSyntax:
JuliaSyntax, @K_str, @KSet_str

# compat for const fields
@eval macro $(Symbol("const"))(field)
if VERSION >= v"1.8.0-DEV.1148"
Expr(:const, esc(field))
else
return esc(field)
end
end

mutable struct Context
# Input
const src_str::String
const src_tree::JuliaSyntax.GreenNode
const src_io::IOBuffer
@const src_str::String
@const src_tree::JuliaSyntax.GreenNode
@const src_io::IOBuffer
# Output
const fmt_io::IOBuffer
@const fmt_io::IOBuffer
fmt_tree::Union{JuliaSyntax.GreenNode, Nothing}
# User settings
verbose::Bool
Expand Down

0 comments on commit 99d18f1

Please sign in to comment.