Add assigns functions and assign_async
Add support to other assign functions and add support for assign_async.
@hansihe I'm tring to add support for assing_async, but I'm facing a issue when the code is compiled:
================ INTERNAL DEFT COMPILER ERROR ================
Internal error in LiveData deft compiler while compiling `Elixir.LiveData.Test.AsyncTestingData.render/1` in `/Users/rodolfosilva/workspace/labs/live_data/test/support/data/async_testing_data.ex`.
This is a bug in LiveData. Please submit an issue at https://github.com/hansihe/live_data.
Make sure to include the source code of the function named above in the issue.
==============================================================
== Compilation error in file test/support/data/async_testing_data.ex ==
** (FunctionClauseError) no function clause matching in LiveData.Tracked.FlatAst.Expr.Fn.add_clause/6
The following arguments were given to LiveData.Tracked.FlatAst.Expr.Fn.add_clause/6:
# 1
%LiveData.Tracked.FlatAst.Expr.Fn{arity: 0, clauses: [], location: {14, nil}}
# 2
[]
# 3
MapSet.new([])
# 4
nil
# 5
{:literal, 19}
# 6
{14, nil}
lib/live_data/tracked/flat_ast/expr/fn.ex:27: LiveData.Tracked.FlatAst.Expr.Fn.add_clause/6
(elixir 1.14.2) lib/enum.ex:2468: Enum."-reduce/3-lists^foldl/2-0-"/3
lib/live_data/tracked/flat_ast/from_ast.ex:160: LiveData.Tracked.FlatAst.FromAst.from_expr/3
(elixir 1.14.2) lib/enum.ex:1780: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3
(elixir 1.14.2) lib/enum.ex:1780: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3
lib/live_data/tracked/flat_ast/from_ast.ex:287: LiveData.Tracked.FlatAst.FromAst.from_expr/3
lib/live_data/tracked/flat_ast/from_ast.ex:302: LiveData.Tracked.FlatAst.FromAst.from_expr/3
lib/live_data/tracked/flat_ast/from_ast.ex:303: LiveData.Tracked.FlatAst.FromAst.from_expr/3
Could you help me solve this problem? Feel free to edit the PR.
I would appreciate if you could open separate issues about errors like this in the future :)
The error you got should be fixed in https://github.com/hansihe/live_data/commit/bae8eb83144496197ef9387b5324bf1a23c7716e
As a separate point, while higher order functions like that does work in tracked functions, they are not really a good idea to use. They are a black box to the deft compiler, and disable change tracking for anything within them.
There are solutions for this on the roadmap, but there are other things that are higher priority for now.
Ok, thank you @hansihe. In the future I'll opena a speareted issue.