From 0063922f5c8a07b78603b2da7f6a3c2094711c3d Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Tue, 23 Apr 2024 14:36:57 +0200 Subject: feat: initial and partial support of composite expressions (#9) A new `Composite` token is created. Literal composite expressions are recognized and partially handled by the parser but not yet by the code generator. Other cosmetic changes are present. --- parser/interpreter_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'parser/interpreter_test.go') diff --git a/parser/interpreter_test.go b/parser/interpreter_test.go index a459359..a6ad246 100644 --- a/parser/interpreter_test.go +++ b/parser/interpreter_test.go @@ -255,3 +255,11 @@ func TestImport(t *testing.T) { {src: `import . "fmt"; Println(4)`, res: ""}, }) } + +func TestComposite(t *testing.T) { + run(t, []etest{ + {src: "type T struct{}; t := T{}; t", res: "{}"}, + {src: "t := struct{}{}; t", res: "{}"}, + // {src: "type T struct{N int}; t := T{2}; t", res: "{2}"}, + }) +} -- cgit v1.2.3