mirror of
https://github.com/voltrevo/ValueScript.git
synced 2026-04-18 03:00:27 -04:00
Prefer to_string
This commit is contained in:
@@ -855,7 +855,7 @@ impl Compiler {
|
||||
defn_name,
|
||||
match constructor_defn_name {
|
||||
None => "void".to_string(),
|
||||
Some(d) => format!("{}", d),
|
||||
Some(d) => d.to_string(),
|
||||
},
|
||||
));
|
||||
|
||||
|
||||
@@ -273,7 +273,7 @@ impl<'a> ExpressionCompiler<'a> {
|
||||
let mut instr = " ".to_string();
|
||||
instr += unary_op_str;
|
||||
instr += " ";
|
||||
instr += &format!("{}", self.fnc.use_(arg));
|
||||
instr += &self.fnc.use_(arg).to_string();
|
||||
|
||||
let target: Register = match &target_register {
|
||||
None => {
|
||||
@@ -309,9 +309,9 @@ impl<'a> ExpressionCompiler<'a> {
|
||||
instr += get_binary_op_str(bin.op);
|
||||
|
||||
instr += " ";
|
||||
instr += &format!("{}", self.fnc.use_(left));
|
||||
instr += &self.fnc.use_(left).to_string();
|
||||
instr += " ";
|
||||
instr += &format!("{}", self.fnc.use_(right));
|
||||
instr += &self.fnc.use_(right).to_string();
|
||||
|
||||
let target: Register = match &target_register {
|
||||
None => {
|
||||
@@ -831,7 +831,7 @@ impl<'a> ExpressionCompiler<'a> {
|
||||
sub_nested_registers.append(&mut callee.nested_registers);
|
||||
|
||||
let mut instr = " call ".to_string();
|
||||
instr += &format!("{}", callee.value);
|
||||
instr += &callee.value.to_string();
|
||||
instr += " ";
|
||||
|
||||
let mut args = Array::default();
|
||||
@@ -864,7 +864,7 @@ impl<'a> ExpressionCompiler<'a> {
|
||||
}
|
||||
};
|
||||
|
||||
instr += &format!("{}", dest);
|
||||
instr += &dest.to_string();
|
||||
|
||||
self.fnc.definition.push(instr);
|
||||
|
||||
@@ -891,7 +891,7 @@ impl<'a> ExpressionCompiler<'a> {
|
||||
sub_nested_registers.append(&mut callee.nested_registers);
|
||||
|
||||
let mut instr = " new ".to_string();
|
||||
instr += &format!("{}", callee.value);
|
||||
instr += &callee.value.to_string();
|
||||
instr += " ";
|
||||
|
||||
let mut args = Array::default();
|
||||
@@ -925,7 +925,7 @@ impl<'a> ExpressionCompiler<'a> {
|
||||
}
|
||||
};
|
||||
|
||||
instr += &format!("{}", dest);
|
||||
instr += &dest.to_string();
|
||||
|
||||
self.fnc.definition.push(instr);
|
||||
|
||||
@@ -1002,7 +1002,7 @@ impl<'a> ExpressionCompiler<'a> {
|
||||
}
|
||||
};
|
||||
|
||||
instr += &format!("{}", dest);
|
||||
instr += &dest.to_string();
|
||||
|
||||
self.fnc.definition.push(instr);
|
||||
|
||||
@@ -1496,7 +1496,7 @@ impl<'a> ExpressionCompiler<'a> {
|
||||
|
||||
let compiled = self.compile(expr, Some(register.clone()));
|
||||
|
||||
if format!("{}", self.fnc.use_(compiled)) != format!("{}", register) {
|
||||
if self.fnc.use_(compiled).to_string() != register.to_string() {
|
||||
self.fnc.diagnostics.push(Diagnostic {
|
||||
level: DiagnosticLevel::InternalError,
|
||||
message: "Default expression not compiled into target register (not sure whether this is possible in this case)".to_string(),
|
||||
@@ -1671,7 +1671,7 @@ impl TargetAccessor {
|
||||
match self {
|
||||
Register(reg) => {
|
||||
// TODO: Should value just derive from Eq?
|
||||
if format!("{}", value) != format!("{}", reg) {
|
||||
if value.to_string() != reg.to_string() {
|
||||
ec.fnc.definition.push(format!(" mov {} {}", value, reg));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ impl FunctionCompiler {
|
||||
|
||||
let reg = self.allocate_reg(cap_param);
|
||||
|
||||
heading += &format!("{}", reg);
|
||||
heading += ®.to_string();
|
||||
|
||||
scope.set(cap_param.clone(), MappedName::Register(reg));
|
||||
|
||||
@@ -207,7 +207,7 @@ impl FunctionCompiler {
|
||||
heading += ", ";
|
||||
}
|
||||
|
||||
heading += &format!("{}", reg);
|
||||
heading += ®.to_string();
|
||||
param_count += 1;
|
||||
}
|
||||
|
||||
@@ -805,7 +805,7 @@ impl FunctionCompiler {
|
||||
let else_label = self.label_allocator.allocate_numbered(&"else".to_string());
|
||||
|
||||
let mut jmpif_instr = " jmpif ".to_string();
|
||||
jmpif_instr += &format!("{}", cond_reg);
|
||||
jmpif_instr += &cond_reg.to_string();
|
||||
jmpif_instr += " :";
|
||||
jmpif_instr += &else_label;
|
||||
self.definition.push(jmpif_instr);
|
||||
@@ -868,7 +868,7 @@ impl FunctionCompiler {
|
||||
.push(std::format!(" op! {} {}", condition_asm, cond_reg));
|
||||
|
||||
let mut jmpif_instr = " jmpif ".to_string();
|
||||
jmpif_instr += &format!("{}", cond_reg);
|
||||
jmpif_instr += &cond_reg.to_string();
|
||||
jmpif_instr += " :";
|
||||
jmpif_instr += &end_label;
|
||||
self.definition.push(jmpif_instr);
|
||||
@@ -914,7 +914,7 @@ impl FunctionCompiler {
|
||||
self.definition.push(format!("{}:", continue_label));
|
||||
|
||||
let mut jmpif_instr = " jmpif ".to_string();
|
||||
jmpif_instr += &format!("{}", self.use_(condition));
|
||||
jmpif_instr += &self.use_(condition).to_string();
|
||||
jmpif_instr += " :";
|
||||
jmpif_instr += &start_label;
|
||||
self.definition.push(jmpif_instr);
|
||||
@@ -986,7 +986,7 @@ impl FunctionCompiler {
|
||||
.push(std::format!(" op! {} {}", condition_asm, cond_reg));
|
||||
|
||||
let mut jmpif_instr = " jmpif ".to_string();
|
||||
jmpif_instr += &format!("{}", cond_reg);
|
||||
jmpif_instr += &cond_reg.to_string();
|
||||
jmpif_instr += " :";
|
||||
jmpif_instr += &for_end_label;
|
||||
self.definition.push(jmpif_instr);
|
||||
|
||||
Reference in New Issue
Block a user