summaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2026-11-01 21:09:24 +0000
committerMichael Williamson <mike@zwobble.org>2026-11-01 21:09:24 +0000
commit83cd529c660872f4e3a502cace62cd72a739ff05 (patch)
treebb233ffff4c4ecb8e8e0f4fab07d391cb956c8ab /src/main/java
parentda5f2e83708371b1497665c7d0ee8f382898247c (diff)
Extract Relation type
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/zwobble/hobgoblin/compiler/ast/typed/Relation.java18
-rw-r--r--src/main/java/org/zwobble/hobgoblin/compiler/ast/typed/RelationTable.java32
-rw-r--r--src/main/java/org/zwobble/hobgoblin/compiler/ast/typed/TypedQueryDefinitionNode.java22
-rw-r--r--src/main/java/org/zwobble/hobgoblin/compiler/typechecker/TypeChecker.java2
4 files changed, 64 insertions, 10 deletions
diff --git a/src/main/java/org/zwobble/hobgoblin/compiler/ast/typed/Relation.java b/src/main/java/org/zwobble/hobgoblin/compiler/ast/typed/Relation.java
new file mode 100644
index 0000000..7f08714
--- /dev/null
+++ b/src/main/java/org/zwobble/hobgoblin/compiler/ast/typed/Relation.java
@@ -0,0 +1,18 @@
+// Generated by hobgoblin.
+
+package org.zwobble.hobgoblin.compiler.ast.typed;
+
+// Custom area start: org.zwobble.hobgoblin.compiler.ast.typed.Relation imports
+// Custom area end: org.zwobble.hobgoblin.compiler.ast.typed.Relation imports
+
+public sealed interface Relation permits org.zwobble.hobgoblin.compiler.ast.typed.RelationTable {
+ public interface Builder {
+ public org.zwobble.hobgoblin.compiler.ast.typed.Relation build();
+
+ // Custom area start: org.zwobble.hobgoblin.compiler.ast.typed.Relation.Builder body
+ // Custom area end: org.zwobble.hobgoblin.compiler.ast.typed.Relation.Builder body
+ }
+
+ // Custom area start: org.zwobble.hobgoblin.compiler.ast.typed.Relation body
+ // Custom area end: org.zwobble.hobgoblin.compiler.ast.typed.Relation body
+}
diff --git a/src/main/java/org/zwobble/hobgoblin/compiler/ast/typed/RelationTable.java b/src/main/java/org/zwobble/hobgoblin/compiler/ast/typed/RelationTable.java
new file mode 100644
index 0000000..d62753e
--- /dev/null
+++ b/src/main/java/org/zwobble/hobgoblin/compiler/ast/typed/RelationTable.java
@@ -0,0 +1,32 @@
+// Generated by hobgoblin.
+
+package org.zwobble.hobgoblin.compiler.ast.typed;
+
+// Custom area start: org.zwobble.hobgoblin.compiler.ast.typed.RelationTable imports
+// Custom area end: org.zwobble.hobgoblin.compiler.ast.typed.RelationTable imports
+
+public record RelationTable(
+ org.zwobble.hobgoblin.compiler.types.Table table
+) implements org.zwobble.hobgoblin.compiler.ast.typed.Relation {
+ public static org.zwobble.hobgoblin.compiler.ast.typed.RelationTable.Builder arbitrary() {
+ return new org.zwobble.hobgoblin.compiler.ast.typed.RelationTable.Builder(org.zwobble.hobgoblin.compiler.types.HobgoblinNativeTypes.arbitraryTable());
+ }
+
+ public record Builder(
+ org.zwobble.hobgoblin.compiler.types.Table table
+ ) implements org.zwobble.hobgoblin.compiler.ast.typed.Relation.Builder {
+ public org.zwobble.hobgoblin.compiler.ast.typed.RelationTable build() {
+ return new org.zwobble.hobgoblin.compiler.ast.typed.RelationTable(table);
+ }
+
+ public org.zwobble.hobgoblin.compiler.ast.typed.RelationTable.Builder withTable(org.zwobble.hobgoblin.compiler.types.Table table) {
+ return new org.zwobble.hobgoblin.compiler.ast.typed.RelationTable.Builder(table);
+ }
+
+ // Custom area start: org.zwobble.hobgoblin.compiler.ast.typed.RelationTable.Builder body
+ // Custom area end: org.zwobble.hobgoblin.compiler.ast.typed.RelationTable.Builder body
+ }
+
+ // Custom area start: org.zwobble.hobgoblin.compiler.ast.typed.RelationTable body
+ // Custom area end: org.zwobble.hobgoblin.compiler.ast.typed.RelationTable body
+}
diff --git a/src/main/java/org/zwobble/hobgoblin/compiler/ast/typed/TypedQueryDefinitionNode.java b/src/main/java/org/zwobble/hobgoblin/compiler/ast/typed/TypedQueryDefinitionNode.java
index 2c3f518..dc61d28 100644
--- a/src/main/java/org/zwobble/hobgoblin/compiler/ast/typed/TypedQueryDefinitionNode.java
+++ b/src/main/java/org/zwobble/hobgoblin/compiler/ast/typed/TypedQueryDefinitionNode.java
@@ -7,38 +7,42 @@ package org.zwobble.hobgoblin.compiler.ast.typed;
public record TypedQueryDefinitionNode(
String name,
- org.zwobble.hobgoblin.compiler.types.Table table,
+ org.zwobble.hobgoblin.compiler.ast.typed.Relation relation,
org.zwobble.hobgoblin.compiler.ast.DocComment docComment,
org.zwobble.hobgoblin.compiler.sources.Source source
) implements org.zwobble.hobgoblin.compiler.ast.typed.TypedNamespaceStatementNode {
public static org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode.Builder arbitrary() {
- return new org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode.Builder("", org.zwobble.hobgoblin.compiler.types.HobgoblinNativeTypes.arbitraryTable(), org.zwobble.hobgoblin.compiler.ast.HobgoblinNativeAst.arbitraryDocComment(), org.zwobble.hobgoblin.compiler.sources.HobgoblinNativeSources.arbitrarySource());
+ return new org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode.Builder("", org.zwobble.hobgoblin.compiler.ast.typed.RelationTable.arbitrary().build(), org.zwobble.hobgoblin.compiler.ast.HobgoblinNativeAst.arbitraryDocComment(), org.zwobble.hobgoblin.compiler.sources.HobgoblinNativeSources.arbitrarySource());
}
public record Builder(
String name,
- org.zwobble.hobgoblin.compiler.types.Table table,
+ org.zwobble.hobgoblin.compiler.ast.typed.Relation relation,
org.zwobble.hobgoblin.compiler.ast.DocComment docComment,
org.zwobble.hobgoblin.compiler.sources.Source source
) implements org.zwobble.hobgoblin.compiler.ast.typed.TypedNamespaceStatementNode.Builder {
public org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode build() {
- return new org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode(name, table, docComment, source);
+ return new org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode(name, relation, docComment, source);
}
public org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode.Builder withName(String name) {
- return new org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode.Builder(name, table, docComment, source);
+ return new org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode.Builder(name, relation, docComment, source);
}
- public org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode.Builder withTable(org.zwobble.hobgoblin.compiler.types.Table table) {
- return new org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode.Builder(name, table, docComment, source);
+ public org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode.Builder withRelation(org.zwobble.hobgoblin.compiler.ast.typed.Relation relation) {
+ return new org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode.Builder(name, relation, docComment, source);
+ }
+
+ public org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode.Builder withRelation(org.zwobble.hobgoblin.compiler.ast.typed.Relation.Builder relation) {
+ return new org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode.Builder(name, relation.build(), docComment, source);
}
public org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode.Builder withDocComment(org.zwobble.hobgoblin.compiler.ast.DocComment docComment) {
- return new org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode.Builder(name, table, docComment, source);
+ return new org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode.Builder(name, relation, docComment, source);
}
public org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode.Builder withSource(org.zwobble.hobgoblin.compiler.sources.Source source) {
- return new org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode.Builder(name, table, docComment, source);
+ return new org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode.Builder(name, relation, docComment, source);
}
// Custom area start: org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode.Builder body
diff --git a/src/main/java/org/zwobble/hobgoblin/compiler/typechecker/TypeChecker.java b/src/main/java/org/zwobble/hobgoblin/compiler/typechecker/TypeChecker.java
index 32acc82..840010f 100644
--- a/src/main/java/org/zwobble/hobgoblin/compiler/typechecker/TypeChecker.java
+++ b/src/main/java/org/zwobble/hobgoblin/compiler/typechecker/TypeChecker.java
@@ -291,7 +291,7 @@ public class TypeChecker {
return new TypedQueryDefinitionNode(
untyped.name(),
- table,
+ new RelationTable(table),
untyped.docComment(),
untyped.source()
);