Lichen

Change of templates/ops.c

900:c7eaa76e5b0f
templates/ops.c temporary-object-experiment
     1.1 --- a/templates/ops.c	Mon Feb 04 18:53:56 2019 +0100
     1.2 +++ b/templates/ops.c	Mon May 20 13:12:25 2019 +0200
     1.3 @@ -79,12 +79,31 @@
     1.4  
     1.5  /* Direct storage operations. */
     1.6  
     1.7 -int __store_via_object__(__ref obj, int pos, __attr value)
     1.8 +__attr __store_attr__(__attr value)
     1.9 +{
    1.10 +    if (!__ISNULL(value) && !__INTEGER(value) && value.value->temporary)
    1.11 +        value.value->temporary = 0;
    1.12 +
    1.13 +    return value;
    1.14 +}
    1.15 +
    1.16 +int __store_member__(__ref obj, int pos, __attr value)
    1.17  {
    1.18      obj->attrs[pos] = value;
    1.19      return 1;
    1.20  }
    1.21  
    1.22 +int __store_via_object__(__ref obj, int pos, __attr value)
    1.23 +{
    1.24 +    /* NOTE: To be tested at compile-time, with dynamic attribute access
    1.25 +             forbidding special attributes. */
    1.26 +
    1.27 +    if ((pos != __ATTRPOS(__data__)) && (pos != __ATTRPOS(__key__)))
    1.28 +        __store_attr__(value);
    1.29 +
    1.30 +    return __store_member__(obj, pos, value);
    1.31 +}
    1.32 +
    1.33  int __store_via_class__(__ref obj, int pos, __attr value)
    1.34  {
    1.35      return __store_via_object__(__get_class(obj), pos, value);