@@ -21,22 +21,22 @@ use malachite_bigint::BigInt;
2121use num_complex:: Complex ;
2222use num_traits:: { Num , ToPrimitive } ;
2323use ruff_python_ast:: {
24- Alias , Arguments , BoolOp , CmpOp , Comprehension , DebugText , Decorator , DictItem , ExceptHandler ,
25- ExceptHandlerExceptHandler , Expr , ExprAttribute , ExprBoolOp , ExprContext , ExprFString ,
26- ExprList , ExprName , ExprSlice , ExprStarred , ExprSubscript , ExprTuple , ExprUnaryOp , FString ,
27- FStringFlags , FStringPart , Identifier , Int , InterpolatedElement , InterpolatedStringElement ,
28- InterpolatedStringElements , Keyword , MatchCase , ModExpression , ModModule , Operator , Parameters ,
29- Pattern , PatternMatchAs , PatternMatchClass , PatternMatchMapping , PatternMatchOr ,
30- PatternMatchSequence , PatternMatchSingleton , PatternMatchStar , PatternMatchValue , Singleton ,
31- Stmt , StmtExpr , TypeParam , TypeParamParamSpec , TypeParamTypeVar , TypeParamTypeVarTuple ,
32- TypeParams , UnaryOp , WithItem ,
24+ Alias , Arguments , BoolOp , CmpOp , Comprehension , ConversionFlag , DebugText , Decorator , DictItem ,
25+ ExceptHandler , ExceptHandlerExceptHandler , Expr , ExprAttribute , ExprBoolOp , ExprContext ,
26+ ExprFString , ExprList , ExprName , ExprSlice , ExprStarred , ExprSubscript , ExprTuple , ExprUnaryOp ,
27+ FString , FStringFlags , FStringPart , Identifier , Int , InterpolatedElement ,
28+ InterpolatedStringElement , InterpolatedStringElements , Keyword , MatchCase , ModExpression ,
29+ ModModule , Operator , Parameters , Pattern , PatternMatchAs , PatternMatchClass ,
30+ PatternMatchMapping , PatternMatchOr , PatternMatchSequence , PatternMatchSingleton ,
31+ PatternMatchStar , PatternMatchValue , Singleton , Stmt , StmtExpr , TypeParam , TypeParamParamSpec ,
32+ TypeParamTypeVar , TypeParamTypeVarTuple , TypeParams , UnaryOp , WithItem ,
3333} ;
3434use ruff_text_size:: { Ranged , TextRange } ;
3535use rustpython_compiler_core:: {
3636 Mode , OneIndexed , PositionEncoding , SourceFile , SourceLocation ,
3737 bytecode:: {
3838 self , Arg as OpArgMarker , BinaryOperator , BuildSliceArgCount , CodeObject ,
39- ComparisonOperator , ConstantData , ConversionFlag , Instruction , Invert , OpArg , OpArgType ,
39+ ComparisonOperator , ConstantData , ConvertValueOparg , Instruction , Invert , OpArg , OpArgType ,
4040 UnpackExArgs ,
4141 } ,
4242} ;
@@ -5638,10 +5638,10 @@ impl Compiler {
56385638 }
56395639 InterpolatedStringElement :: Interpolation ( fstring_expr) => {
56405640 let mut conversion = match fstring_expr. conversion {
5641- ruff_python_ast :: ConversionFlag :: None => ConversionFlag :: None ,
5642- ruff_python_ast :: ConversionFlag :: Str => ConversionFlag :: Str ,
5643- ruff_python_ast :: ConversionFlag :: Repr => ConversionFlag :: Repr ,
5644- ruff_python_ast :: ConversionFlag :: Ascii => ConversionFlag :: Ascii ,
5641+ ConversionFlag :: None => ConvertValueOparg :: None ,
5642+ ConversionFlag :: Str => ConvertValueOparg :: Str ,
5643+ ConversionFlag :: Repr => ConvertValueOparg :: Repr ,
5644+ ConversionFlag :: Ascii => ConvertValueOparg :: Ascii ,
56455645 } ;
56465646
56475647 if let Some ( DebugText { leading, trailing } ) = & fstring_expr. debug_text {
@@ -5657,17 +5657,19 @@ impl Compiler {
56575657 // See: https://github.com/python/cpython/blob/f61afca262d3a0aa6a8a501db0b1936c60858e35/Parser/action_helpers.c#L1456
56585658 if matches ! (
56595659 ( conversion, & fstring_expr. format_spec) ,
5660- ( ConversionFlag :: None , None )
5660+ ( ConvertValueOparg :: None , None )
56615661 ) {
5662- conversion = ConversionFlag :: Repr ;
5662+ conversion = ConvertValueOparg :: Repr ;
56635663 }
56645664 }
56655665
56665666 self . compile_expression ( & fstring_expr. expression ) ?;
56675667
56685668 match conversion {
5669- ConversionFlag :: None => { }
5670- ConversionFlag :: Str | ConversionFlag :: Repr | ConversionFlag :: Ascii => {
5669+ ConvertValueOparg :: None => { }
5670+ ConvertValueOparg :: Str
5671+ | ConvertValueOparg :: Repr
5672+ | ConvertValueOparg :: Ascii => {
56715673 emit ! ( self , Instruction :: ConvertValue { oparg: conversion } )
56725674 }
56735675 }
0 commit comments