Open continuum-dipanjan-mazumder opened 5 years ago
The ast
object is totally under gocc's user's control. So it is up to you to create an ast
that is serializable. I usually make my asts
protobuf objects.
Could you try and make targetType
be more specific than interface{}
?
I think you would also need to include the ast
file for this to be debugable.
I have worked it out it was problem where the ast.TemplateString was implementing the interface ast.Value but ast.TemplateString methods were having pointer reciever , i had to remove the pointer reciever to make it work...
I am trying to serialize an AST object using gob with below function:
//Encodes an object in gob
encode works but when i try to decode with below function : `func decodeGob(gobData bytes.Buffer, targetType interface{}) error { gob.Register(ast.StringToken{}) gob.Register(ast.Object{}) gob.Register(ast.Elements{}) gob.Register(ast.TemplateString{})
} `
Its throwing error as below: gob: ast.TemplateString is not assignable to type ast.Value