Lichen

Changeset

892:93b66cd78985
2019-02-02 Paul Boddie raw files shortlog changelog graph Merged changes from trailing-data. float-preallocation
     1.1 --- a/deducer.py	Fri Feb 01 01:30:23 2019 +0100
     1.2 +++ b/deducer.py	Sat Feb 02 17:55:21 2019 +0100
     1.3 @@ -2347,6 +2347,10 @@
     1.4          remaining = attrnames.split(".")
     1.5          attrname = remaining[0]
     1.6  
     1.7 +        # Special case for the ubiquitous __class__ attribute.
     1.8 +
     1.9 +        ubiquitous = attrname == "__class__"
    1.10 +
    1.11          # Obtain reference, provider and provider kind information.
    1.12  
    1.13          attrs = self.reference_all_attrs[location]
    1.14 @@ -2375,8 +2379,8 @@
    1.15  
    1.16          # Determine how attributes may be accessed relative to the accessor.
    1.17  
    1.18 -        object_relative = class_accessor or module_accessor or provided_by_instance
    1.19 -        class_relative = instance_accessor and provided_by_class
    1.20 +        object_relative = ubiquitous or class_accessor or module_accessor or provided_by_instance
    1.21 +        class_relative = not ubiquitous and instance_accessor and provided_by_class
    1.22  
    1.23          # Identify the last static attribute for context acquisition.
    1.24  
    1.25 @@ -2517,6 +2521,11 @@
    1.26              first_method = "relative" + (object_relative and "-object" or "") + \
    1.27                                          (class_relative and "-class" or "")
    1.28  
    1.29 +        # Special case for the ubiquitous __class__ attribute.
    1.30 +
    1.31 +        elif ubiquitous:
    1.32 +            first_method = "relative-object"
    1.33 +
    1.34          # The fallback case is always run-time testing and access.
    1.35  
    1.36          else:
     2.1 --- a/templates/ops.c	Fri Feb 01 01:30:23 2019 +0100
     2.2 +++ b/templates/ops.c	Sat Feb 02 17:55:21 2019 +0100
     2.3 @@ -401,11 +401,6 @@
     2.4      return __test_specific_instance(obj, &__FUNCTION_TYPE);
     2.5  }
     2.6  
     2.7 -int __ISNULL(__attr value)
     2.8 -{
     2.9 -    return (value.value == 0); /* __NULL.value */
    2.10 -}
    2.11 -
    2.12  /* Attribute codes and positions for type objects. */
    2.13  
    2.14  unsigned int __TYPECODE(__ref obj)
     3.1 --- a/templates/ops.h	Fri Feb 01 01:30:23 2019 +0100
     3.2 +++ b/templates/ops.h	Sat Feb 02 17:55:21 2019 +0100
     3.3 @@ -135,7 +135,8 @@
     3.4  /* Type testing. */
     3.5  
     3.6  __ref __ISFUNC(__ref obj);
     3.7 -int __ISNULL(__attr value);
     3.8 +
     3.9 +#define __ISNULL(__ATTR) (!__ATTR.value)
    3.10  
    3.11  /* Attribute codes and positions for type objects. */
    3.12