lang: Print a clear message on module import containing unused stmt
If you run an import, you only include everything that's part of a scope. This includes, variables, classes, and functions. Anything else should cause a compile error. This cleans up the error by adding a String() method to each Stmt in our AST.
This commit is contained in:
@@ -40,6 +40,7 @@ type Node interface {
|
||||
// expression.)
|
||||
type Stmt interface {
|
||||
Node
|
||||
fmt.Stringer // String() string
|
||||
Init(*Data) error // initialize the populated node and validate
|
||||
Interpolate() (Stmt, error) // return expanded form of AST as a new AST
|
||||
SetScope(*Scope) error // set the scope here and propagate it downwards
|
||||
@@ -54,6 +55,7 @@ type Stmt interface {
|
||||
// these can be stored as pointers in our graph data structure.
|
||||
type Expr interface {
|
||||
Node
|
||||
//fmt.Stringer // already provided by pgraph.Vertex
|
||||
pgraph.Vertex // must implement this since we store these in our graphs
|
||||
Init(*Data) error // initialize the populated node and validate
|
||||
Interpolate() (Expr, error) // return expanded form of AST as a new AST
|
||||
|
||||
Reference in New Issue
Block a user