From a06bea2b20e40b98b1bfbb4fdfe33cac4a23c732 Mon Sep 17 00:00:00 2001 From: Softonik Date: Thu, 10 Nov 2022 16:16:32 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=BF=D0=BE=D0=B4=D0=B4=D0=B5=D1=80=D0=B6=D0=BA?= =?UTF-8?q?=D0=B0=20=D0=B2=D0=BE=D0=B7=D0=B2=D1=80=D0=B0=D1=82=D0=B0=20?= =?UTF-8?q?=D1=80=D0=B5=D0=B7=D1=83=D0=BB=D1=8C=D1=82=D0=B0=D1=82=D0=B0=20?= =?UTF-8?q?=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- transpile_python/service.go | 2 +- transpile_python/service_test.go | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/transpile_python/service.go b/transpile_python/service.go index c930418..15c1db3 100644 --- a/transpile_python/service.go +++ b/transpile_python/service.go @@ -546,7 +546,7 @@ func handleReturnStmt(stmt *ast.ReturnStmt) string { if len(stmt.Results) > 0 { code += handleExpr(stmt.Results[0]) } - code += ";" + code += "\n" return code } diff --git a/transpile_python/service_test.go b/transpile_python/service_test.go index 0448180..2e03ab6 100644 --- a/transpile_python/service_test.go +++ b/transpile_python/service_test.go @@ -51,6 +51,25 @@ main() Compare(source, expected) }) + It("Func return", func() { + source := `package test + func myfunc(p1, p2 any) any { + return 5 + } + func main() { + v := myfunc(1, 2) + } + ` + expected := `from skidl import * +def myfunc(p1,p2): + return 5 +def main(): + v = myfunc(1,2) +main() +` + Compare(source, expected) + }) + It("Net Declaration", func() { source := `package test func main() {