diff --git a/shared/src/main/scala/io/kaitai/struct/ClassTypeProvider.scala b/shared/src/main/scala/io/kaitai/struct/ClassTypeProvider.scala index 0dee55827..ba2f4dc3f 100644 --- a/shared/src/main/scala/io/kaitai/struct/ClassTypeProvider.scala +++ b/shared/src/main/scala/io/kaitai/struct/ClassTypeProvider.scala @@ -34,7 +34,7 @@ class ClassTypeProvider(classSpecs: ClassSpecs, var topClass: ClassSpec) extends inClass.parentClass.toDataType case Identifier.IO => KaitaiStreamType - case Identifier.ITERATOR => + case Identifier.THIS => currentIteratorType case Identifier.SWITCH_ON => currentSwitchType diff --git a/shared/src/main/scala/io/kaitai/struct/format/Identifier.scala b/shared/src/main/scala/io/kaitai/struct/format/Identifier.scala index 2912eb9e9..70f1b884e 100644 --- a/shared/src/main/scala/io/kaitai/struct/format/Identifier.scala +++ b/shared/src/main/scala/io/kaitai/struct/format/Identifier.scala @@ -87,8 +87,8 @@ object Identifier { val ROOT = "_root" val PARENT = "_parent" val IO = "_io" - val ITERATOR = "_" - val ITERATOR2 = "_buf" + val THIS = "_" + val THIS_RAW = "_buf" val INDEX = "_index" val SWITCH_ON = "_on" val IS_LE = "_is_le" diff --git a/shared/src/main/scala/io/kaitai/struct/languages/CSharpCompiler.scala b/shared/src/main/scala/io/kaitai/struct/languages/CSharpCompiler.scala index 97693c473..8f62d535d 100644 --- a/shared/src/main/scala/io/kaitai/struct/languages/CSharpCompiler.scala +++ b/shared/src/main/scala/io/kaitai/struct/languages/CSharpCompiler.scala @@ -226,7 +226,7 @@ class CSharpCompiler(typeProvider: ClassTypeProvider, config: RuntimeConfig) val ioName = s"io_$privateVarName" val args = rep match { - case RepeatUntil(_) => translator.doName(Identifier.ITERATOR2) + case RepeatUntil(_) => translator.doName(Identifier.THIS_RAW) case _ => getRawIdExpr(varName, rep) } @@ -322,9 +322,9 @@ class CSharpCompiler(typeProvider: ClassTypeProvider, config: RuntimeConfig) override def handleAssignmentRepeatUntil(id: Identifier, expr: String, isRaw: Boolean): Unit = { val (typeDecl, tempVar) = if (isRaw) { - ("byte[] ", translator.doName(Identifier.ITERATOR2)) + ("byte[] ", translator.doName(Identifier.THIS_RAW)) } else { - ("", translator.doName(Identifier.ITERATOR)) + ("", translator.doName(Identifier.THIS)) } out.puts(s"$typeDecl$tempVar = $expr;") out.puts(s"${privateMemberName(id)}.Add($tempVar);") diff --git a/shared/src/main/scala/io/kaitai/struct/languages/CppCompiler.scala b/shared/src/main/scala/io/kaitai/struct/languages/CppCompiler.scala index bebf3e5bc..f9a8f0d34 100644 --- a/shared/src/main/scala/io/kaitai/struct/languages/CppCompiler.scala +++ b/shared/src/main/scala/io/kaitai/struct/languages/CppCompiler.scala @@ -483,7 +483,7 @@ class CppCompiler( val ioId = IoStorageIdentifier(id) val args = rep match { - case RepeatUntil(_) => translator.doName(Identifier.ITERATOR2) + case RepeatUntil(_) => translator.doName(Identifier.THIS_RAW) case _ => getRawIdExpr(id, rep) } @@ -619,9 +619,9 @@ class CppCompiler( override def handleAssignmentRepeatUntil(id: Identifier, expr: String, isRaw: Boolean): Unit = { val (typeDecl, tempVar) = if (isRaw) { - ("std::string ", translator.doName(Identifier.ITERATOR2)) + ("std::string ", translator.doName(Identifier.THIS_RAW)) } else { - ("", translator.doName(Identifier.ITERATOR)) + ("", translator.doName(Identifier.THIS)) } val (wrappedTempVar, rawPtrExpr) = if (config.cppConfig.pointers == UniqueAndRawPointers) { diff --git a/shared/src/main/scala/io/kaitai/struct/languages/GoCompiler.scala b/shared/src/main/scala/io/kaitai/struct/languages/GoCompiler.scala index 49e4343e1..a6bfd8c01 100644 --- a/shared/src/main/scala/io/kaitai/struct/languages/GoCompiler.scala +++ b/shared/src/main/scala/io/kaitai/struct/languages/GoCompiler.scala @@ -244,7 +244,7 @@ class GoCompiler(typeProvider: ClassTypeProvider, config: RuntimeConfig) val ioName = idToStr(IoStorageIdentifier(varName)) val args = rep match { - case RepeatUntil(_) => translator.specialName(Identifier.ITERATOR2) + case RepeatUntil(_) => translator.specialName(Identifier.THIS_RAW) case _ => getRawIdExpr(varName, rep) } @@ -341,7 +341,7 @@ class GoCompiler(typeProvider: ClassTypeProvider, config: RuntimeConfig) override def handleAssignmentRepeatUntil(id: Identifier, r: TranslatorResult, isRaw: Boolean): Unit = { val expr = translator.resToStr(r) - val tempVar = translator.specialName(if (isRaw) Identifier.ITERATOR2 else Identifier.ITERATOR) + val tempVar = translator.specialName(if (isRaw) Identifier.THIS_RAW else Identifier.THIS) out.puts(s"$tempVar := $expr") out.puts(s"${privateMemberName(id)} = append(${privateMemberName(id)}, $tempVar)") } diff --git a/shared/src/main/scala/io/kaitai/struct/languages/JavaCompiler.scala b/shared/src/main/scala/io/kaitai/struct/languages/JavaCompiler.scala index ee19058d3..ca2877313 100644 --- a/shared/src/main/scala/io/kaitai/struct/languages/JavaCompiler.scala +++ b/shared/src/main/scala/io/kaitai/struct/languages/JavaCompiler.scala @@ -272,7 +272,7 @@ class JavaCompiler(typeProvider: ClassTypeProvider, config: RuntimeConfig) val ioName = idToStr(IoStorageIdentifier(varName)) val args = rep match { - case RepeatUntil(_) => translator.doName(Identifier.ITERATOR2) + case RepeatUntil(_) => translator.doName(Identifier.THIS_RAW) case _ => getRawIdExpr(varName, rep) } @@ -400,9 +400,9 @@ class JavaCompiler(typeProvider: ClassTypeProvider, config: RuntimeConfig) override def handleAssignmentRepeatUntil(id: Identifier, expr: String, isRaw: Boolean): Unit = { val (typeDecl, tempVar) = if (isRaw) { - ("byte[] ", translator.doName(Identifier.ITERATOR2)) + ("byte[] ", translator.doName(Identifier.THIS_RAW)) } else { - ("", translator.doName(Identifier.ITERATOR)) + ("", translator.doName(Identifier.THIS)) } out.puts(s"$typeDecl$tempVar = $expr;") out.puts(s"${privateMemberName(id)}.add($tempVar);") diff --git a/shared/src/main/scala/io/kaitai/struct/languages/JavaScriptCompiler.scala b/shared/src/main/scala/io/kaitai/struct/languages/JavaScriptCompiler.scala index a039b4560..729f8dc4d 100644 --- a/shared/src/main/scala/io/kaitai/struct/languages/JavaScriptCompiler.scala +++ b/shared/src/main/scala/io/kaitai/struct/languages/JavaScriptCompiler.scala @@ -339,7 +339,7 @@ class JavaScriptCompiler(typeProvider: ClassTypeProvider, config: RuntimeConfig) } override def handleAssignmentRepeatUntil(id: Identifier, expr: String, isRaw: Boolean): Unit = { - val tmpName = translator.doName(if (isRaw) Identifier.ITERATOR2 else Identifier.ITERATOR) + val tmpName = translator.doName(if (isRaw) Identifier.THIS_RAW else Identifier.THIS) out.puts(s"var $tmpName = $expr;") out.puts(s"${privateMemberName(id)}.push($tmpName);") } diff --git a/shared/src/main/scala/io/kaitai/struct/languages/LuaCompiler.scala b/shared/src/main/scala/io/kaitai/struct/languages/LuaCompiler.scala index 1f24674e9..1d95809d5 100644 --- a/shared/src/main/scala/io/kaitai/struct/languages/LuaCompiler.scala +++ b/shared/src/main/scala/io/kaitai/struct/languages/LuaCompiler.scala @@ -309,7 +309,7 @@ class LuaCompiler(typeProvider: ClassTypeProvider, config: RuntimeConfig) override def handleAssignmentRepeatExpr(id: Identifier, expr: String): Unit = out.puts(s"${privateMemberName(id)}[i + 1] = $expr") override def handleAssignmentRepeatUntil(id: Identifier, expr: String, isRaw: Boolean): Unit = { - val tmpName = translator.doName(if (isRaw) Identifier.ITERATOR2 else Identifier.ITERATOR) + val tmpName = translator.doName(if (isRaw) Identifier.THIS_RAW else Identifier.THIS) out.puts(s"local $tmpName = $expr") out.puts(s"${privateMemberName(id)}[i + 1] = $tmpName") } diff --git a/shared/src/main/scala/io/kaitai/struct/languages/NimCompiler.scala b/shared/src/main/scala/io/kaitai/struct/languages/NimCompiler.scala index 21868c146..4570c5d7f 100644 --- a/shared/src/main/scala/io/kaitai/struct/languages/NimCompiler.scala +++ b/shared/src/main/scala/io/kaitai/struct/languages/NimCompiler.scala @@ -65,7 +65,7 @@ class NimCompiler(typeProvider: ClassTypeProvider, config: RuntimeConfig) val ioName = s"${idToStr(id)}Io" val arg = rep match { case NoRepeat => idToStr(id) + "Expr" - case _ => translator.doName(Identifier.ITERATOR2) + case _ => translator.doName(Identifier.THIS_RAW) } out.puts(s"let $ioName = newKaitaiStream($arg)") ioName @@ -369,8 +369,8 @@ class NimCompiler(typeProvider: ClassTypeProvider, config: RuntimeConfig) def handleAssignmentIterative(id: Identifier, expr: String): Unit = { // Need better design for this XXX val exprName = id match { - case _: RawIdentifier => translator.doName(Identifier.ITERATOR2) - case _ => translator.doName(Identifier.ITERATOR) + case _: RawIdentifier => translator.doName(Identifier.THIS_RAW) + case _ => translator.doName(Identifier.THIS) } out.puts(s"let $exprName = $expr") out.puts(s"${privateMemberName(id)}.add($exprName)") diff --git a/shared/src/main/scala/io/kaitai/struct/languages/PHPCompiler.scala b/shared/src/main/scala/io/kaitai/struct/languages/PHPCompiler.scala index c2c4d1476..15587b4be 100644 --- a/shared/src/main/scala/io/kaitai/struct/languages/PHPCompiler.scala +++ b/shared/src/main/scala/io/kaitai/struct/languages/PHPCompiler.scala @@ -241,7 +241,7 @@ class PHPCompiler(typeProvider: ClassTypeProvider, config: RuntimeConfig) val ioName = s"$$_io_${idToStr(id)}" val args = rep match { - case RepeatUntil(_) => translator.doLocalName(Identifier.ITERATOR2) + case RepeatUntil(_) => translator.doLocalName(Identifier.THIS_RAW) case _ => getRawIdExpr(id, rep) } @@ -313,7 +313,7 @@ class PHPCompiler(typeProvider: ClassTypeProvider, config: RuntimeConfig) } override def handleAssignmentRepeatUntil(id: Identifier, expr: String, isRaw: Boolean): Unit = { - val tmpName = translator.doLocalName(if (isRaw) Identifier.ITERATOR2 else Identifier.ITERATOR) + val tmpName = translator.doLocalName(if (isRaw) Identifier.THIS_RAW else Identifier.THIS) out.puts(s"$tmpName = $expr;") out.puts(s"${privateMemberName(id)}[] = $tmpName;") } diff --git a/shared/src/main/scala/io/kaitai/struct/languages/PerlCompiler.scala b/shared/src/main/scala/io/kaitai/struct/languages/PerlCompiler.scala index c8bfe5b0c..22120ca64 100644 --- a/shared/src/main/scala/io/kaitai/struct/languages/PerlCompiler.scala +++ b/shared/src/main/scala/io/kaitai/struct/languages/PerlCompiler.scala @@ -202,7 +202,7 @@ class PerlCompiler(typeProvider: ClassTypeProvider, config: RuntimeConfig) val memberName = privateMemberName(id) val args = rep match { - case RepeatUntil(_) => translator.doName(Identifier.ITERATOR2) + case RepeatUntil(_) => translator.doName(Identifier.THIS_RAW) case _ => getRawIdExpr(id, rep) } @@ -271,9 +271,9 @@ class PerlCompiler(typeProvider: ClassTypeProvider, config: RuntimeConfig) override def handleAssignmentRepeatUntil(id: Identifier, expr: String, isRaw: Boolean): Unit = { val (decl, tmpName) = if (isRaw) { - ("my ", translator.doName(Identifier.ITERATOR2)) + ("my ", translator.doName(Identifier.THIS_RAW)) } else { - ("", translator.doName(Identifier.ITERATOR)) + ("", translator.doName(Identifier.THIS)) } out.puts(s"$decl$tmpName = $expr;") out.puts(s"push @{${privateMemberName(id)}}, $tmpName;") diff --git a/shared/src/main/scala/io/kaitai/struct/languages/PythonCompiler.scala b/shared/src/main/scala/io/kaitai/struct/languages/PythonCompiler.scala index 37a75f323..0cbfe78d7 100644 --- a/shared/src/main/scala/io/kaitai/struct/languages/PythonCompiler.scala +++ b/shared/src/main/scala/io/kaitai/struct/languages/PythonCompiler.scala @@ -327,7 +327,7 @@ class PythonCompiler(typeProvider: ClassTypeProvider, config: RuntimeConfig) } override def handleAssignmentRepeatUntil(id: Identifier, expr: String, isRaw: Boolean): Unit = { - val tmpName = translator.doName(if (isRaw) Identifier.ITERATOR2 else Identifier.ITERATOR) + val tmpName = translator.doName(if (isRaw) Identifier.THIS_RAW else Identifier.THIS) out.puts(s"$tmpName = $expr") out.puts(s"${privateMemberName(id)}.append($tmpName)") } diff --git a/shared/src/main/scala/io/kaitai/struct/languages/RubyCompiler.scala b/shared/src/main/scala/io/kaitai/struct/languages/RubyCompiler.scala index ccda2646e..dd8a70bb5 100644 --- a/shared/src/main/scala/io/kaitai/struct/languages/RubyCompiler.scala +++ b/shared/src/main/scala/io/kaitai/struct/languages/RubyCompiler.scala @@ -338,7 +338,7 @@ class RubyCompiler(typeProvider: ClassTypeProvider, config: RuntimeConfig) } override def handleAssignmentRepeatUntil(id: Identifier, expr: String, isRaw: Boolean): Unit = { - val tmpName = translator.doName(if (isRaw) Identifier.ITERATOR2 else Identifier.ITERATOR) + val tmpName = translator.doName(if (isRaw) Identifier.THIS_RAW else Identifier.THIS) out.puts(s"$tmpName = $expr") out.puts(s"${privateMemberName(id)} << $tmpName") } diff --git a/shared/src/main/scala/io/kaitai/struct/languages/RustCompiler.scala b/shared/src/main/scala/io/kaitai/struct/languages/RustCompiler.scala index b0e885e7b..71b2c47d6 100644 --- a/shared/src/main/scala/io/kaitai/struct/languages/RustCompiler.scala +++ b/shared/src/main/scala/io/kaitai/struct/languages/RustCompiler.scala @@ -336,7 +336,7 @@ class RustCompiler(typeProvider: ClassTypeProvider, config: RuntimeConfig) } val t = localTemporaryName(id) out.puts(s"let $t = ${privateMemberName(id)};") - out.puts(s"let ${translator.doLocalName(Identifier.ITERATOR)} = $copy_type$t.last().unwrap();") + out.puts(s"let ${translator.doLocalName(Identifier.THIS)} = $copy_type$t.last().unwrap();") } override def condRepeatUntilFooter(id: Identifier, diff --git a/shared/src/main/scala/io/kaitai/struct/languages/components/ValidateOps.scala b/shared/src/main/scala/io/kaitai/struct/languages/components/ValidateOps.scala index d90ba2140..7f90b6d55 100644 --- a/shared/src/main/scala/io/kaitai/struct/languages/components/ValidateOps.scala +++ b/shared/src/main/scala/io/kaitai/struct/languages/components/ValidateOps.scala @@ -69,7 +69,7 @@ trait ValidateOps extends ExceptionNames { // using this variable handleAssignmentTempVar( attrTypeRef, - translator.translate(Ast.expr.Name(Ast.identifier(Identifier.ITERATOR))), + translator.translate(Ast.expr.Name(Ast.identifier(Identifier.THIS))), translator.translate(itemValue) ) attrValidateExpr( diff --git a/shared/src/main/scala/io/kaitai/struct/translators/ConstructTranslator.scala b/shared/src/main/scala/io/kaitai/struct/translators/ConstructTranslator.scala index 7e25982dc..3ad62a156 100644 --- a/shared/src/main/scala/io/kaitai/struct/translators/ConstructTranslator.scala +++ b/shared/src/main/scala/io/kaitai/struct/translators/ConstructTranslator.scala @@ -8,7 +8,7 @@ import io.kaitai.struct.ConstructClassCompiler class ConstructTranslator(provider: TypeProvider, importList: ImportList) extends PythonTranslator(provider, importList, RuntimeConfig()) { override def doLocalName(s: String) = { s match { - case Identifier.ITERATOR => "obj_" + case Identifier.THIS => "obj_" case Identifier.INDEX => "i" case Identifier.ROOT => "this._root" case Identifier.IO => "_io" diff --git a/shared/src/main/scala/io/kaitai/struct/translators/CppTranslator.scala b/shared/src/main/scala/io/kaitai/struct/translators/CppTranslator.scala index 6d29c800e..78b016e62 100644 --- a/shared/src/main/scala/io/kaitai/struct/translators/CppTranslator.scala +++ b/shared/src/main/scala/io/kaitai/struct/translators/CppTranslator.scala @@ -144,8 +144,8 @@ class CppTranslator(provider: TypeProvider, importListSrc: CppImportList, import s"${translate(value)}->${doName(attrName)}" override def doName(s: String) = s match { - case Identifier.ITERATOR => "_" - case Identifier.ITERATOR2 => "_buf" + case Identifier.THIS => "_" + case Identifier.THIS_RAW => "_buf" case Identifier.INDEX => "i" case _ => s"$s()" } diff --git a/shared/src/main/scala/io/kaitai/struct/translators/GoTranslator.scala b/shared/src/main/scala/io/kaitai/struct/translators/GoTranslator.scala index 28647aec8..3647efdd5 100644 --- a/shared/src/main/scala/io/kaitai/struct/translators/GoTranslator.scala +++ b/shared/src/main/scala/io/kaitai/struct/translators/GoTranslator.scala @@ -208,8 +208,8 @@ class GoTranslator(out: StringLanguageOutputWriter, provider: TypeProvider, impo ResultString(s"this.${specialName(s)}") // These can be local only - case Identifier.ITERATOR | - Identifier.ITERATOR2 => + case Identifier.THIS | + Identifier.THIS_RAW => ResultString(specialName(s)) case Identifier.INDEX => ResultString("i") @@ -228,9 +228,9 @@ class GoTranslator(out: StringLanguageOutputWriter, provider: TypeProvider, impo def specialName(id: String): String = id match { case Identifier.ROOT | Identifier.PARENT | Identifier.IO => id - case Identifier.ITERATOR => + case Identifier.THIS => "_it" - case Identifier.ITERATOR2 => + case Identifier.THIS_RAW => "_buf" } diff --git a/shared/src/main/scala/io/kaitai/struct/translators/JavaTranslator.scala b/shared/src/main/scala/io/kaitai/struct/translators/JavaTranslator.scala index 18eb78dda..d4c262198 100644 --- a/shared/src/main/scala/io/kaitai/struct/translators/JavaTranslator.scala +++ b/shared/src/main/scala/io/kaitai/struct/translators/JavaTranslator.scala @@ -56,8 +56,8 @@ class JavaTranslator(provider: TypeProvider, importList: ImportList) extends Bas override def doName(s: String) = s match { - case Identifier.ITERATOR => "_it" - case Identifier.ITERATOR2 => "_buf" + case Identifier.THIS => "_it" + case Identifier.THIS_RAW => "_buf" case Identifier.SWITCH_ON => "on" case Identifier.INDEX => "i" case _ => s"${Utils.lowerCamelCase(s)}()" diff --git a/shared/src/main/scala/io/kaitai/struct/translators/LuaTranslator.scala b/shared/src/main/scala/io/kaitai/struct/translators/LuaTranslator.scala index f2dcad1ec..ffe378ada 100644 --- a/shared/src/main/scala/io/kaitai/struct/translators/LuaTranslator.scala +++ b/shared/src/main/scala/io/kaitai/struct/translators/LuaTranslator.scala @@ -77,7 +77,7 @@ class LuaTranslator(provider: TypeProvider, importList: ImportList) extends Base "string.char(" + values.map(translate).mkString(", ") + ")" override def doLocalName(s: String) = s match { - case Identifier.ITERATOR => "_" + case Identifier.THIS => "_" case Identifier.INDEX => "i" case _ => s"self.${doName(s)}" } diff --git a/shared/src/main/scala/io/kaitai/struct/translators/NimTranslator.scala b/shared/src/main/scala/io/kaitai/struct/translators/NimTranslator.scala index f82e00eb7..3e081e8ad 100644 --- a/shared/src/main/scala/io/kaitai/struct/translators/NimTranslator.scala +++ b/shared/src/main/scala/io/kaitai/struct/translators/NimTranslator.scala @@ -22,8 +22,8 @@ class NimTranslator(provider: TypeProvider, importList: ImportList) extends Base case Identifier.ROOT => "root" case Identifier.PARENT => "parent" case Identifier.IO => "io" - case Identifier.ITERATOR => "it" - case Identifier.ITERATOR2 => "buf" + case Identifier.THIS => "it" + case Identifier.THIS_RAW => "buf" case Identifier.INDEX => "i" case Identifier.SWITCH_ON => "on" case Identifier.IS_LE => "isLe" @@ -32,7 +32,7 @@ class NimTranslator(provider: TypeProvider, importList: ImportList) extends Base } override def doLocalName(s: String): String = s match { - case Identifier.ITERATOR => doName(s) + case Identifier.THIS => doName(s) case Identifier.INDEX => doName(s) case Identifier.ROOT => s"${ksToNim(provider.determineType(Identifier.ROOT))}(this.${doName(s)})" case _ => s"this.${doName(s)}" diff --git a/shared/src/main/scala/io/kaitai/struct/translators/PHPTranslator.scala b/shared/src/main/scala/io/kaitai/struct/translators/PHPTranslator.scala index dafc23b21..1ded901d7 100644 --- a/shared/src/main/scala/io/kaitai/struct/translators/PHPTranslator.scala +++ b/shared/src/main/scala/io/kaitai/struct/translators/PHPTranslator.scala @@ -58,8 +58,8 @@ class PHPTranslator(provider: TypeProvider, config: RuntimeConfig) extends BaseT override def doLocalName(s: String) = { s match { - case Identifier.ITERATOR => "$_" - case Identifier.ITERATOR2 => "$_buf" + case Identifier.THIS => "$_" + case Identifier.THIS_RAW => "$_buf" case Identifier.INDEX => "$i" case _ => s"$$this->${doName(s)}" } diff --git a/shared/src/main/scala/io/kaitai/struct/translators/PerlTranslator.scala b/shared/src/main/scala/io/kaitai/struct/translators/PerlTranslator.scala index 9c57890e5..7d456a802 100644 --- a/shared/src/main/scala/io/kaitai/struct/translators/PerlTranslator.scala +++ b/shared/src/main/scala/io/kaitai/struct/translators/PerlTranslator.scala @@ -66,8 +66,8 @@ class PerlTranslator(provider: TypeProvider, importList: ImportList) extends Bas override def doName(s: String) = { s match { - case Identifier.ITERATOR => "$_" - case Identifier.ITERATOR2 => "$_buf" + case Identifier.THIS => "$_" + case Identifier.THIS_RAW => "$_buf" case Identifier.INDEX => "$i" case _ => s"$s()" } diff --git a/shared/src/main/scala/io/kaitai/struct/translators/PythonTranslator.scala b/shared/src/main/scala/io/kaitai/struct/translators/PythonTranslator.scala index 8c91c010f..307214b6c 100644 --- a/shared/src/main/scala/io/kaitai/struct/translators/PythonTranslator.scala +++ b/shared/src/main/scala/io/kaitai/struct/translators/PythonTranslator.scala @@ -46,7 +46,7 @@ class PythonTranslator(provider: TypeProvider, importList: ImportList, config: R override def doLocalName(s: String) = { s match { - case Identifier.ITERATOR => "_" + case Identifier.THIS => "_" case Identifier.INDEX => "i" case _ => s"self.${doName(s)}" } diff --git a/shared/src/main/scala/io/kaitai/struct/translators/RustTranslator.scala b/shared/src/main/scala/io/kaitai/struct/translators/RustTranslator.scala index 788d49182..b3b8044e4 100644 --- a/shared/src/main/scala/io/kaitai/struct/translators/RustTranslator.scala +++ b/shared/src/main/scala/io/kaitai/struct/translators/RustTranslator.scala @@ -312,8 +312,8 @@ class RustTranslator(provider: TypeProvider, config: RuntimeConfig) } override def doLocalName(s: String): String = s match { - case Identifier.ITERATOR => "_tmpa" - case Identifier.ITERATOR2 => "_tmpb" + case Identifier.THIS => "_tmpa" + case Identifier.THIS_RAW => "_tmpb" case Identifier.INDEX => "_i" case Identifier.IO => s"${RustCompiler.privateMemberName(IoIdentifier)}" case Identifier.ROOT => "_r"