Skip to content

Commit

Permalink
fix: add back public adt macro (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
Roger-luo authored Mar 16, 2023
1 parent 0f89786 commit 5bf0132
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/adt/emit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,12 @@ macro adt(head, body)
return esc(emit(def))
end

macro adt(export_variants, head, body)
export_variants == :public || error("expect `public` after `@adt`")
def = ADTTypeDef(__module__, head, body; export_variants=true)
return esc(emit(def))
end

function emit(def::ADTTypeDef, info::EmitInfo=EmitInfo(def))
return quote
primitive type $(info.typename) 32 end
Expand Down
8 changes: 8 additions & 0 deletions test/adt/evals/test_export.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,17 @@ end
export PulseLang
@export_use PulseLang: *

@adt public Foo begin
A(::Int)
B(::Float64)
end

@testset "TestExport" begin
@test :PulseLang in names(TestExport)
@test :Waveform in names(TestExport)
@test :Foo in names(TestExport)
@test :A in names(TestExport)
@test :B in names(TestExport)
end

end # TestExport

0 comments on commit 5bf0132

Please sign in to comment.