1 AST Node Annotations
2 ====================
3
4 These annotations are defined in the revised compiler.ast classes.
5
6 Deduction Results
7 -----------------
8
9 _access_attrs the deduced attributes involved in an access provided as
10 a collection of (attribute, value) pairs, where the value
11 may be None; details of the deductions are given in the
12 following annotations
13 _access_type ("constant", "static", "positioned", "instance",
14 "impossible")
15 defines the kind of access involved for a particular node
16 and determines which of the following annotations will be
17 employed, except for "impossible" which indicates an error
18 condition
19 _value_deduced (_access_type is "constant")
20 defines a specific result associated with an attribute
21 access during deduction and based on inspection results
22 _attr_deduced (_access_type is "static" or "instance")
23 defines an attribute result according to deduction based
24 on inspection results, with the accessor being the parent
25 defined in this object for static attributes
26 _position_deduced (_access_type is "positioned")
27 defines a common position employed by all deduced
28 attributes for an access operation which is relative to
29 the accessor evaluated at run time
30 _set_context (_access_type is "constant" or "static")
31 ("set", "cond", None)
32 indicates the deduced effect on the context in an access
33 operation, whether the context would be replaced
34 unconditionally or conditionally
35
36
37 _attrs_deduced_from_specific_usage
38 _attrs_deduced_from_usage
39 _attrs_deduced
40 provided as additional annotations more suitable for
41 report generation than code generation, since they
42 describe a range of deduced attributes for a given node,
43 but such ranges may not lend themselves to the generation
44 of optimised code
45
46 Evaluation Results
47 ------------------
48
49 _attr (may identify static attributes for classes and modules,
50 is otherwise given as a general instance)
51 notes the result associated with an attribute access
52 operation during inspection; this may be a general
53 instance providing no specific information about the
54 nature of an attribute
55 _expr records the result of evaluating an expression used in an
56 attribute access operation
57
58 Attribute Users
59 ---------------
60
61 _attrtypes defines types deduced from combined attribute usage
62 details (for users), indicating a set of (attribute,
63 value) tuples for each name
64 _values defines a name-to-value mapping for objects that may be
65 used to access attributes
66 _guard_types mapping from names to ("single", "multiple", "impossible")
67 defines the nature of any type check upon assignment of an
68 object to a name/user; an impossible guard occurs when
69 concrete type information conflicts with deduced type
70 information
71 _guards a mapping to a set of actual guard types to which the
72 assigned object must comply
73
74 Attribute Contributors
75 ----------------------
76
77 _attrnames defines a dictionary mapping local names to sets of
78 attribute names found to be used with those names in a
79 branch
80 _attrbranches indicates the immediate contributors to attribute usage
81 known to a node
82 _attrcontributors defines nodes contributing to combined attribute usage known
83 to a node (and is thus the accumulation of all contributors
84 via branches)
85 _attrdefs defines definition-related users which consume usage details
86 from the node (and is thus the accumulation of all
87 definitions affected by the node)
88 _attrcombined defines a dictionary mapping local names to sets of
89 attribute names found to be used with those names for the
90 entire lifetime of a particular attribute user
91 _attrmerged defines a dictionary mapping local names to sets of
92 attribute names merging combined observations with locally
93 applicable observations, indicating usage specific to a
94 region of the code
95 _attrspecifictypes defines specific types from merged attribute usage details
96 (for non-user nodes)
97
98 Attribute Accessors
99 -------------------
100
101 _attrusers defines a dictionary mapping local names to sets of nodes
102 defining those names
103 _username indicates the name of the attribute user involved in an
104 access operation
105
106 Name Accessors
107 --------------
108
109 _scope set as "constant", "local", "global" or "builtins"
110
111 Program Units
112 -------------
113
114 unit refers to a micropython Class, Function or Module instance