From ed57f56724ef3b79e54659692619cf8aceed39bb Mon Sep 17 00:00:00 2001 From: AlexHaxe Date: Mon, 25 Nov 2024 01:25:51 +0100 Subject: [PATCH] fixed type hint for return expression extracts --- src/refactor/refactor/extractmethod/CodeGenAsExpression.hx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/refactor/refactor/extractmethod/CodeGenAsExpression.hx b/src/refactor/refactor/extractmethod/CodeGenAsExpression.hx index f595183..b48dae0 100644 --- a/src/refactor/refactor/extractmethod/CodeGenAsExpression.hx +++ b/src/refactor/refactor/extractmethod/CodeGenAsExpression.hx @@ -30,6 +30,13 @@ class CodeGenAsExpression extends CodeGenBase { } return Promise.resolve(":" + typeHint.printTypeHint()); }); + case Kwd(KwdReturn): + return parentTypeHint().then(function(typeHint):Promise { + if (typeHint == null) { + return Promise.resolve(""); + } + return Promise.resolve(":" + typeHint.printTypeHint()); + }); default: } return TypingHelper.findTypeWithTyper(context, context.what.fileName, extractData.endToken.pos.max - 1).then(function(typeHint):Promise {