From 5a7ab005bb330d8cd2c5ae7275902cf866a929dc Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sun, 19 Nov 2023 12:00:16 +0000 Subject: Rename tags to structTags --- .../org/shedlang/compiler/patio/PatioCodeGen.java | 2 +- .../shedlang/compiler/patio/PatioCodeGenContext.java | 20 ++++++++++---------- .../shedlang/compiler/patio/PatioCodeGenStructs.java | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/org/shedlang/compiler/patio/PatioCodeGen.java b/src/main/java/org/shedlang/compiler/patio/PatioCodeGen.java index 497f059d..e5dcc654 100644 --- a/src/main/java/org/shedlang/compiler/patio/PatioCodeGen.java +++ b/src/main/java/org/shedlang/compiler/patio/PatioCodeGen.java @@ -557,7 +557,7 @@ public class PatioCodeGen { context = bodyResult.context(); cases.add(new PatioSwitch.Case( - context.tag(stackIrCase.caseType()), + context.structTag(stackIrCase.caseType()), body, stackIrCase.source() )); diff --git a/src/main/java/org/shedlang/compiler/patio/PatioCodeGenContext.java b/src/main/java/org/shedlang/compiler/patio/PatioCodeGenContext.java index 4eb221c1..f7876225 100644 --- a/src/main/java/org/shedlang/compiler/patio/PatioCodeGenContext.java +++ b/src/main/java/org/shedlang/compiler/patio/PatioCodeGenContext.java @@ -33,22 +33,22 @@ public record PatioCodeGenContext( ) { public record GlobalContext( TypeInfos typeInfos, - PMap tags + PMap structTags ) { public static final GlobalContext EMPTY = forTypeInfos(TypeInfos.EMPTY); public static GlobalContext forTypeInfos(TypeInfos typeInfos) { - var tags = P.map(); + var structTags = P.map(); var structTypes = typeInfos.structTypes(); var nextTag = 0; for (var structType : structTypes) { - tags = tags.plus(structType, nextTag); + structTags = structTags.plus(structType, nextTag); nextTag++; } return new GlobalContext( typeInfos, - tags + structTags ); } @@ -64,8 +64,8 @@ public record PatioCodeGenContext( .orElseThrow(() -> new RuntimeException("No type info for: " + type)); } - public int tag(StructType type) { - var tag = this.tags.get(type); + public int structTag(StructType type) { + var tag = this.structTags.get(type); if (tag == null) { // TODO: throw better error throw new RuntimeException("No tag for: " + type); @@ -270,7 +270,7 @@ public record PatioCodeGenContext( FunctionContext.EMPTY ); } - + public NamespaceTypeInfo namespaceTypeInfo(NamespaceName namespaceName) { return this.globalContext.namespaceTypeInfo(namespaceName); } @@ -279,8 +279,8 @@ public record PatioCodeGenContext( return this.globalContext.structTypeInfo(type); } - public int tag(StructType type) { - return globalContext.tag(type); + public int structTag(StructType type) { + return globalContext.structTag(type); } public PatioCodeGenResult allocateCompilationUnitElementName( @@ -331,7 +331,7 @@ public record PatioCodeGenContext( return new PatioCodeGenContext(this.globalContext, this.compilationUnitContext, this.blockStack, result.context) .addInstruction(new PatioLocalStore(target, result.value, source)); } - + public PatioCodeGenContext temporaryPush(PatioLocalRef value) { var result = this.functionContext.temporaryPush(value); diff --git a/src/main/java/org/shedlang/compiler/patio/PatioCodeGenStructs.java b/src/main/java/org/shedlang/compiler/patio/PatioCodeGenStructs.java index 0f0b2920..92081325 100644 --- a/src/main/java/org/shedlang/compiler/patio/PatioCodeGenStructs.java +++ b/src/main/java/org/shedlang/compiler/patio/PatioCodeGenStructs.java @@ -55,7 +55,7 @@ public class PatioCodeGenStructs { valuePointer, structDataLayout, List.of(0), - new PatioInt(context.tag(type)), + new PatioInt(context.structTag(type)), source )); -- cgit v1.2.3