# HG changeset patch # User Paul Boddie # Date 1490051545 -3600 # Node ID 118fe46024d50171e6fc95dde99d9102bef21096 # Parent 7771170913980fd8678547b343500081e0a073da Employ a special informational instruction to identify static access targets. diff -r 777117091398 -r 118fe46024d5 deducer.py --- a/deducer.py Mon Mar 20 23:55:26 2017 +0100 +++ b/deducer.py Tue Mar 21 00:12:25 2017 +0100 @@ -2910,6 +2910,11 @@ if context_var: emit(("", context_var)) + # Produce an advisory instruction regarding the final attribute. + + if origin: + emit(("", origin)) + self.access_instructions[access_location] = instructions self.accessor_kinds[access_location] = accessor_kinds diff -r 777117091398 -r 118fe46024d5 translator.py --- a/translator.py Mon Mar 20 23:55:26 2017 +0100 +++ b/translator.py Tue Mar 21 00:12:25 2017 +0100 @@ -557,6 +557,7 @@ context_index = self.function_target - 1 context_identity = None + final_identity = None # Obtain encoded versions of each instruction, accumulating temporary # variables. @@ -569,6 +570,13 @@ context_identity, _substituted = encode_access_instruction_arg(instruction[1], subs, instruction[0], context_index) continue + # Intercept a special instruction identifying the target. The value + # is not encoded since it is used internally. + + if instruction[0] == "": + final_identity = instruction[1] + continue + # Collect the encoded instruction, noting any temporary variables # required by it. @@ -582,6 +590,12 @@ if self.temp_subs.has_key(sub): self.record_temp(self.temp_subs[sub]) + # Get full final identity details. + + if final_identity and not refs: + ref = self.importer.identify(final_identity) + refs = [ref] + del self.attrs[0] return AttrResult(output, refs, location, context_identity) @@ -629,19 +643,6 @@ identified attributes. """ - # Find any static attribute. - - plan = self.deducer.access_plans.get(location) - if plan: - name, test, test_type, base, \ - traversed, traversal_modes, remaining, \ - context, context_test, \ - first_method, final_method, \ - origin, accessor_kinds = plan - - if origin: - return [self.importer.get_object(origin)] - # Determine whether any deduced references refer to the accessed # attribute.