File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed
Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change 11## Changelog
22
3+ ## v1.2.1
4+
5+ * Bug fixes
6+ * Fix define structure via using
7+
38## v1.2.0
49
510* Enhancements
611 * Add ` struct ` type
712
813## v1.1.1
14+
915* Enhancements
1016 * Definition in using macro
1117 * Add able to override fields
Original file line number Diff line number Diff line change @@ -31,21 +31,21 @@ defmodule Construct do
3131
3232 @ doc false
3333 defmacro __using__ ( opts \\ [ ] ) do
34- definition = Keyword . get ( opts , :do )
34+ { definition , opts } = Keyword . pop ( opts , :do )
3535
36- structure =
36+ pre_ast =
3737 if definition do
3838 defstructure ( definition )
3939 else
40- [ ]
40+ quote do
41+ import Construct , only: [ structure: 1 ]
42+ end
4143 end
4244
4345 quote do
4446 @ behaviour Construct
4547
46- import Construct , only: [ structure: 1 ]
47-
48- unquote ( structure )
48+ unquote ( pre_ast )
4949
5050 @ type t :: % __MODULE__ { }
5151
You can’t perform that action at this time.
0 commit comments