@@ -214,11 +214,11 @@ def _ValueToPartValue(val, quoted, part_loc):
214
214
if case (value_e .Undef ):
215
215
# This happens in the case of ${undef+foo}. We skipped _ProcessUndef,
216
216
# but we have to append to the empty string.
217
- return Piece ('' , quoted , not quoted )
217
+ return word_ . MakePiece ('' , quoted )
218
218
219
219
elif case (value_e .Str ):
220
220
val = cast (value .Str , UP_val )
221
- return Piece (val .s , quoted , not quoted )
221
+ return word_ . MakePiece (val .s , quoted )
222
222
223
223
elif case (value_e .InternalStringArray ):
224
224
val = cast (value .InternalStringArray , UP_val )
@@ -239,7 +239,7 @@ def _ValueToPartValue(val, quoted, part_loc):
239
239
elif case (value_e .Null , value_e .Bool , value_e .Int , value_e .Float ,
240
240
value_e .Eggex , value_e .List ):
241
241
s = val_ops .Stringify (val , loc .WordPart (part_loc ), 'Word eval ' )
242
- return Piece (s , quoted , not quoted )
242
+ return word_ . MakePiece (s , quoted )
243
243
244
244
else :
245
245
raise error .TypeErr (val , "Can't substitute into word" ,
@@ -302,7 +302,7 @@ def _MakeWordFrames(part_vals):
302
302
continue # ignore undefined array entries
303
303
304
304
# Arrays parts are not quoted for $* and $@
305
- piece = Piece (s , p . quoted , not p .quoted )
305
+ piece = word_ . MakePiece (s , p .quoted )
306
306
if is_first :
307
307
current .append (piece )
308
308
is_first = False
@@ -1571,7 +1571,7 @@ def _EvalBracedVarSub(self, part, part_vals, quoted):
1571
1571
if quoted and nullary_op .id == Id .VOp3_Star :
1572
1572
sep = self .splitter .GetJoinChar ()
1573
1573
part_vals .append (
1574
- Piece (sep .join (names ), quoted , not quoted ))
1574
+ word_ . MakePiece (sep .join (names ), quoted ))
1575
1575
else :
1576
1576
part_vals .append (part_value .Array (names , quoted ))
1577
1577
return # EARLY RETURN
@@ -1602,7 +1602,7 @@ def _EvalBracedVarSub(self, part, part_vals, quoted):
1602
1602
val = self ._ProcessUndef (val , part .name_tok , vsub_state )
1603
1603
1604
1604
n = self ._Count (val , part .name_tok )
1605
- part_vals .append (Piece (str (n ), quoted , not quoted ))
1605
+ part_vals .append (word_ . MakePiece (str (n ), quoted ))
1606
1606
return # EARLY EXIT: nothing else can come after length
1607
1607
1608
1608
elif part .prefix_op .id == Id .VSub_Bang :
@@ -1908,7 +1908,7 @@ def _EvalWordPart(self, part, part_vals, flags):
1908
1908
elif case (word_part_e .ArithSub ):
1909
1909
part = cast (word_part .ArithSub , UP_part )
1910
1910
num = self .arith_ev .EvalToBigInt (part .anode )
1911
- v = Piece (mops .ToStr (num ), quoted , not quoted )
1911
+ v = word_ . MakePiece (mops .ToStr (num ), quoted )
1912
1912
part_vals .append (v )
1913
1913
1914
1914
elif case (word_part_e .ExtGlob ):
@@ -1957,7 +1957,7 @@ def _EvalRhsWordToParts(self, w, part_vals, eval_flags=0):
1957
1957
UP_w = w
1958
1958
with tagswitch (w ) as case :
1959
1959
if case (rhs_word_e .Empty ):
1960
- part_vals .append (Piece ('' , quoted , not quoted ))
1960
+ part_vals .append (word_ . MakePiece ('' , quoted ))
1961
1961
1962
1962
elif case (rhs_word_e .Compound ):
1963
1963
w = cast (CompoundWord , UP_w )
@@ -2607,7 +2607,7 @@ def _EvalCommandSub(self, cs_part, quoted):
2607
2607
#strs = self.splitter.SplitForWordEval(stdout_str)
2608
2608
return part_value .Array (strs , True )
2609
2609
else :
2610
- return Piece (stdout_str , quoted , not quoted )
2610
+ return word_ . MakePiece (stdout_str , quoted )
2611
2611
2612
2612
def _EvalProcessSub (self , cs_part ):
2613
2613
# type: (CommandSub) -> Piece
@@ -2652,7 +2652,7 @@ def _EvalCommandSub(self, cs_part, quoted):
2652
2652
if cs_part .left_token .id == Id .Left_AtParen :
2653
2653
return part_value .Array ([_DUMMY ], quoted )
2654
2654
else :
2655
- return Piece (_DUMMY , quoted , not quoted )
2655
+ return word_ . MakePiece (_DUMMY , quoted )
2656
2656
2657
2657
def _EvalProcessSub (self , cs_part ):
2658
2658
# type: (CommandSub) -> Piece
0 commit comments