@@ -4368,6 +4368,30 @@ compiler_joined_str(struct compiler *c, expr_ty e)
4368
4368
return SUCCESS ;
4369
4369
}
4370
4370
4371
+ /* Used to implement tag strings */
4372
+ static int
4373
+ compiler_tag_string (struct compiler * c , expr_ty e )
4374
+ {
4375
+ location loc = LOC (e );
4376
+ if (e -> kind == TagString_kind ) {
4377
+ expr_ty tag = e -> v .TagString .tag ;
4378
+ expr_ty str = e -> v .TagString .str ;
4379
+ if (tag -> kind == Name_kind ) {
4380
+ if (str -> kind == JoinedStr_kind ) {
4381
+ // Generate code for tag(str1, str2, ...)
4382
+ asdl_keyword_seq * keywords =
4383
+ _Py_asdl_keyword_seq_new (0 , c -> c_arena );
4384
+ if (keywords == NULL )
4385
+ return 0 ;
4386
+ ADDOP (c , loc , PUSH_NULL );
4387
+ VISIT (c , expr , tag );
4388
+ return compiler_call_helper (c , loc , 0 , str -> v .JoinedStr .values , keywords );
4389
+ }
4390
+ }
4391
+ }
4392
+ return compiler_error (c , loc , "More complicated tag-string not yet supported" );
4393
+ }
4394
+
4371
4395
/* Used to implement f-strings. Format a single value. */
4372
4396
static int
4373
4397
compiler_formatted_value (struct compiler * c , expr_ty e )
@@ -5289,6 +5313,8 @@ compiler_visit_expr1(struct compiler *c, expr_ty e)
5289
5313
break ;
5290
5314
case JoinedStr_kind :
5291
5315
return compiler_joined_str (c , e );
5316
+ case TagString_kind :
5317
+ return compiler_tag_string (c , e );
5292
5318
case FormattedValue_kind :
5293
5319
return compiler_formatted_value (c , e );
5294
5320
/* The following exprs can be assignment targets. */
0 commit comments