Skip to content

Difficulty with Stringer patch example - <nil> node type #368

Answered by mdmcconnell
mdmcconnell asked this question in Q&A
Discussion options

You must be logged in to vote

Indeed, the ast.MemberNode is missing a Property naming the method to call, so this:

	ast.Patch(node, &ast.CallNode{
		Callee: &ast.MemberNode{
			Node: *node,
			Name: "String",
		},
	})

Becomes this:

	ast.Patch(node, &ast.CallNode{
		Callee: &ast.MemberNode{
			Node:     *node,
			Name:     "String",
			Property: &ast.StringNode{Value: "String"},
		},
	})

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by mdmcconnell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant