diff options
| author | Michael Williamson <mike@zwobble.org> | 2026-06-12 17:12:47 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2026-06-12 17:12:47 +0100 |
| commit | 879835c2f87628b60a3d9f50cfe25ceab4d7528f (patch) | |
| tree | 9fcb84f191c0c0e896b6d4064f9fef78541dc5d3 /src/main/java/org | |
| parent | 1fd6faf0b9874e0962ab790e12b1f12fabac893e (diff) | |
Store submatchers in struct matcher
Diffstat (limited to 'src/main/java/org')
| -rw-r--r-- | src/main/java/org/zwobble/hobgoblin/compiler/output/generators/javapreciselymatchers/JavaPreciselyMatchersGenerator.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/javapreciselymatchers/JavaPreciselyMatchersGenerator.java b/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/javapreciselymatchers/JavaPreciselyMatchersGenerator.java index 353fae1..aa2f09d 100644 --- a/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/javapreciselymatchers/JavaPreciselyMatchersGenerator.java +++ b/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/javapreciselymatchers/JavaPreciselyMatchersGenerator.java @@ -121,6 +121,11 @@ public class JavaPreciselyMatchersGenerator implements Generator { )) )) ), + new JavaFieldDeclaration( + JavaVisibility.PRIVATE, + JavaTypeRef.list(matcherRef(JavaTypeArg.superType(javaStructTypeRef))), + "submatchers" + ), new JavaConstructorDeclaration( matcherTypeName, JavaVisibility.PRIVATE, @@ -130,7 +135,14 @@ public class JavaPreciselyMatchersGenerator implements Generator { "submatchers" ) ), - new JavaBlock(List.of()) + new JavaBlock(List.of( + new JavaExpressionStatement( + new JavaAssignment( + new JavaFieldAccess(new JavaRef("this"), "submatchers"), + new JavaRef("submatchers") + ) + ) + )) ), new JavaMethodDeclaration( "match", |
