@@ -158,44 +158,54 @@ impl InternerGuard<'_> {
158
158
/// Returns a decision node for a single marker expression.
159
159
pub ( crate ) fn expression ( & mut self , expr : MarkerExpression ) -> NodeId {
160
160
let ( var, children) = match expr {
161
- // Normalize `python_version` markers to `python_full_version` nodes.
162
- MarkerExpression :: Version {
163
- key : MarkerValueVersion :: PythonVersion ,
164
- specifier,
165
- } => match python_version_to_full_version ( normalize_specifier ( specifier) ) {
166
- Ok ( specifier) => (
167
- Variable :: Version ( LoweredMarkerValueVersion :: PythonFullVersion ) ,
161
+ // A variable representing the output of a version key. Edges correspond
162
+ // to disjoint version ranges.
163
+ MarkerExpression :: Version { key, specifier } => match key {
164
+ MarkerValueVersion :: ImplementationVersion => (
165
+ Variable :: Version ( LoweredMarkerValueVersion :: ImplementationVersion ) ,
168
166
Edges :: from_specifier ( specifier) ,
169
167
) ,
170
- Err ( node) => return node,
171
- } ,
172
- MarkerExpression :: VersionIn {
173
- key : MarkerValueVersion :: PythonVersion ,
174
- versions,
175
- negated,
176
- } => match Edges :: from_python_versions ( versions, negated) {
177
- Ok ( edges) => (
168
+ MarkerValueVersion :: PythonFullVersion => (
178
169
Variable :: Version ( LoweredMarkerValueVersion :: PythonFullVersion ) ,
179
- edges ,
170
+ Edges :: from_specifier ( specifier ) ,
180
171
) ,
181
- Err ( node) => return node,
172
+ // Normalize `python_version` markers to `python_full_version` nodes.
173
+ MarkerValueVersion :: PythonVersion => {
174
+ match python_version_to_full_version ( normalize_specifier ( specifier) ) {
175
+ Ok ( specifier) => (
176
+ Variable :: Version ( LoweredMarkerValueVersion :: PythonFullVersion ) ,
177
+ Edges :: from_specifier ( specifier) ,
178
+ ) ,
179
+ Err ( node) => return node,
180
+ }
181
+ }
182
182
} ,
183
183
// A variable representing the output of a version key. Edges correspond
184
184
// to disjoint version ranges.
185
- MarkerExpression :: Version { key, specifier } => (
186
- Variable :: Version ( key. into ( ) ) ,
187
- Edges :: from_specifier ( specifier) ,
188
- ) ,
189
- // A variable representing the output of a version key. Edges correspond
190
- // to disjoint version ranges.
191
185
MarkerExpression :: VersionIn {
192
186
key,
193
187
versions,
194
188
negated,
195
- } => (
196
- Variable :: Version ( key. into ( ) ) ,
197
- Edges :: from_versions ( & versions, negated) ,
198
- ) ,
189
+ } => match key {
190
+ MarkerValueVersion :: ImplementationVersion => (
191
+ Variable :: Version ( LoweredMarkerValueVersion :: ImplementationVersion ) ,
192
+ Edges :: from_versions ( & versions, negated) ,
193
+ ) ,
194
+ MarkerValueVersion :: PythonFullVersion => (
195
+ Variable :: Version ( LoweredMarkerValueVersion :: PythonFullVersion ) ,
196
+ Edges :: from_versions ( & versions, negated) ,
197
+ ) ,
198
+ // Normalize `python_version` markers to `python_full_version` nodes.
199
+ MarkerValueVersion :: PythonVersion => {
200
+ match Edges :: from_python_versions ( versions, negated) {
201
+ Ok ( edges) => (
202
+ Variable :: Version ( LoweredMarkerValueVersion :: PythonFullVersion ) ,
203
+ edges,
204
+ ) ,
205
+ Err ( node) => return node,
206
+ }
207
+ }
208
+ } ,
199
209
// The `in` and `contains` operators are a bit different than other operators.
200
210
// In particular, they do not represent a particular value for the corresponding
201
211
// variable, and can overlap. For example, `'nux' in os_name` and `os_name == 'Linux'`
0 commit comments