Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated the package used for setfield #62

Merged
merged 1 commit into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
name = "MetaModelica"
uuid = "9d7f2a79-07b5-5542-8b19-c0100dda6b06"
authors = ["Martin Sjölund <martin.sjolund@liu.se>", "John Tinnerholm <john.tinnerholm@liu.se>"]
version = "0.0.4"
version = "0.0.5"

[deps]
Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
ExportAll = "ad2082ca-a69e-11e9-38fa-e96309a31fe4"
FastClosures = "9aa1b823-49e4-5ca5-8b0f-3971ec8bab6a"
ImmutableList = "4a558cac-c1ed-11e9-20da-3584bcd8709a"
MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
Setfield = "efcf1570-3423-57d1-acb7-fd33fddbac46"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[compat]
Expand Down
2 changes: 0 additions & 2 deletions src/MetaModelica.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ module MetaModelica
import MacroTools
import MacroTools: @capture
import ExportAll
import Setfield: @set!
import Setfield: @set
#=
Have to treat the types slightly different.
Precompilation of the types need to occur before everything else
Expand Down
5 changes: 3 additions & 2 deletions src/utilityMacros.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Setfield
#import Setfield
import FastClosures
import Accessors
"""
Helper function for the assignmacro, see @assign
We have one case where we assign a immutable structure to an immutable structure or something to a primitive variable.
Expand All @@ -9,7 +10,7 @@ function assignFunc(expr)
res =
if @capture(expr, lhs_._ = rhs_)
if !isprimitivetype(typeof(lhs))
Setfield.setmacro(identity, expr, overwrite=true)
Accessors.setmacro(identity, expr, overwrite=true)
else
quote
$(esc(expr))
Expand Down