From: David Lutterkort <[email protected]>
If the user writes 'let rec l = rhs' and the RHS does not mention l, just
mark the lens as regular and carry on.
---
src/lens.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/src/lens.c b/src/lens.c
index 41fcd50..29859f5 100644
--- a/src/lens.c
+++ b/src/lens.c
@@ -2023,9 +2023,15 @@ struct value *lns_check_rec(struct info *info,
struct value *result = NULL;
ensure(rec->tag == L_REC, info);
- ensure(body->recursive, info);
ensure(rec->rec_internal, info);
+ /* The user might have written down a regular lens with 'let rec' */
+ if (! body->recursive) {
+ result = make_lens_value(ref(body));
+ ERR_NOMEM(result == NULL, info);
+ return result;
+ }
+
/* To help memory management, we avoid the cycle inherent ina recursive
* lens by using two instances of an L_REC lens. One is marked with
* rec_internal, and used inside the body of the lens. The other is the
--
1.7.1.1
_______________________________________________
augeas-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/augeas-devel