diff options
| author | Michael Williamson <mike@zwobble.org> | 2023-06-10 19:26:53 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2023-06-10 19:26:53 +0100 |
| commit | e6d39d97d6415ebdaf990d44198ce29472f9cd1e (patch) | |
| tree | 253aa06196abcc62e19967e170d0d9c844682b04 /src/test/java/org/shedlang/compiler/ast | |
| parent | 062175737e6f7f3971075a7446aeae76946b5c9e (diff) | |
Store free variables used in function
Diffstat (limited to 'src/test/java/org/shedlang/compiler/ast')
5 files changed, 12 insertions, 8 deletions
diff --git a/src/test/java/org/shedlang/compiler/ast/typed/TypedArgsNodeMatcher.java b/src/test/java/org/shedlang/compiler/ast/typed/TypedArgsNodeMatcher.java index 05037526..0d70a40d 100644 --- a/src/test/java/org/shedlang/compiler/ast/typed/TypedArgsNodeMatcher.java +++ b/src/test/java/org/shedlang/compiler/ast/typed/TypedArgsNodeMatcher.java @@ -26,7 +26,7 @@ public class TypedArgsNodeMatcher extends MatcherBuilder<TypedArgsNode, TypedArg return new TypedArgsNodeMatcher(submatchers); } - public TypedArgsNodeMatcher withPositional(Matcher<? super Iterable<TypedExpressionNode>> positional) { + public TypedArgsNodeMatcher withPositional(Matcher<? super Iterable<? extends TypedExpressionNode>> positional) { return with(has("positional", x -> x.positional(), positional)); } diff --git a/src/test/java/org/shedlang/compiler/ast/typed/TypedFunctionDefinitionNodeMatcher.java b/src/test/java/org/shedlang/compiler/ast/typed/TypedFunctionDefinitionNodeMatcher.java index 04a06f64..b1c6e59a 100644 --- a/src/test/java/org/shedlang/compiler/ast/typed/TypedFunctionDefinitionNodeMatcher.java +++ b/src/test/java/org/shedlang/compiler/ast/typed/TypedFunctionDefinitionNodeMatcher.java @@ -29,7 +29,7 @@ public class TypedFunctionDefinitionNodeMatcher extends MatcherBuilder<TypedName return new TypedFunctionDefinitionNodeMatcher(submatchers); } - public TypedFunctionDefinitionNodeMatcher withBody(Matcher<Iterable<TypedFunctionStatementNode>> body) { + public TypedFunctionDefinitionNodeMatcher withBody(Matcher<Iterable<? extends TypedFunctionStatementNode>> body) { return with(has("body", x -> x.body(), body)); } @@ -37,6 +37,10 @@ public class TypedFunctionDefinitionNodeMatcher extends MatcherBuilder<TypedName return with(has("effect", x -> x.effect(), effect)); } + public TypedFunctionDefinitionNodeMatcher withFreeVariables(Matcher<Iterable<String>> freeVariables) { + return with(has("freeVariables", x -> x.freeVariables(), freeVariables)); + } + public TypedFunctionDefinitionNodeMatcher withName(String name) { return with(has("name", x -> x.name(), equalTo(name))); } diff --git a/src/test/java/org/shedlang/compiler/ast/typed/TypedNodeMatchers.java b/src/test/java/org/shedlang/compiler/ast/typed/TypedNodeMatchers.java index ebf1ef42..dad777f6 100644 --- a/src/test/java/org/shedlang/compiler/ast/typed/TypedNodeMatchers.java +++ b/src/test/java/org/shedlang/compiler/ast/typed/TypedNodeMatchers.java @@ -62,7 +62,7 @@ public class TypedNodeMatchers { } public static Matcher<TypedNamespaceNode> isTypedNamespaceNode( - Matcher<Iterable<TypedNamespaceStatementNode>> body + Matcher<Iterable<? extends TypedNamespaceStatementNode>> body ) { return has("body", x -> x.body(), body); } @@ -78,8 +78,8 @@ public class TypedNodeMatchers { } public static Matcher<TypedParamsNode> isTypedParamsNode( - Matcher<Iterable<TypedParamNode>> positional, - Matcher<Iterable<TypedParamNode>> named + Matcher<Iterable<? extends TypedParamNode>> positional, + Matcher<Iterable<? extends TypedParamNode>> named ) { return allOf( has("positional", x -> x.positional(), positional), diff --git a/src/test/java/org/shedlang/compiler/ast/untyped/UntypedFunctionDefinitionNodeMatcher.java b/src/test/java/org/shedlang/compiler/ast/untyped/UntypedFunctionDefinitionNodeMatcher.java index c88111df..8dae4a31 100644 --- a/src/test/java/org/shedlang/compiler/ast/untyped/UntypedFunctionDefinitionNodeMatcher.java +++ b/src/test/java/org/shedlang/compiler/ast/untyped/UntypedFunctionDefinitionNodeMatcher.java @@ -29,7 +29,7 @@ public class UntypedFunctionDefinitionNodeMatcher extends MatcherBuilder<Untyped return new UntypedFunctionDefinitionNodeMatcher(submatchers); } - public UntypedFunctionDefinitionNodeMatcher withBody(Matcher<Iterable<UntypedFunctionStatementNode>> body) { + public UntypedFunctionDefinitionNodeMatcher withBody(Matcher<Iterable<? extends UntypedFunctionStatementNode>> body) { return with(has("body", x -> x.body(), body)); } 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 6c06e52a..95d30cc6 100644 --- a/src/test/java/org/shedlang/compiler/ast/untyped/UntypedNodeMatchers.java +++ b/src/test/java/org/shedlang/compiler/ast/untyped/UntypedNodeMatchers.java @@ -40,8 +40,8 @@ public class UntypedNodeMatchers { } public static Matcher<UntypedParamsNode> isUntypedParamsNode( - Matcher<Iterable<UntypedParamNode>> positional, - Matcher<Iterable<UntypedParamNode>> named + Matcher<Iterable<? extends UntypedParamNode>> positional, + Matcher<Iterable<? extends UntypedParamNode>> named ) { return allOf( has("positional", x -> x.positional(), positional), |
