File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
shared/src/main/scala/io/kaitai/struct/precompile Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -44,11 +44,16 @@ class StyleCheckIds(specs: ClassSpecs) extends PrecompileStep {
4444 val existingName = sizeRefAttr.id.humanReadable
4545 val goodName = s " len_ ${attr.id.humanReadable}"
4646 if (existingName != goodName) {
47+ // Add `id` for attributes in `seq`, do not add for instances
48+ val path = attr match {
49+ case _ : AttrSpec => sizeRefAttr.path ++ List (" id" )
50+ case _ => sizeRefAttr.path
51+ }
4752 Some (StyleWarningSizeLen (
4853 goodName,
4954 existingName,
5055 attr.id.humanReadable,
51- ProblemCoords (path = Some (sizeRefAttr. path ++ List ( " id " ) ))
56+ ProblemCoords (path = Some (path))
5257 ))
5358 } else {
5459 None
@@ -61,11 +66,16 @@ class StyleCheckIds(specs: ClassSpecs) extends PrecompileStep {
6166 val existingName = repeatExprRefAttr.id.humanReadable
6267 val goodName = s " num_ ${attr.id.humanReadable}"
6368 if (existingName != goodName) {
69+ // Add `id` for attributes in `seq`, do not add for instances
70+ val path = attr match {
71+ case _ : AttrSpec => repeatExprRefAttr.path ++ List (" id" )
72+ case _ => repeatExprRefAttr.path
73+ }
6474 Some (StyleWarningRepeatExprNum (
6575 goodName,
6676 existingName,
6777 attr.id.humanReadable,
68- ProblemCoords (path = Some (repeatExprRefAttr. path ++ List ( " id " ) ))
78+ ProblemCoords (path = Some (path))
6979 ))
7080 } else {
7181 None
You can’t perform that action at this time.
0 commit comments