diff options
Diffstat (limited to 'src/test/java')
| -rw-r--r-- | src/test/java/org/shedlang/compiler/typechecker/TypeCheckerTesting.java | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/test/java/org/shedlang/compiler/typechecker/TypeCheckerTesting.java b/src/test/java/org/shedlang/compiler/typechecker/TypeCheckerTesting.java new file mode 100644 index 00000000..e089884f --- /dev/null +++ b/src/test/java/org/shedlang/compiler/typechecker/TypeCheckerTesting.java @@ -0,0 +1,23 @@ +package org.shedlang.compiler.typechecker; + +import org.shedlang.compiler.ast.typed.TypedNamespaceStatementNode; +import org.shedlang.compiler.ast.untyped.UntypedNamespaceStatementNode; +import org.shedlang.compiler.types.NamespaceName; +import org.shedlang.compiler.util.P; + +public class TypeCheckerTesting { + private TypeCheckerTesting() { + } + + static TypeCheckerResult<? extends TypedNamespaceStatementNode> typeCheckNamespaceStatement( + UntypedNamespaceStatementNode untyped, + TypeCheckerContext context + ) { + var declaredVariables = DeclaredVariables.forNamespaceStatement(untyped, P.vector()); + var environment = EnvironmentBuilder.EMPTY.addUndefined(declaredVariables); + + context = context.enterNamespace(NamespaceName.of("Example"), environment.build()); + + return TypeChecker.typeCheckStepsNamespaceStatement(untyped).typeCheckAllPhases(context); + } +} |
