aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2023-11-19 12:00:16 +0000
committerMichael Williamson <mike@zwobble.org>2023-11-19 12:00:16 +0000
commit5a7ab005bb330d8cd2c5ae7275902cf866a929dc (patch)
tree0015ce8c2ed2ad8073a88c711e5a8d6472fb5b5a /src/main/java
parent483c2ed39d41d9aeed3ae60e0ec3b25a20e05182 (diff)
Rename tags to structTags
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/shedlang/compiler/patio/PatioCodeGen.java2
-rw-r--r--src/main/java/org/shedlang/compiler/patio/PatioCodeGenContext.java20
-rw-r--r--src/main/java/org/shedlang/compiler/patio/PatioCodeGenStructs.java2
3 files changed, 12 insertions, 12 deletions
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<StructType, Integer> tags
+ PMap<StructType, Integer> structTags
) {
public static final GlobalContext EMPTY = forTypeInfos(TypeInfos.EMPTY);
public static GlobalContext forTypeInfos(TypeInfos typeInfos) {
- var tags = P.<StructType, Integer>map();
+ var structTags = P.<StructType, Integer>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<String> 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
));