51
51
import static com .oracle .graal .python .nodes .SpecialMethodNames .J___NEW__ ;
52
52
import static com .oracle .graal .python .nodes .StringLiterals .T_EMPTY_STRING ;
53
53
import static com .oracle .graal .python .runtime .exception .PythonErrorType .TypeError ;
54
- import static com .oracle .graal .python .util .PythonUtils .tsLiteral ;
55
54
56
55
import java .util .List ;
57
56
69
68
import com .oracle .graal .python .lib .PyObjectGetAttr ;
70
69
import com .oracle .graal .python .nodes .PNodeWithContext ;
71
70
import com .oracle .graal .python .nodes .PRaiseNode ;
71
+ import com .oracle .graal .python .nodes .StringLiterals ;
72
72
import com .oracle .graal .python .nodes .function .PythonBuiltinBaseNode ;
73
73
import com .oracle .graal .python .nodes .function .builtins .PythonBinaryClinicBuiltinNode ;
74
74
import com .oracle .graal .python .nodes .function .builtins .PythonTernaryBuiltinNode ;
75
- import com .oracle .graal .python .nodes .function .builtins .PythonTernaryClinicBuiltinNode ;
76
75
import com .oracle .graal .python .nodes .function .builtins .PythonUnaryBuiltinNode ;
77
76
import com .oracle .graal .python .nodes .function .builtins .clinic .ArgumentClinicProvider ;
78
77
import com .oracle .graal .python .nodes .object .GetClassNode ;
@@ -101,8 +100,6 @@ protected List<? extends NodeFactory<? extends PythonBuiltinBaseNode>> getNodeFa
101
100
@ GenerateNodeFactory
102
101
protected abstract static class NewNode extends PythonTernaryBuiltinNode {
103
102
104
- private static final TruffleString CODEC = tsLiteral ("codec" );
105
-
106
103
@ Specialization
107
104
static Object mbstreamreaderNew (VirtualFrame frame , Object type , Object stream , Object err ,
108
105
@ Bind ("this" ) Node inliningTarget ,
@@ -118,7 +115,7 @@ static Object mbstreamreaderNew(VirtualFrame frame, Object type, Object stream,
118
115
}
119
116
120
117
MultibyteStreamReaderObject self = factory .createMultibyteStreamReaderObject (type );
121
- Object codec = getAttr .execute (frame , inliningTarget , type , CODEC );
118
+ Object codec = getAttr .execute (frame , inliningTarget , type , StringLiterals . T_CODEC );
122
119
if (!(codec instanceof MultibyteCodecObject )) {
123
120
throw raiseNode .get (inliningTarget ).raise (TypeError , CODEC_IS_UNEXPECTED_TYPE );
124
121
}
@@ -232,40 +229,36 @@ static TruffleString iread(VirtualFrame frame, MultibyteStreamReaderObject self,
232
229
@ Builtin (name = "read" , minNumOfPositionalArgs = 1 , parameterNames = {"$self" , "sizeobj" }, doc = "read($self, sizeobj=None, /)\n --\n \n " )
233
230
@ ArgumentClinic (name = "sizeobj" , conversion = ArgumentClinic .ClinicConversion .Long , defaultValue = "-1" , useDefaultForNone = true )
234
231
@ GenerateNodeFactory
235
- abstract static class ReadNode extends PythonTernaryClinicBuiltinNode {
232
+ abstract static class ReadNode extends PythonBinaryClinicBuiltinNode {
236
233
237
234
@ Override
238
235
protected ArgumentClinicProvider getArgumentClinic () {
239
236
return MultibyteStreamReaderBuiltinsClinicProviders .ReadNodeClinicProviderGen .INSTANCE ;
240
237
}
241
238
242
- private static final TruffleString READ = tsLiteral ("read" );
243
-
244
239
// _multibytecodec_MultibyteStreamReader_read_impl
245
240
@ Specialization
246
- Object read (VirtualFrame frame , MultibyteStreamReaderObject self , long size ,
241
+ static Object read (VirtualFrame frame , MultibyteStreamReaderObject self , long size ,
247
242
@ Cached IReadNode iReadNode ) {
248
- return iReadNode .execute (frame , self , READ , size );
243
+ return iReadNode .execute (frame , self , StringLiterals . T_READ , size );
249
244
}
250
245
}
251
246
252
247
@ Builtin (name = "readline" , minNumOfPositionalArgs = 1 , parameterNames = {"$self" , "sizeobj" }, doc = "readline($self, sizeobj=None, /)\n --\n \n " )
253
248
@ ArgumentClinic (name = "sizeobj" , conversion = ArgumentClinic .ClinicConversion .Long , defaultValue = "-1" , useDefaultForNone = true )
254
249
@ GenerateNodeFactory
255
- abstract static class ReadlineNode extends PythonTernaryClinicBuiltinNode {
250
+ abstract static class ReadlineNode extends PythonBinaryClinicBuiltinNode {
256
251
257
252
@ Override
258
253
protected ArgumentClinicProvider getArgumentClinic () {
259
254
return MultibyteStreamReaderBuiltinsClinicProviders .ReadlineNodeClinicProviderGen .INSTANCE ;
260
255
}
261
256
262
- private static final TruffleString READLINE = tsLiteral ("readline" );
263
-
264
257
// _multibytecodec_MultibyteStreamReader_readline_impl
265
258
@ Specialization
266
- Object readline (VirtualFrame frame , MultibyteStreamReaderObject self , long size ,
259
+ static Object readline (VirtualFrame frame , MultibyteStreamReaderObject self , long size ,
267
260
@ Cached IReadNode iReadNode ) {
268
- return iReadNode .execute (frame , self , READLINE , size );
261
+ return iReadNode .execute (frame , self , StringLiterals . T_READLINE , size );
269
262
}
270
263
}
271
264
@@ -279,14 +272,12 @@ protected ArgumentClinicProvider getArgumentClinic() {
279
272
return MultibyteStreamReaderBuiltinsClinicProviders .ReadlinesNodeClinicProviderGen .INSTANCE ;
280
273
}
281
274
282
- private static final TruffleString READ = tsLiteral ("read" );
283
-
284
275
// _multibytecodec_MultibyteStreamReader_readlines_impl
285
276
@ Specialization
286
- Object readlines (VirtualFrame frame , MultibyteStreamReaderObject self , long sizehint ,
277
+ static Object readlines (VirtualFrame frame , MultibyteStreamReaderObject self , long sizehint ,
287
278
@ Cached StringBuiltins .SplitLinesNode splitLinesNode ,
288
279
@ Cached IReadNode iReadNode ) {
289
- TruffleString r = iReadNode .execute (frame , self , READ , sizehint );
280
+ TruffleString r = iReadNode .execute (frame , self , StringLiterals . T_READ , sizehint );
290
281
return splitLinesNode .execute (frame , r , true );
291
282
}
292
283
}
@@ -310,7 +301,7 @@ static Object reset(MultibyteStreamReaderObject self) {
310
301
abstract static class StreamMemberNode extends PythonUnaryBuiltinNode {
311
302
312
303
@ Specialization
313
- Object stream (MultibyteStreamReaderObject self ) {
304
+ static Object stream (MultibyteStreamReaderObject self ) {
314
305
return self .stream ;
315
306
}
316
307
}
0 commit comments