Fan

 

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 coersions: auto-casts, boxing, to non-nullable
6) implicit call to toImmutable when assigning to const field

Slots

enterFinallySource

override Void enterFinally(TryStmt stmt)

Overrides compiler::Visitor.enterFinally

Doc inherited from compiler::Visitor.enterFinally

Callback when entering a finally block

enterStmtSource

override Void enterStmt(Stmt stmt)

Overrides compiler::Visitor.enterStmt

Doc inherited from compiler::Visitor.enterStmt

Callback when entering a stmt.

exitFinallySource

override Void exitFinally(TryStmt stmt)

Overrides compiler::Visitor.exitFinally

Doc inherited from compiler::Visitor.exitFinally

Callback when exiting a finally block

exitStmtSource

override Void exitStmt(Stmt stmt)

Overrides compiler::Visitor.exitStmt

Doc inherited from compiler::Visitor.exitStmt

Callback when exiting a stmt.

isFuncAutoCoerceSource

static Bool isFuncAutoCoerce(CType actualType, CType expectedType)

isFuncAutoCoerceMatchSource

static Bool isFuncAutoCoerceMatch(CType actual, CType expected)

makeSource

new make(Compiler compiler)

needCoerceSource

static Bool needCoerce(CType from, CType to)

runSource

override Void run()

Overrides compiler::CompilerStep.run

Doc inherited from compiler::CompilerStep.run

Run the step

visitExprSource

override Expr visitExpr(Expr expr)

Overrides compiler::Visitor.visitExpr

Doc inherited from compiler::Visitor.visitExpr

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

visitFieldDefSource

override Void visitFieldDef(FieldDef f)

Overrides compiler::Visitor.visitFieldDef

Doc inherited from compiler::Visitor.visitFieldDef

Callback when visiting a field definition.

visitMethodDefSource

override Void visitMethodDef(MethodDef m)

Overrides compiler::Visitor.visitMethodDef

Doc inherited from compiler::Visitor.visitMethodDef

Callback when visiting a method.

visitStmtSource

override Void visitStmt(Stmt stmt)

Overrides compiler::Visitor.visitStmt

Doc inherited from compiler::Visitor.visitStmt

Callback when visiting a stmt.

visitTypeDefSource

override Void visitTypeDef(TypeDef t)

Overrides compiler::Visitor.visitTypeDef

Doc inherited from compiler::Visitor.visitTypeDef

Callback when visiting a type definition.