From 16b74100b42d59379a2983c9bef2f6357c2376d3 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sat, 16 Dec 2023 13:29:07 +0000 Subject: Extract PatioCodeGenTuples::elementOffset() --- src/main/java/org/shedlang/compiler/patio/PatioCodeGenTuples.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/org/shedlang/compiler/patio/PatioCodeGenTuples.java b/src/main/java/org/shedlang/compiler/patio/PatioCodeGenTuples.java index 9e2f7421..44a6397f 100644 --- a/src/main/java/org/shedlang/compiler/patio/PatioCodeGenTuples.java +++ b/src/main/java/org/shedlang/compiler/patio/PatioCodeGenTuples.java @@ -60,7 +60,7 @@ public class PatioCodeGenTuples { context = context.addInstruction(new PatioMemoryStore( tuplePointer, tupleLayout, - List.of(elementIndex), + elementOffset(elementIndex), element, source )); @@ -107,13 +107,17 @@ public class PatioCodeGenTuples { target, tuplePointer, tupleDataLayout(elementCount), - List.of(elementIndex), + elementOffset(elementIndex), source )); return context.toResult(target); } + private static List elementOffset(int elementIndex) { + return List.of(elementIndex); + } + private static PatioDataLayout tupleDataLayout(int elementCount) { return PatioDataLayouts.struct(Lists.repeat( PatioDataLayouts.INT, -- cgit v1.2.3