Skip to content

Commit 3270e5f

Browse files
committed
Ruby: fix repeated type: b1 to be a boolean (not int)
Fixes kaitai-io/kaitai_struct#1229
1 parent 6fc8a13 commit 3270e5f

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

shared/src/main/scala/io/kaitai/struct/languages/RubyCompiler.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,9 @@ class RubyCompiler(typeProvider: ClassTypeProvider, config: RuntimeConfig)
364364
s"$io.read_bytes_term_multi(${translator.doByteArrayLiteral(terminator)}, $include, $consume, $eosError)"
365365
}
366366
case BitsType1(bitEndian) =>
367-
s"$io.read_bits_int_${bitEndian.toSuffix}(1) != 0"
367+
// NB: must be parenthesized to work in repeated fields, see
368+
// https://github.com/kaitai-io/kaitai_struct/issues/1229
369+
s"($io.read_bits_int_${bitEndian.toSuffix}(1) != 0)"
368370
case BitsType(width: Int, bitEndian) =>
369371
s"$io.read_bits_int_${bitEndian.toSuffix}($width)"
370372
case t: UserType =>

0 commit comments

Comments
 (0)