Skip to content

Commit 8936ab2

Browse files
committed
Set ExprContext::Store on parenthesized with expressions
1 parent 052dee7 commit 8936ab2

2 files changed

Lines changed: 384 additions & 1 deletion

File tree

‎parser/src/snapshots/rustpython_parser__with__tests__with_statement.snap‎

Lines changed: 376 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2091,4 +2091,380 @@ expression: "parse_program(source, \"<test>\").unwrap()"
20912091
type_comment: None,
20922092
},
20932093
},
2094+
Located {
2095+
location: Location {
2096+
row: 23,
2097+
column: 0,
2098+
},
2099+
end_location: Some(
2100+
Location {
2101+
row: 24,
2102+
column: 0,
2103+
},
2104+
),
2105+
custom: (),
2106+
node: With {
2107+
items: [
2108+
Withitem {
2109+
context_expr: Located {
2110+
location: Location {
2111+
row: 23,
2112+
column: 6,
2113+
},
2114+
end_location: Some(
2115+
Location {
2116+
row: 23,
2117+
column: 7,
2118+
},
2119+
),
2120+
custom: (),
2121+
node: Constant {
2122+
value: Int(
2123+
0,
2124+
),
2125+
kind: None,
2126+
},
2127+
},
2128+
optional_vars: Some(
2129+
Located {
2130+
location: Location {
2131+
row: 23,
2132+
column: 11,
2133+
},
2134+
end_location: Some(
2135+
Location {
2136+
row: 23,
2137+
column: 12,
2138+
},
2139+
),
2140+
custom: (),
2141+
node: Name {
2142+
id: "a",
2143+
ctx: Store,
2144+
},
2145+
},
2146+
),
2147+
},
2148+
],
2149+
body: [
2150+
Located {
2151+
location: Location {
2152+
row: 23,
2153+
column: 15,
2154+
},
2155+
end_location: Some(
2156+
Location {
2157+
row: 23,
2158+
column: 19,
2159+
},
2160+
),
2161+
custom: (),
2162+
node: Pass,
2163+
},
2164+
],
2165+
type_comment: None,
2166+
},
2167+
},
2168+
Located {
2169+
location: Location {
2170+
row: 24,
2171+
column: 0,
2172+
},
2173+
end_location: Some(
2174+
Location {
2175+
row: 25,
2176+
column: 0,
2177+
},
2178+
),
2179+
custom: (),
2180+
node: With {
2181+
items: [
2182+
Withitem {
2183+
context_expr: Located {
2184+
location: Location {
2185+
row: 24,
2186+
column: 6,
2187+
},
2188+
end_location: Some(
2189+
Location {
2190+
row: 24,
2191+
column: 7,
2192+
},
2193+
),
2194+
custom: (),
2195+
node: Constant {
2196+
value: Int(
2197+
0,
2198+
),
2199+
kind: None,
2200+
},
2201+
},
2202+
optional_vars: Some(
2203+
Located {
2204+
location: Location {
2205+
row: 24,
2206+
column: 11,
2207+
},
2208+
end_location: Some(
2209+
Location {
2210+
row: 24,
2211+
column: 12,
2212+
},
2213+
),
2214+
custom: (),
2215+
node: Name {
2216+
id: "a",
2217+
ctx: Store,
2218+
},
2219+
},
2220+
),
2221+
},
2222+
],
2223+
body: [
2224+
Located {
2225+
location: Location {
2226+
row: 24,
2227+
column: 16,
2228+
},
2229+
end_location: Some(
2230+
Location {
2231+
row: 24,
2232+
column: 20,
2233+
},
2234+
),
2235+
custom: (),
2236+
node: Pass,
2237+
},
2238+
],
2239+
type_comment: None,
2240+
},
2241+
},
2242+
Located {
2243+
location: Location {
2244+
row: 25,
2245+
column: 0,
2246+
},
2247+
end_location: Some(
2248+
Location {
2249+
row: 26,
2250+
column: 0,
2251+
},
2252+
),
2253+
custom: (),
2254+
node: With {
2255+
items: [
2256+
Withitem {
2257+
context_expr: Located {
2258+
location: Location {
2259+
row: 25,
2260+
column: 6,
2261+
},
2262+
end_location: Some(
2263+
Location {
2264+
row: 25,
2265+
column: 7,
2266+
},
2267+
),
2268+
custom: (),
2269+
node: Constant {
2270+
value: Int(
2271+
0,
2272+
),
2273+
kind: None,
2274+
},
2275+
},
2276+
optional_vars: Some(
2277+
Located {
2278+
location: Location {
2279+
row: 25,
2280+
column: 11,
2281+
},
2282+
end_location: Some(
2283+
Location {
2284+
row: 25,
2285+
column: 12,
2286+
},
2287+
),
2288+
custom: (),
2289+
node: Name {
2290+
id: "a",
2291+
ctx: Store,
2292+
},
2293+
},
2294+
),
2295+
},
2296+
Withitem {
2297+
context_expr: Located {
2298+
location: Location {
2299+
row: 25,
2300+
column: 14,
2301+
},
2302+
end_location: Some(
2303+
Location {
2304+
row: 25,
2305+
column: 15,
2306+
},
2307+
),
2308+
custom: (),
2309+
node: Constant {
2310+
value: Int(
2311+
1,
2312+
),
2313+
kind: None,
2314+
},
2315+
},
2316+
optional_vars: Some(
2317+
Located {
2318+
location: Location {
2319+
row: 25,
2320+
column: 19,
2321+
},
2322+
end_location: Some(
2323+
Location {
2324+
row: 25,
2325+
column: 20,
2326+
},
2327+
),
2328+
custom: (),
2329+
node: Name {
2330+
id: "b",
2331+
ctx: Store,
2332+
},
2333+
},
2334+
),
2335+
},
2336+
],
2337+
body: [
2338+
Located {
2339+
location: Location {
2340+
row: 25,
2341+
column: 23,
2342+
},
2343+
end_location: Some(
2344+
Location {
2345+
row: 25,
2346+
column: 27,
2347+
},
2348+
),
2349+
custom: (),
2350+
node: Pass,
2351+
},
2352+
],
2353+
type_comment: None,
2354+
},
2355+
},
2356+
Located {
2357+
location: Location {
2358+
row: 26,
2359+
column: 0,
2360+
},
2361+
end_location: Some(
2362+
Location {
2363+
row: 27,
2364+
column: 0,
2365+
},
2366+
),
2367+
custom: (),
2368+
node: With {
2369+
items: [
2370+
Withitem {
2371+
context_expr: Located {
2372+
location: Location {
2373+
row: 26,
2374+
column: 6,
2375+
},
2376+
end_location: Some(
2377+
Location {
2378+
row: 26,
2379+
column: 7,
2380+
},
2381+
),
2382+
custom: (),
2383+
node: Constant {
2384+
value: Int(
2385+
0,
2386+
),
2387+
kind: None,
2388+
},
2389+
},
2390+
optional_vars: Some(
2391+
Located {
2392+
location: Location {
2393+
row: 26,
2394+
column: 11,
2395+
},
2396+
end_location: Some(
2397+
Location {
2398+
row: 26,
2399+
column: 12,
2400+
},
2401+
),
2402+
custom: (),
2403+
node: Name {
2404+
id: "a",
2405+
ctx: Store,
2406+
},
2407+
},
2408+
),
2409+
},
2410+
Withitem {
2411+
context_expr: Located {
2412+
location: Location {
2413+
row: 26,
2414+
column: 14,
2415+
},
2416+
end_location: Some(
2417+
Location {
2418+
row: 26,
2419+
column: 15,
2420+
},
2421+
),
2422+
custom: (),
2423+
node: Constant {
2424+
value: Int(
2425+
1,
2426+
),
2427+
kind: None,
2428+
},
2429+
},
2430+
optional_vars: Some(
2431+
Located {
2432+
location: Location {
2433+
row: 26,
2434+
column: 19,
2435+
},
2436+
end_location: Some(
2437+
Location {
2438+
row: 26,
2439+
column: 20,
2440+
},
2441+
),
2442+
custom: (),
2443+
node: Name {
2444+
id: "b",
2445+
ctx: Store,
2446+
},
2447+
},
2448+
),
2449+
},
2450+
],
2451+
body: [
2452+
Located {
2453+
location: Location {
2454+
row: 26,
2455+
column: 24,
2456+
},
2457+
end_location: Some(
2458+
Location {
2459+
row: 26,
2460+
column: 28,
2461+
},
2462+
),
2463+
custom: (),
2464+
node: Pass,
2465+
},
2466+
],
2467+
type_comment: None,
2468+
},
2469+
},
20942470
]

0 commit comments

Comments
 (0)