diff --git a/src/main/scala/millfork/compiler/AbstractExpressionCompiler.scala b/src/main/scala/millfork/compiler/AbstractExpressionCompiler.scala index 96f7d127..a2430ab2 100644 --- a/src/main/scala/millfork/compiler/AbstractExpressionCompiler.scala +++ b/src/main/scala/millfork/compiler/AbstractExpressionCompiler.scala @@ -407,12 +407,12 @@ object AbstractExpressionCompiler { log.error(s"Type `$targetType` doesn't have field named `$actualFieldName`", expr.position) ok = false } else { - if (tuples.head.arrayIndexTypeAndSize.isDefined) ??? // TODO + val subv = tuples.head pointerWrap match { case 0 => - currentType = tuples.head.typ + currentType = if (subv.arrayIndexTypeAndSize.isDefined) env.get[Type]("pointer." + subv.typ) else subv.typ case 1 => - currentType = env.get[Type]("pointer." + tuples.head.typ) + currentType = env.get[Type]("pointer." + subv.typ) case 2 => currentType = env.get[Type]("pointer") case 10 | 11 => diff --git a/src/main/scala/millfork/env/Environment.scala b/src/main/scala/millfork/env/Environment.scala index 5b317749..b909ec5f 100644 --- a/src/main/scala/millfork/env/Environment.scala +++ b/src/main/scala/millfork/env/Environment.scala @@ -2372,11 +2372,10 @@ class Environment(val parent: Option[Environment], val prefix: String, val cpuFa builder.toList case s: UnionType => val builder = new ListBuffer[Subvariable] - for(FieldDesc(typeName, fieldName, vol1, arraySize) <- s.fields) { - val typ = get[VariableType](typeName) + for(ResolvedFieldDesc(typ, fieldName, vol1, indexTypeAndCount) <- s.mutableFieldsWithTypes) { val suffix = "." + fieldName builder += Subvariable(suffix, 0, vol1, typ) - if (arraySize.isEmpty) { + if (indexTypeAndCount.isEmpty) { builder ++= getSubvariables(typ).map { case Subvariable(innerSuffix, innerOffset, vol2, innerType, innerSize) => Subvariable(suffix + innerSuffix, innerOffset, vol1 || vol2, innerType, innerSize) }