always_inline and struct problem
I'm trying to create a transpiler and I've created an architecutre in which every parsed token of the AST is repersented as
But I get the error:
I need the
ShaderOperationShaderOperationstruct ShaderOperation(PPrintable, CollectionElement):
var tokens: List[Token]
var name: String
var arguments: List[ShaderOperation]
var type: String
fn __init__(inout self, tokens: List[Token], name: String, arguments: List[ShaderOperation], type: String):
self.tokens = tokens
self.name = name
self.arguments = arguments
self.type = type
fn getName(inout self) -> String:
return self.name
fn setName(inout self, name:String) :
self.name = name
fn repr(inout self) -> String:
return 'ShaderOperation$(name=' + self.name + ', type=' + self.type + ')'
fn __copyinit__(inout self, existing: Self):
self.arguments = existing.arguments
self.type = existing.type
self.name = existing.name
self.tokens = existing.tokens
fn __moveinit__(inout self, owned existing: Self):
self.arguments = existing.arguments
self.type = existing.type
self.name = existing.name
self.tokens = existing.tokensstruct ShaderOperation(PPrintable, CollectionElement):
var tokens: List[Token]
var name: String
var arguments: List[ShaderOperation]
var type: String
fn __init__(inout self, tokens: List[Token], name: String, arguments: List[ShaderOperation], type: String):
self.tokens = tokens
self.name = name
self.arguments = arguments
self.type = type
fn getName(inout self) -> String:
return self.name
fn setName(inout self, name:String) :
self.name = name
fn repr(inout self) -> String:
return 'ShaderOperation$(name=' + self.name + ', type=' + self.type + ')'
fn __copyinit__(inout self, existing: Self):
self.arguments = existing.arguments
self.type = existing.type
self.name = existing.name
self.tokens = existing.tokens
fn __moveinit__(inout self, owned existing: Self):
self.arguments = existing.arguments
self.type = existing.type
self.name = existing.name
self.tokens = existing.tokensBut I get the error:
/Users/ec2-user/actions-runner/_work/modular/modular/Kernels/mojo/stdlib/collections/list.mojo:186:8: error: function has recursive call to 'always_inline' function
/Users/hammad/Documents/htdocs/Hammad-Subhtdocs/Mojo/USL/shaderlab/libutils/Typing.mojo:93:8: note: to function marked 'always_inline' here
struct ShaderOperation(PPrintable, CollectionElement):/Users/ec2-user/actions-runner/_work/modular/modular/Kernels/mojo/stdlib/collections/list.mojo:186:8: error: function has recursive call to 'always_inline' function
/Users/hammad/Documents/htdocs/Hammad-Subhtdocs/Mojo/USL/shaderlab/libutils/Typing.mojo:93:8: note: to function marked 'always_inline' here
struct ShaderOperation(PPrintable, CollectionElement):I need the
argumentsarguments property to be a list of ShaderOperations because AST nodes are usually nested inside each other