Skip to content

Commit

Permalink
MarkupClassNames: refactored to match PrecompileStep API
Browse files Browse the repository at this point in the history
  • Loading branch information
GreyCat committed Aug 7, 2022
1 parent 802b5d2 commit 0a20d3b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion shared/src/main/scala/io/kaitai/struct/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ object Main {
def precompile(classSpecs: ClassSpecs, topClass: ClassSpec, conf: RuntimeConfig): Iterable[CompilationProblem] = {
val config = updateConfigFromMeta(conf, topClass.meta)

classSpecs.foreach { case (_, curClass) => MarkupClassNames.markupClassNames(curClass) }
new MarkupClassNames(classSpecs).run()
val resolveTypeProblems = new ResolveTypes(classSpecs, config.opaqueTypes).run()

// For now, bail out early in case we have any type resolution problems
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
package io.kaitai.struct.precompile

import io.kaitai.struct.format.ClassSpec
import io.kaitai.struct.format.{ClassSpec, ClassSpecs}
import io.kaitai.struct.problems.CompilationProblem

class MarkupClassNames(classSpecs: ClassSpecs) extends PrecompileStep {
override def run(): Iterable[CompilationProblem] = {
classSpecs.foreach { case (_, curClass) => markupClassNames(curClass) }
None
}

object MarkupClassNames {
def markupClassNames(curClass: ClassSpec): Unit = {
curClass.enums.foreach { case (enumName, enumSpec) =>
enumSpec.name = curClass.name ::: List(enumName)
Expand Down

0 comments on commit 0a20d3b

Please sign in to comment.