nas2011.
11/11/2025, 9:21 PM// Base class for all AST nodes.
class AstNode:
line_/int
col_/int
constructor .line_ .col_:
// A simple stringify for debugging.
// Subclasses should override this.
stringify -> string:
return "AST Node: ($line_:$col_)"
// --- File Nodes ---
class LibFileNode extends AstNode:
entries/List // List<NamedSpecNode | NamedDataNode>
constructor line_/int col_/int .entries:
super line_ col_
stringify -> string:
return "LibFileNode: entries:$entries"
When I run a parsing function that returns an instance, called result of LibFileNode I can validate this with result is LibFileNode which does return true, however if I try and run print result.entries I get an error saying:
error: Class 'AstNode' does not have any method 'entries'
Shouldn't the Instance.field getter work by default?