From 3277c6e3a68fcf4334d51c6b43b8b73fa72e56e1 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Mon, 16 Oct 2023 19:04:24 +0200 Subject: [PATCH] Remove unused NeedRaw enum and needRaw() method --- .../io/kaitai/struct/datatype/NeedRaw.scala | 24 ------------------- .../languages/components/CommonReads.scala | 20 ---------------- 2 files changed, 44 deletions(-) delete mode 100644 shared/src/main/scala/io/kaitai/struct/datatype/NeedRaw.scala diff --git a/shared/src/main/scala/io/kaitai/struct/datatype/NeedRaw.scala b/shared/src/main/scala/io/kaitai/struct/datatype/NeedRaw.scala deleted file mode 100644 index 494ea92e3..000000000 --- a/shared/src/main/scala/io/kaitai/struct/datatype/NeedRaw.scala +++ /dev/null @@ -1,24 +0,0 @@ -package io.kaitai.struct.datatype - -sealed trait NeedRaw { - val level: Int - val hasIO: Boolean = false - val hasRaw: Boolean = false -} - -case object NotRaw extends NeedRaw { - val level = 0 -} -case object RawIo extends NeedRaw { - val level = 1 - override val hasIO = true -} -case object RawProcess extends NeedRaw { - val level = 1 - override val hasRaw = true -} -case object RawIoProcess extends NeedRaw { - val level = 2 - override val hasIO = true - override val hasRaw = true -} diff --git a/shared/src/main/scala/io/kaitai/struct/languages/components/CommonReads.scala b/shared/src/main/scala/io/kaitai/struct/languages/components/CommonReads.scala index 13e79fabb..0640b3af5 100644 --- a/shared/src/main/scala/io/kaitai/struct/languages/components/CommonReads.scala +++ b/shared/src/main/scala/io/kaitai/struct/languages/components/CommonReads.scala @@ -1,7 +1,6 @@ package io.kaitai.struct.languages.components import io.kaitai.struct.datatype._ -import io.kaitai.struct.datatype.DataType.{SwitchType, UserTypeFromBytes, BytesType} import io.kaitai.struct.exprlang.Ast import io.kaitai.struct.format._ @@ -91,25 +90,6 @@ trait CommonReads extends LanguageCompiler { def attrParse2(id: Identifier, dataType: DataType, io: String, rep: RepeatSpec, isRaw: Boolean, defEndian: Option[FixedEndian], assignType: Option[DataType] = None): Unit - def needRaw(dataType: DataType): NeedRaw = { - val rawIo = dataType match { - case _: UserTypeFromBytes => true - case st: SwitchType => st.hasSize - case _ => false - } - val rawProcess = dataType match { - case bt: BytesType => bt.process.nonEmpty - case utfb: UserTypeFromBytes => utfb.bytes.process.nonEmpty - case _ => false - } - (rawIo, rawProcess) match { - case (true, false) => RawIo - case (false, true) => RawProcess - case (true, true) => RawIoProcess - case _ => NotRaw - } - } - def attrDebugStart(attrId: Identifier, attrType: DataType, io: Option[String], repeat: RepeatSpec): Unit = {} def attrDebugArrInit(attrId: Identifier, attrType: DataType): Unit = {} def attrDebugEnd(attrName: Identifier, attrType: DataType, io: String, repeat: RepeatSpec): Unit = {}