Support expression in f-strings spec

This commit is contained in:
Aviv Palivoda 2019-12-13 11:33:19 +02:00
parent 8adb8b5105
commit de7f9efd54

View file

@ -2108,10 +2108,17 @@ impl<O: OutputStream> Compiler<O> {
conversion,
spec,
} => {
match spec {
Some(spec) => self.compile_string(spec)?,
None => self.emit(Instruction::LoadConst {
value: bytecode::Constant::String {
value: String::new(),
},
}),
};
self.compile_expression(value)?;
self.emit(Instruction::FormatValue {
conversion: conversion.map(compile_conversion_flag),
spec: spec.clone(),
});
}
}