logo

class

compiler::CheckErrors

sys::Obj
  compiler::CompilerSupport
    compiler::CompilerStep
      compiler::CheckErrors

CheckErrors walks the tree of statements and expressions looking for errors the compiler can detect such as invalid type usage. We attempt to leave all the error reporting to this step, so that we can batch report as many errors as possible.

Since CheckErrors already performs a full tree walk down to each leaf expression, we also do a couple of other AST decorations in this step:

1) add temp local for field assignments like return ++x
2) add temp local for returns inside protected region
3) check for field accessor optimization
4) check for field storage requirements
5) add implicit cast when assigning Obj to non-Obj
6) implicit call to toImmutable when assigning to const field

Slots

enterFinally

override Void enterFinally(TryStmt stmt)

Callback when entering a finally block

Source

enterStmt

override Void enterStmt(Stmt stmt)

Callback when entering a stmt.

Source

exitFinally

override Void exitFinally(TryStmt stmt)

Callback when exiting a finally block

Source

exitStmt

override Void exitStmt(Stmt stmt)

Callback when exiting a stmt.

Source

make

new make(Compiler compiler)

Source

run

override Void run()

Run the step

Source

visitExpr

override Expr visitExpr(Expr expr)

Call to visit an expression. Return expr or a new expression if doing a replacement for the expression in the abstract syntax tree.

Source

visitFieldDef

override Void visitFieldDef(FieldDef f)

Callback when visiting a field definition.

Source

visitMethodDef

override Void visitMethodDef(MethodDef m)

Callback when visiting a method.

Source

visitStmt

override Void visitStmt(Stmt stmt)

Callback when visiting a stmt.

Source

visitTypeDef

override Void visitTypeDef(TypeDef t)

Callback when visiting a type definition.

Source