diff options
| author | Michael Williamson <mike@zwobble.org> | 2024-12-19 16:30:17 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2024-12-19 16:30:17 +0000 |
| commit | 4f8135071ae6faf7abfbc2f4765101ce9c0bb287 (patch) | |
| tree | 466ce9540538e5f3a193b0b82fde30796651de0f /src/test/java/org/shedlang/compiler/ast | |
| parent | cbe45599f7b46d7a0674a62d424b9485e7735d45 (diff) | |
Define methods directly on struct
Diffstat (limited to 'src/test/java/org/shedlang/compiler/ast')
3 files changed, 6 insertions, 58 deletions
diff --git a/src/test/java/org/shedlang/compiler/ast/untyped/UntypedExtendInlineNodeMatcher.java b/src/test/java/org/shedlang/compiler/ast/untyped/UntypedExtendInlineNodeMatcher.java deleted file mode 100644 index 1c82f937..00000000 --- a/src/test/java/org/shedlang/compiler/ast/untyped/UntypedExtendInlineNodeMatcher.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.shedlang.compiler.ast.untyped; - -import org.pcollections.PVector; -import org.shedlang.compiler.testing.MatcherBuilder; -import org.shedlang.compiler.util.P; -import org.zwobble.precisely.Matcher; - -import static org.zwobble.precisely.Matchers.has; - -public class UntypedExtendInlineNodeMatcher extends MatcherBuilder< - UntypedNamespaceStatementNode, - UntypedExtendInlineNode, - UntypedExtendInlineNodeMatcher -> { - public static UntypedExtendInlineNodeMatcher empty() { - return new UntypedExtendInlineNodeMatcher(P.vector()); - } - - public UntypedExtendInlineNodeMatcher(PVector<Matcher<? super UntypedExtendInlineNode>> submatchers) { - super(submatchers); - } - - @Override - protected Class<UntypedExtendInlineNode> expectedType() { - return UntypedExtendInlineNode.class; - } - - @Override - protected UntypedExtendInlineNodeMatcher create( - PVector<Matcher<? super UntypedExtendInlineNode>> submatchers - ) { - return new UntypedExtendInlineNodeMatcher(submatchers); - } - - public UntypedExtendInlineNodeMatcher withExtendedType( - Matcher<UntypedTypeLevelExpressionNode> extendedType - ) { - return with(has( - "extendedType", - x -> x.extendedType(), - extendedType - )); - } - - public UntypedExtendInlineNodeMatcher withMethods( - Matcher<Iterable<? extends UntypedFunctionDefinitionNode>> methods - ) { - return with(has( - "methods", - x -> x.methods(), - methods - )); - } -} diff --git a/src/test/java/org/shedlang/compiler/ast/untyped/UntypedNodeMatchers.java b/src/test/java/org/shedlang/compiler/ast/untyped/UntypedNodeMatchers.java index 6e98a788..e0597387 100644 --- a/src/test/java/org/shedlang/compiler/ast/untyped/UntypedNodeMatchers.java +++ b/src/test/java/org/shedlang/compiler/ast/untyped/UntypedNodeMatchers.java @@ -141,10 +141,6 @@ public class UntypedNodeMatchers { ); } - public static UntypedExtendInlineNodeMatcher isUntypedExtendInlineNode() { - return UntypedExtendInlineNodeMatcher.empty(); - } - public static Matcher<UntypedExpressionNode> isUntypedFieldAccessNode( Matcher<UntypedExpressionNode> receiver, String fieldName diff --git a/src/test/java/org/shedlang/compiler/ast/untyped/UntypedStructDefinitionNodeMatcher.java b/src/test/java/org/shedlang/compiler/ast/untyped/UntypedStructDefinitionNodeMatcher.java index 0c1090b2..acdcff50 100644 --- a/src/test/java/org/shedlang/compiler/ast/untyped/UntypedStructDefinitionNodeMatcher.java +++ b/src/test/java/org/shedlang/compiler/ast/untyped/UntypedStructDefinitionNodeMatcher.java @@ -57,4 +57,10 @@ public class UntypedStructDefinitionNodeMatcher extends MatcherBuilder<UntypedNa public UntypedStructDefinitionNodeMatcher withVisibility(Visibility visibility) { return with(has("visibility", x -> x.visibility(), equalTo(visibility))); } + + public UntypedStructDefinitionNodeMatcher withMethods( + Matcher<Iterable<? extends UntypedFunctionDefinitionNode>> methods + ) { + return with(has("methods", x -> x.methods(), methods)); + } } |
