1.1 --- a/deducer.py Mon Mar 20 23:55:26 2017 +0100
1.2 +++ b/deducer.py Tue Mar 21 00:12:25 2017 +0100
1.3 @@ -2910,6 +2910,11 @@
1.4 if context_var:
1.5 emit(("<context_identity>", context_var))
1.6
1.7 + # Produce an advisory instruction regarding the final attribute.
1.8 +
1.9 + if origin:
1.10 + emit(("<final_identity>", origin))
1.11 +
1.12 self.access_instructions[access_location] = instructions
1.13 self.accessor_kinds[access_location] = accessor_kinds
1.14
2.1 --- a/translator.py Mon Mar 20 23:55:26 2017 +0100
2.2 +++ b/translator.py Tue Mar 21 00:12:25 2017 +0100
2.3 @@ -557,6 +557,7 @@
2.4
2.5 context_index = self.function_target - 1
2.6 context_identity = None
2.7 + final_identity = None
2.8
2.9 # Obtain encoded versions of each instruction, accumulating temporary
2.10 # variables.
2.11 @@ -569,6 +570,13 @@
2.12 context_identity, _substituted = encode_access_instruction_arg(instruction[1], subs, instruction[0], context_index)
2.13 continue
2.14
2.15 + # Intercept a special instruction identifying the target. The value
2.16 + # is not encoded since it is used internally.
2.17 +
2.18 + if instruction[0] == "<final_identity>":
2.19 + final_identity = instruction[1]
2.20 + continue
2.21 +
2.22 # Collect the encoded instruction, noting any temporary variables
2.23 # required by it.
2.24
2.25 @@ -582,6 +590,12 @@
2.26 if self.temp_subs.has_key(sub):
2.27 self.record_temp(self.temp_subs[sub])
2.28
2.29 + # Get full final identity details.
2.30 +
2.31 + if final_identity and not refs:
2.32 + ref = self.importer.identify(final_identity)
2.33 + refs = [ref]
2.34 +
2.35 del self.attrs[0]
2.36 return AttrResult(output, refs, location, context_identity)
2.37
2.38 @@ -629,19 +643,6 @@
2.39 identified attributes.
2.40 """
2.41
2.42 - # Find any static attribute.
2.43 -
2.44 - plan = self.deducer.access_plans.get(location)
2.45 - if plan:
2.46 - name, test, test_type, base, \
2.47 - traversed, traversal_modes, remaining, \
2.48 - context, context_test, \
2.49 - first_method, final_method, \
2.50 - origin, accessor_kinds = plan
2.51 -
2.52 - if origin:
2.53 - return [self.importer.get_object(origin)]
2.54 -
2.55 # Determine whether any deduced references refer to the accessed
2.56 # attribute.
2.57