From 1ccc707dd4c9ed77b1ffef99c489c4389ab6e58c Mon Sep 17 00:00:00 2001 From: kindlich Date: Sat, 14 Sep 2024 15:06:38 +0200 Subject: [PATCH] Validate return statements inside implicit constructors and setters --- .../validator/visitors/DefinitionMemberValidator.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Validator/src/main/java/org/openzen/zenscript/validator/visitors/DefinitionMemberValidator.java b/Validator/src/main/java/org/openzen/zenscript/validator/visitors/DefinitionMemberValidator.java index ad992f07..360a16ba 100644 --- a/Validator/src/main/java/org/openzen/zenscript/validator/visitors/DefinitionMemberValidator.java +++ b/Validator/src/main/java/org/openzen/zenscript/validator/visitors/DefinitionMemberValidator.java @@ -100,6 +100,9 @@ public Void visitConstructor(ConstructorMember member) { } } else { checkConstructorForwarded(member); + if(member.isImplicit()) { + ReturnStatementValidator.validate(member.getTargetType(), member.body, validator); + } } return null; @@ -301,6 +304,7 @@ private void validateGetter(GetterMember member, StatementScope scope) { member.body.accept(statementValidator); validateThrow(member, new FunctionHeader(member.type), member.body); + ReturnStatementValidator.validate(member.type, member.body, validator); } }