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 but may also be
51 an unresolved name)
52 notes the result associated with an attribute access
53 operation during inspection; this may be a general
54 instance providing no specific information about the
55 nature of an attribute
56 _expr records the result of evaluating an expression used in an
57 attribute access operation
58
59 Attribute Users
60 ---------------
61
62 _attrtypes defines types deduced from combined attribute usage
63 details (for users), indicating a set of (attribute,
64 value) tuples for each name
65 _values defines a name-to-value mapping for objects that may be
66 used to access attributes
67 _guard_types mapping from names to ("single", "multiple", "impossible")
68 defines the nature of any type check upon assignment of an
69 object to a name/user; an impossible guard occurs when
70 concrete type information conflicts with deduced type
71 information
72 _guards a mapping to a set of actual guard types to which the
73 assigned object must comply
74
75 Attribute Contributors
76 ----------------------
77
78 _attrnames defines a dictionary mapping local names to sets of
79 attribute names found to be used with those names in a
80 branch
81 _attrbranches indicates the immediate contributors to attribute usage
82 known to a node
83 _attrcontributors defines nodes contributing to combined attribute usage known
84 to a node (and is thus the accumulation of all contributors
85 via branches)
86 _attrdefs defines definition-related users which consume usage details
87 from the node (and is thus the accumulation of all
88 definitions affected by the node)
89 _attrcombined defines a dictionary mapping local names to sets of
90 attribute names found to be used with those names for the
91 entire lifetime of a particular attribute user
92 _attrmerged defines a dictionary mapping local names to sets of
93 attribute names merging combined observations with locally
94 applicable observations, indicating usage specific to a
95 region of the code
96 _attrspecifictypes defines specific types from merged attribute usage details
97 (for non-user nodes)
98
99 Attribute Accessors
100 -------------------
101
102 _attrusers defines a dictionary mapping local names to sets of nodes
103 defining those names
104 _username indicates the name of the attribute user involved in an
105 access operation
106
107 Name Accessors
108 --------------
109
110 _scope set as "constant", "local", "global" or "builtins"
111
112 Program Units
113 -------------
114
115 unit refers to a micropython Class, Function or Module instance