#no field named 'x' in struct 'x'

1 messages · Page 1 of 1 (latest)

forest ferry
#

You can pass around the function as a function, but a method implies it has a bound self which is not allowed to be passed around

forest ferry
#

try it and see, what the optimizer decides to do is not something you can usually intuit

analog saddle
#

That being said, there seems to be limits to using functions as values in Zig. I'm not sure where the limits are, it seems more robust to work with const function pointers instead (which syntactically work pretty much the same AFAIK).

#

Ah, wait, I was missing the line (it's a bit difficult to pinpoint the error due to missing line numbers)
const parseDefinitions = self.parseDefinitions;
Still, where is parseDefinitions in your Parser?

forest ferry
analog saddle
#

I'm still not sure what the original code intends to do, but if rootDefinitions is meant instead of parseDefinitions then I think it should work as collectNodes(grammar.DefinitionNode, self, @This().rootDefinitions);
Or actually, simply
collectNodes(grammar.DefinitionNode, self, rootDefinitions);