Fix the generated implementation.rs variable name

It was "item" but should be "index".
master
Jos van den Oever 2018-08-05 14:41:22 +02:00
parent ac286829ba
commit c5b09ca04c
1 changed files with 3 additions and 3 deletions

View File

@ -1021,15 +1021,15 @@ void writeRustImplementationObject(QTextStream& r, const Object& o) {
r << QString(" fn %1(&self, index: usize) -> %2 {\n")
.arg(lc, rustReturnType(ip));
if (ip.type.isComplex()) {
r << " &self.list[item]." << lc << "\n";
r << " &self.list[index]." << lc << "\n";
} else {
r << " self.list[item]." << lc << "\n";
r << " self.list[index]." << lc << "\n";
}
r << " }\n";
if (ip.write) {
r << QString(" fn set_%1(&mut self, index: usize, v: %2) -> bool {\n")
.arg(snakeCase(ip.name), rustType(ip));
r << " self.list[item]." << lc << " = v;\n";
r << " self.list[index]." << lc << " = v;\n";
r << " true\n";
r << " }\n";
}