From 7eee484a18d70ec71ca199a471279b452f38f0dd Mon Sep 17 00:00:00 2001 From: Konstantin Date: Wed, 6 Dec 2017 02:13:39 +0300 Subject: [PATCH] Add more context for warnings. Fixes #410 (#411) --- transpiler/variables.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/transpiler/variables.go b/transpiler/variables.go index 65fcc142e..8019f8e27 100644 --- a/transpiler/variables.go +++ b/transpiler/variables.go @@ -374,15 +374,15 @@ func transpileMemberExpr(n *ast.MemberExpr, p *program.Program) ( // 1. Types need to be stripped of their pointer, 'FILE *' -> 'FILE'. // 2. Types may refer to one or more other types in a chain that have // to be resolved before the real field type can be determined. - err = errors.New("cannot determine type for LHS '" + lhsType + - "', will use 'void *' for all fields") + err = fmt.Errorf("cannot determine type for LHS '%v'"+ + ", will use 'void *' for all fields. Is lvalue = %v", lhsType, n.IsLvalue) p.AddMessage(p.GenerateWarningMessage(err, n)) } else { if s, ok := structType.Fields[rhs].(string); ok { rhsType = s } else { - err = errors.New("cannot determine type for RHS, will use" + - " 'void *' for all fields") + err = fmt.Errorf("cannot determine type for RHS '%v', will use"+ + " 'void *' for all fields. Is lvalue = %v", rhs, n.IsLvalue) p.AddMessage(p.GenerateWarningMessage(err, n)) } }