From 5267c0e8653b431cfd2c06212cdba4f22225bd02 Mon Sep 17 00:00:00 2001 From: Mel Date: Thu, 21 Apr 2022 03:18:46 +0200 Subject: Do not force generics for Expr and Stmt --- pkg/lang/ast/expr.go | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'pkg/lang/ast/expr.go') diff --git a/pkg/lang/ast/expr.go b/pkg/lang/ast/expr.go index a4d6f56..ab6578a 100644 --- a/pkg/lang/ast/expr.go +++ b/pkg/lang/ast/expr.go @@ -22,35 +22,37 @@ const ( ExprKindThis ) -type Expr[T any] struct { +type Expr ExprT[any] + +type ExprT[T any] struct { At token.Loc Kind ExprKind Value T } type ExprBinary struct { - Left Expr[any] + Left Expr Op BinOp - Right Expr[any] + Right Expr } type ExprUnary struct { Op UnOp - Value Expr[any] + Value Expr } type ExprCall struct { - Callee Expr[any] - Args []Expr[any] + Callee Expr + Args []Expr } type ExprSubscription struct { - Obj Expr[any] - Key Expr[any] + Obj Expr + Key Expr } type ExprGroup struct { - Value Expr[any] + Value Expr } type ExprFnLit struct { @@ -59,7 +61,7 @@ type ExprFnLit struct { } type ExprArrayLit struct { - Values []Expr[any] + Values []Expr } type ExprIdent struct { -- cgit 1.4.1