@@ -182,9 +182,25 @@ Object doGeneric(Object self, Object other) {
182
182
@ GenerateNodeFactory
183
183
abstract static class SubNode extends PythonBinaryBuiltinNode {
184
184
@ Specialization
185
- PBaseSet doKeysView (PDictKeysView left , PDictKeysView right ,
185
+ PBaseSet doKeysView (PDictKeysView self , PBaseSet other ,
186
186
@ Cached ("create()" ) HashingStorageNodes .DiffNode diffNode ) {
187
- HashingStorage storage = diffNode .execute (left .getDict ().getDictStorage (), right .getDict ().getDictStorage ());
187
+ HashingStorage storage = diffNode .execute (self .getDict ().getDictStorage (), other .getDictStorage ());
188
+ return factory ().createSet (storage );
189
+ }
190
+
191
+ @ Specialization
192
+ PBaseSet doKeysView (PDictKeysView self , PDictKeysView other ,
193
+ @ Cached ("create()" ) HashingStorageNodes .DiffNode diffNode ) {
194
+ HashingStorage storage = diffNode .execute (self .getDict ().getDictStorage (), other .getDict ().getDictStorage ());
195
+ return factory ().createSet (storage );
196
+ }
197
+
198
+ @ Specialization
199
+ PBaseSet doItemsView (PDictItemsView self , PBaseSet other ,
200
+ @ Cached ("create()" ) HashingStorageNodes .DiffNode diffNode ,
201
+ @ Cached ("create()" ) SetNodes .ConstructSetNode constructSetNode ) {
202
+ PSet selfSet = constructSetNode .executeWith (self );
203
+ HashingStorage storage = diffNode .execute (selfSet .getDictStorage (), other .getDictStorage ());
188
204
return factory ().createSet (storage );
189
205
}
190
206
@@ -202,13 +218,29 @@ PBaseSet doItemsView(PDictItemsView self, PDictItemsView other,
202
218
@ Builtin (name = __AND__ , fixedNumOfArguments = 2 )
203
219
@ GenerateNodeFactory
204
220
abstract static class AndNode extends PythonBinaryBuiltinNode {
221
+ @ Specialization
222
+ PBaseSet doKeysView (PDictKeysView self , PBaseSet other ,
223
+ @ Cached ("create()" ) HashingStorageNodes .IntersectNode intersectNode ) {
224
+ HashingStorage intersectedStorage = intersectNode .execute (self .getDict ().getDictStorage (), other .getDictStorage ());
225
+ return factory ().createSet (intersectedStorage );
226
+ }
227
+
205
228
@ Specialization
206
229
PBaseSet doKeysView (PDictKeysView self , PDictKeysView other ,
207
230
@ Cached ("create()" ) HashingStorageNodes .IntersectNode intersectNode ) {
208
231
HashingStorage intersectedStorage = intersectNode .execute (self .getDict ().getDictStorage (), other .getDict ().getDictStorage ());
209
232
return factory ().createSet (intersectedStorage );
210
233
}
211
234
235
+ @ Specialization
236
+ PBaseSet doItemsView (PDictItemsView self , PBaseSet other ,
237
+ @ Cached ("create()" ) HashingStorageNodes .IntersectNode intersectNode ,
238
+ @ Cached ("create()" ) SetNodes .ConstructSetNode constructSetNode ) {
239
+ PSet selfSet = constructSetNode .executeWith (self );
240
+ HashingStorage intersectedStorage = intersectNode .execute (selfSet .getDictStorage (), other .getDictStorage ());
241
+ return factory ().createSet (intersectedStorage );
242
+ }
243
+
212
244
@ Specialization
213
245
PBaseSet doItemsView (PDictItemsView self , PDictItemsView other ,
214
246
@ Cached ("create()" ) HashingStorageNodes .IntersectNode intersectNode ,
@@ -223,12 +255,26 @@ PBaseSet doItemsView(PDictItemsView self, PDictItemsView other,
223
255
@ Builtin (name = __OR__ , fixedNumOfArguments = 2 )
224
256
@ GenerateNodeFactory
225
257
public abstract static class OrNode extends PythonBuiltinNode {
258
+ @ Specialization
259
+ PBaseSet doKeysView (PDictKeysView self , PBaseSet other ,
260
+ @ Cached ("create()" ) HashingStorageNodes .UnionNode unionNode ) {
261
+ return factory ().createSet (unionNode .execute (self .getDict ().getDictStorage (), other .getDictStorage ()));
262
+ }
263
+
226
264
@ Specialization
227
265
PBaseSet doKeysView (PDictKeysView self , PDictKeysView other ,
228
266
@ Cached ("create()" ) HashingStorageNodes .UnionNode unionNode ) {
229
267
return factory ().createSet (unionNode .execute (self .getDict ().getDictStorage (), other .getDict ().getDictStorage ()));
230
268
}
231
269
270
+ @ Specialization
271
+ PBaseSet doItemsView (PDictItemsView self , PBaseSet other ,
272
+ @ Cached ("create()" ) HashingStorageNodes .UnionNode unionNode ,
273
+ @ Cached ("create()" ) SetNodes .ConstructSetNode constructSetNode ) {
274
+ PSet selfSet = constructSetNode .executeWith (self );
275
+ return factory ().createSet (unionNode .execute (selfSet .getDictStorage (), other .getDictStorage ()));
276
+ }
277
+
232
278
@ Specialization
233
279
PBaseSet doItemsView (PDictItemsView self , PDictItemsView other ,
234
280
@ Cached ("create()" ) HashingStorageNodes .UnionNode unionNode ,
@@ -242,12 +288,26 @@ PBaseSet doItemsView(PDictItemsView self, PDictItemsView other,
242
288
@ Builtin (name = __XOR__ , fixedNumOfArguments = 2 )
243
289
@ GenerateNodeFactory
244
290
public abstract static class XorNode extends PythonBuiltinNode {
291
+ @ Specialization
292
+ PBaseSet doKeysView (PDictKeysView self , PBaseSet other ,
293
+ @ Cached ("create()" ) HashingStorageNodes .ExclusiveOrNode xorNode ) {
294
+ return factory ().createSet (xorNode .execute (self .getDict ().getDictStorage (), other .getDictStorage ()));
295
+ }
296
+
245
297
@ Specialization
246
298
PBaseSet doKeysView (PDictKeysView self , PDictKeysView other ,
247
299
@ Cached ("create()" ) HashingStorageNodes .ExclusiveOrNode xorNode ) {
248
300
return factory ().createSet (xorNode .execute (self .getDict ().getDictStorage (), other .getDict ().getDictStorage ()));
249
301
}
250
302
303
+ @ Specialization
304
+ PBaseSet doItemsView (PDictItemsView self , PBaseSet other ,
305
+ @ Cached ("create()" ) HashingStorageNodes .ExclusiveOrNode xorNode ,
306
+ @ Cached ("create()" ) SetNodes .ConstructSetNode constructSetNode ) {
307
+ PSet selfSet = constructSetNode .executeWith (self );
308
+ return factory ().createSet (xorNode .execute (selfSet .getDictStorage (), other .getDictStorage ()));
309
+ }
310
+
251
311
@ Specialization
252
312
PBaseSet doItemsView (PDictItemsView self , PDictItemsView other ,
253
313
@ Cached ("create()" ) HashingStorageNodes .ExclusiveOrNode xorNode ,
0 commit comments