Using Repl.it, link is here but was wondering why I’m getting an error:
Error: this 'initialize' doesn't explicitly initialize instance variable '@expression' of Stmt::Print, rendering it nilable
Here’s the code it refers to, to save you a click:
abstract class Stmt
...
class Print < Stmt
getter name
getter initializer
def initialize(@name : Token, @initializer : Expr); end
def accept(visitor : Stmt::Visitor(R)) : R forall R
visitor.visitPrintStmt self
end
end
...
end
I generated this code using a tool script, so I have no idea what the compiler is even talking about. There is no @expression. Any ideas?
wow that’s a little embarassing, what did I do there? I seem to have misnamed an AST, haha. You have a good eye, thank you!