From dd817300ff9dc3940efca50e4331997c64494ff4 Mon Sep 17 00:00:00 2001 From: Softonik Date: Tue, 22 Nov 2022 23:45:35 +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=B8=D0=BD=D0=B8=D1=86=D0=B8=D0=B0=D0=BB=D0=B8=D0=B7?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D0=B8=20=D0=BA=D0=BE=D0=BD=D1=81=D1=82=D0=B0?= =?UTF-8?q?=D0=BD=D1=82=20=D0=B2=D1=8B=D1=87=D0=B8=D1=81=D0=BB=D0=B8=D1=82?= =?UTF-8?q?=D0=B5=D0=BB=D1=8C=D0=BD=D1=8B=D0=BC=20=D0=B2=D1=8B=D1=80=D0=B0?= =?UTF-8?q?=D0=B6=D0=B5=D0=BD=D0=B8=D0=B5=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- transpile/service.go | 2 ++ transpile/service_test.go | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/transpile/service.go b/transpile/service.go index 0252634..10068a3 100644 --- a/transpile/service.go +++ b/transpile/service.go @@ -643,6 +643,8 @@ func handleValueSpecValues(values []ast.Expr) string { switch v := value.(type) { case *ast.BasicLit: code += handleBasicLit(v) + case *ast.BinaryExpr: + code += handleBinaryExpr(v) case *ast.SelectorExpr: code += handleSelectorExpr(value) case *ast.CallExpr: diff --git a/transpile/service_test.go b/transpile/service_test.go index 1fc8adb..616b384 100644 --- a/transpile/service_test.go +++ b/transpile/service_test.go @@ -62,6 +62,15 @@ var _ = Describe("Go Translator", func() { ` Compare(source, expected) }) + It("Const Int Calculated Declaration", func() { + source := `package test + const foo int = 3 - 1 + ` + expected := ` + const int foo = 3 - 1; + ` + Compare(source, expected) + }) It("Var_String_Declaration", func() { source := `package test