Currently reading a file with an uneval form results in an error, operation not permitted.
As rewrite-clj loops through files, it skips whitespaces and comments but does not skip uneval forms such as #_[re-com.core ...]. This makes it extremely hard for us to know if the current component we are looping is an uneval form or code to execute.
For example if we have the component
If rewrite-clj.zip/next would skip uneval forms, we would've expected the next location, as we loop, to follow the path:
[h-box ...] -> h-box -> :size -> "1" -> :children -> [#_[title ...]...] -> [v-box...] -> :children -> [] -> etc
If rewrite-clj would have treated uneval forms as flat objects like strings we would've looped through:
[h-box ...] -> h-box -> :size -> "1" -> :children -> [#_[title ...]...] -> #_[title...] -> [v-box...] -> :children -> [] -> etc
Notice that currently rewrite-clj.zip/next finds #_[title :label "Hidden"] and on the next iteration loops through [title :label "Hidden"]. This makes it hard for us to know if the current component is an uneval form or code to be executed.
This PR prevents the error from being thrown but prints to the console when an uneval form is found.
In case the uneval form is a commented re-com component, it gets :src annotations added to it since rewrite-clj does not skip uneval forms as mentioned in this issue
Currently reading a file with an uneval form results in an error,
operation not permitted
. As rewrite-clj loops through files, it skips whitespaces and comments but does not skip uneval forms such as#_[re-com.core ...]
. This makes it extremely hard for us to know if the current component we are looping is an uneval form or code to execute. For example if we have the componentIf
rewrite-clj.zip/next
would skip uneval forms, we would've expected the next location, as we loop, to follow the path:[h-box ...]
->h-box
->:size
->"1"
->:children
->[#_[title ...]...]
->[v-box...]
->:children
->[]
-> etcIf
rewrite-clj
would have treated uneval forms as flat objects like strings we would've looped through:[h-box ...]
->h-box
->:size
->"1"
->:children
->[#_[title ...]...]
->#_[title...]
->[v-box...]
->:children
->[]
-> etcbut instead follows the path
[h-box ...]
->h-box
->:size
->"1"
->:children
->[#_[title ...]...]
->#_[title...]
->[title ...]
->:label
->"Hidden"
->[v-box...]
->:children
->[]
-> etcNotice that currently
rewrite-clj.zip/next
finds#_[title :label "Hidden"]
and on the next iteration loops through[title :label "Hidden"]
. This makes it hard for us to know if the current component is an uneval form or code to be executed.This PR prevents the error from being thrown but prints to the console when an uneval form is found. In case the uneval form is a commented re-com component, it gets
:src
annotations added to it since rewrite-clj does not skip uneval forms as mentioned in this issue