From d536d0535af4a3b88ec356a6d1b561d6942334f2 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sat, 5 Dec 2026 21:42:53 +0000 Subject: Add params to typed query definition nodes --- .../compiler/ast/typed/TypedQueryDefinitionNodeMatcher.java | 6 ++++++ .../compiler/typechecker/TypeCheckerQueryDefinitionTests.java | 6 ++++++ 2 files changed, 12 insertions(+) (limited to 'src/test/java/org') diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/ast/typed/TypedQueryDefinitionNodeMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/ast/typed/TypedQueryDefinitionNodeMatcher.java index fb6037e..133368f 100644 --- a/src/test/java/org/zwobble/hobgoblin/compiler/ast/typed/TypedQueryDefinitionNodeMatcher.java +++ b/src/test/java/org/zwobble/hobgoblin/compiler/ast/typed/TypedQueryDefinitionNodeMatcher.java @@ -36,6 +36,12 @@ public final class TypedQueryDefinitionNodeMatcher implements org.zwobble.precis return new org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNodeMatcher(submatchers); } + public org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNodeMatcher withParams(org.zwobble.precisely.Matcher> params) { + var submatchers = new java.util.ArrayList>(this.submatchers); + submatchers.add(org.zwobble.precisely.Matchers.has("params", org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode::params, (org.zwobble.precisely.Matcher) params)); + return new org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNodeMatcher(submatchers); + } + public org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNodeMatcher withStatements(org.zwobble.precisely.Matcher> statements) { var submatchers = new java.util.ArrayList>(this.submatchers); submatchers.add(org.zwobble.precisely.Matchers.has("statements", org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode::statements, (org.zwobble.precisely.Matcher) statements)); diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/typechecker/TypeCheckerQueryDefinitionTests.java b/src/test/java/org/zwobble/hobgoblin/compiler/typechecker/TypeCheckerQueryDefinitionTests.java index c8344c2..c016bc1 100644 --- a/src/test/java/org/zwobble/hobgoblin/compiler/typechecker/TypeCheckerQueryDefinitionTests.java +++ b/src/test/java/org/zwobble/hobgoblin/compiler/typechecker/TypeCheckerQueryDefinitionTests.java @@ -9,6 +9,7 @@ import org.zwobble.hobgoblin.compiler.types.NamespaceName; import org.zwobble.hobgoblin.compiler.types.Table; import org.zwobble.hobgoblin.compiler.types.Types; +import static org.zwobble.hobgoblin.compiler.ast.typed.TypedParamNodeMatcher.isTypedParamNode; import static org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNodeMatcher.isTypedQueryDefinitionNode; import static org.zwobble.hobgoblin.compiler.ast.typed.TypedReferenceNodeMatcher.isTypedReferenceNode; import static org.zwobble.hobgoblin.compiler.ast.typed.TypedReturnNodeMatcher.isTypedReturnNode; @@ -71,6 +72,11 @@ public class TypeCheckerQueryDefinitionTests { assertThat(typed, isTypedQueryDefinitionNode() .withName(equalTo("q")) + .withParams(isSequence( + isTypedParamNode() + .withName(equalTo("a")) + .withType(equalTo(NativeTypes.STRING)) + )) .withStatements(isSequence( isTypedReturnNode() .withExpression( -- cgit v1.2.3