@@ -618,16 +618,6 @@ def visitField(self, field, name, sum=None, prod=None, depth=0):
618
618
self .emit ("}" , depth )
619
619
620
620
621
- class MarshalPrototypeVisitor (PickleVisitor ):
622
-
623
- def prototype (self , sum , name ):
624
- ctype = get_c_type (name )
625
- self .emit ("static int marshal_write_%s(PyObject **, int *, %s);"
626
- % (name , ctype ), 0 )
627
-
628
- visitProduct = visitSum = prototype
629
-
630
-
631
621
class SequenceConstructorVisitor (EmitVisitor ):
632
622
def visitModule (self , mod ):
633
623
for dfn in mod .dfns :
@@ -1167,25 +1157,6 @@ def addObj(self, name):
1167
1157
self .emit ("Py_INCREF(state->%s_type);" % name , 1 )
1168
1158
1169
1159
1170
- _SPECIALIZED_SEQUENCES = ('stmt' , 'expr' )
1171
-
1172
- def find_sequence (fields , doing_specialization ):
1173
- """Return True if any field uses a sequence."""
1174
- for f in fields :
1175
- if f .seq :
1176
- if not doing_specialization :
1177
- return True
1178
- if str (f .type ) not in _SPECIALIZED_SEQUENCES :
1179
- return True
1180
- return False
1181
-
1182
- def has_sequence (types , doing_specialization ):
1183
- for t in types :
1184
- if find_sequence (t .fields , doing_specialization ):
1185
- return True
1186
- return False
1187
-
1188
-
1189
1160
class StaticVisitor (PickleVisitor ):
1190
1161
CODE = '''Very simple, always emit this static code. Override CODE'''
1191
1162
@@ -1283,18 +1254,6 @@ def emit(s, d):
1283
1254
emit ("goto failed;" , 1 )
1284
1255
emit ("Py_DECREF(value);" , 0 )
1285
1256
1286
- def emitSeq (self , field , value , depth , emit ):
1287
- emit ("seq = %s;" % value , 0 )
1288
- emit ("n = asdl_seq_LEN(seq);" , 0 )
1289
- emit ("value = PyList_New(n);" , 0 )
1290
- emit ("if (!value) goto failed;" , 0 )
1291
- emit ("for (i = 0; i < n; i++) {" , 0 )
1292
- self .set ("value" , field , "asdl_seq_GET(seq, i)" , depth + 1 )
1293
- emit ("if (!value1) goto failed;" , 1 )
1294
- emit ("PyList_SET_ITEM(value, i, value1);" , 1 )
1295
- emit ("value1 = NULL;" , 1 )
1296
- emit ("}" , 0 )
1297
-
1298
1257
def set (self , field , value , depth ):
1299
1258
if field .seq :
1300
1259
# XXX should really check for is_simple, but that requires a symbol table
@@ -1313,7 +1272,6 @@ def set(self, field, value, depth):
1313
1272
else :
1314
1273
self .emit ("value = ast2obj_list(state, (asdl_seq*)%s, ast2obj_%s);" % (value , field .type ), depth )
1315
1274
else :
1316
- ctype = get_c_type (field .type )
1317
1275
self .emit ("value = ast2obj_%s(state, %s);" % (field .type , value ), depth , reflow = False )
1318
1276
1319
1277
0 commit comments