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() {