Lichen

Change of deducer.py

826:3ca76e669ee0
deducer.py
     1.1 --- a/deducer.py	Fri Jun 22 17:13:29 2018 +0200
     1.2 +++ b/deducer.py	Fri Jun 22 17:14:22 2018 +0200
     1.3 @@ -2845,18 +2845,27 @@
     1.4  
     1.5                      remaining -= 1
     1.6  
     1.7 +            # Make any accessor test available if not emitted.
     1.8 +
     1.9 +            test_accessor = not instructions and test_accessor or None
    1.10 +
    1.11              # Define or emit the means of accessing the actual target.
    1.12  
    1.13 -            # Assignments to known attributes.
    1.14 -
    1.15 -            if final_method == "static-assign":
    1.16 -                parent, attrname = origin.rsplit(".", 1)
    1.17 -                emit(("__store_via_object", parent, attrname, "<assexpr>"))
    1.18 -
    1.19 -            # Invoked attributes employ a separate context.
    1.20 -
    1.21 -            elif final_method in ("static", "static-invoke"):
    1.22 -                accessor = ("__load_static_ignore", origin)
    1.23 +            if final_method in ("static", "static-assign", "static-invoke"):
    1.24 +
    1.25 +                if test_accessor:
    1.26 +                    emit(test_accessor)
    1.27 +
    1.28 +                # Assignments to known attributes.
    1.29 +
    1.30 +                if final_method == "static-assign":
    1.31 +                    parent, attrname = origin.rsplit(".", 1)
    1.32 +                    emit(("__store_via_object", parent, attrname, "<assexpr>"))
    1.33 +
    1.34 +                # Invoked attributes employ a separate context.
    1.35 +
    1.36 +                elif final_method in ("static", "static-invoke"):
    1.37 +                    accessor = ("__load_static_ignore", origin)
    1.38  
    1.39              # Wrap accesses in context operations.
    1.40  
    1.41 @@ -2910,7 +2919,8 @@
    1.42                      emit(("__update_context", context_var, accessor))
    1.43  
    1.44              # Omit the accessor for assignments and for invocations of static
    1.45 -            # targets.
    1.46 +            # targets. Otherwise, emit the accessor which may involve the
    1.47 +            # invocation of a test.
    1.48  
    1.49              elif final_method not in ("assign", "static-assign", "static-invoke"):
    1.50                  emit(accessor)