Documentation ¶
Index ¶
- func IsPublicType(typ ddptypes.Type, table *ast.SymbolTable) bool
- type Typechecker
- func (t *Typechecker) Evaluate(expr ast.Expression) ddptypes.Type
- func (t *Typechecker) EvaluateSilent(expr ast.Expression) ddptypes.Type
- func (t *Typechecker) TypecheckNode(node ast.Node)
- func (t *Typechecker) VisitAssignStmt(stmt *ast.AssignStmt) ast.VisitResult
- func (t *Typechecker) VisitBadDecl(decl *ast.BadDecl) ast.VisitResult
- func (t *Typechecker) VisitBadExpr(expr *ast.BadExpr) ast.VisitResult
- func (t *Typechecker) VisitBadStmt(stmt *ast.BadStmt) ast.VisitResult
- func (t *Typechecker) VisitBinaryExpr(expr *ast.BinaryExpr) ast.VisitResult
- func (t *Typechecker) VisitBlockStmt(stmt *ast.BlockStmt) ast.VisitResult
- func (t *Typechecker) VisitBoolLit(expr *ast.BoolLit) ast.VisitResult
- func (t *Typechecker) VisitBreakContinueStmt(stmt *ast.BreakContinueStmt) ast.VisitResult
- func (t *Typechecker) VisitCastExpr(expr *ast.CastExpr) ast.VisitResult
- func (t *Typechecker) VisitCharLit(expr *ast.CharLit) ast.VisitResult
- func (t *Typechecker) VisitDeclStmt(stmt *ast.DeclStmt) ast.VisitResult
- func (t *Typechecker) VisitExprStmt(stmt *ast.ExprStmt) ast.VisitResult
- func (t *Typechecker) VisitFieldAccess(expr *ast.FieldAccess) ast.VisitResult
- func (t *Typechecker) VisitFloatLit(expr *ast.FloatLit) ast.VisitResult
- func (t *Typechecker) VisitForRangeStmt(stmt *ast.ForRangeStmt) ast.VisitResult
- func (t *Typechecker) VisitForStmt(stmt *ast.ForStmt) ast.VisitResult
- func (t *Typechecker) VisitFuncCall(callExpr *ast.FuncCall) ast.VisitResult
- func (t *Typechecker) VisitFuncDecl(decl *ast.FuncDecl) ast.VisitResult
- func (t *Typechecker) VisitGrouping(expr *ast.Grouping) ast.VisitResult
- func (t *Typechecker) VisitIdent(expr *ast.Ident) ast.VisitResult
- func (t *Typechecker) VisitIfStmt(stmt *ast.IfStmt) ast.VisitResult
- func (t *Typechecker) VisitImportStmt(stmt *ast.ImportStmt) ast.VisitResult
- func (t *Typechecker) VisitIndexing(expr *ast.Indexing) ast.VisitResult
- func (t *Typechecker) VisitIntLit(expr *ast.IntLit) ast.VisitResult
- func (t *Typechecker) VisitListLit(expr *ast.ListLit) ast.VisitResult
- func (t *Typechecker) VisitReturnStmt(stmt *ast.ReturnStmt) ast.VisitResult
- func (t *Typechecker) VisitStringLit(expr *ast.StringLit) ast.VisitResult
- func (t *Typechecker) VisitStructDecl(decl *ast.StructDecl) ast.VisitResult
- func (t *Typechecker) VisitStructLiteral(expr *ast.StructLiteral) ast.VisitResult
- func (t *Typechecker) VisitTernaryExpr(expr *ast.TernaryExpr) ast.VisitResult
- func (t *Typechecker) VisitTypeOpExpr(expr *ast.TypeOpExpr) ast.VisitResult
- func (t *Typechecker) VisitUnaryExpr(expr *ast.UnaryExpr) ast.VisitResult
- func (t *Typechecker) VisitVarDecl(decl *ast.VarDecl) ast.VisitResult
- func (t *Typechecker) VisitWhileStmt(stmt *ast.WhileStmt) ast.VisitResult
- func (*Typechecker) Visitor()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsPublicType ¶
func IsPublicType(typ ddptypes.Type, table *ast.SymbolTable) bool
reports wether the given type from this module of the given table is public should only be called from the global scope and with the SymbolTable that was in use when the type was declared
Types ¶
type Typechecker ¶
type Typechecker struct { ErrorHandler ddperror.Handler // function to which errors are passed CurrentTable *ast.SymbolTable // SymbolTable of the current scope (needed for name type-checking) Module *ast.Module // the module that is being typechecked // contains filtered or unexported fields }
holds state to check if the types of an AST are valid
even though it is a visitor, it should not be used seperately from the parser all it's VisitX return values are dummy returns
TODO: add a snychronize method like in the parser to prevent unnessecary errors
func (*Typechecker) Evaluate ¶
func (t *Typechecker) Evaluate(expr ast.Expression) ddptypes.Type
Evaluates the type of an expression
func (*Typechecker) EvaluateSilent ¶
func (t *Typechecker) EvaluateSilent(expr ast.Expression) ddptypes.Type
calls Evaluate but uses ddperror.EmptyHandler as error handler and doesn't change the Module.Ast.Faulty flag
func (*Typechecker) TypecheckNode ¶
func (t *Typechecker) TypecheckNode(node ast.Node)
typecheck a single node
func (*Typechecker) VisitAssignStmt ¶
func (t *Typechecker) VisitAssignStmt(stmt *ast.AssignStmt) ast.VisitResult
func (*Typechecker) VisitBadDecl ¶
func (t *Typechecker) VisitBadDecl(decl *ast.BadDecl) ast.VisitResult
func (*Typechecker) VisitBadExpr ¶
func (t *Typechecker) VisitBadExpr(expr *ast.BadExpr) ast.VisitResult
func (*Typechecker) VisitBadStmt ¶
func (t *Typechecker) VisitBadStmt(stmt *ast.BadStmt) ast.VisitResult
func (*Typechecker) VisitBinaryExpr ¶
func (t *Typechecker) VisitBinaryExpr(expr *ast.BinaryExpr) ast.VisitResult
func (*Typechecker) VisitBlockStmt ¶
func (t *Typechecker) VisitBlockStmt(stmt *ast.BlockStmt) ast.VisitResult
func (*Typechecker) VisitBoolLit ¶
func (t *Typechecker) VisitBoolLit(expr *ast.BoolLit) ast.VisitResult
func (*Typechecker) VisitBreakContinueStmt ¶
func (t *Typechecker) VisitBreakContinueStmt(stmt *ast.BreakContinueStmt) ast.VisitResult
func (*Typechecker) VisitCastExpr ¶
func (t *Typechecker) VisitCastExpr(expr *ast.CastExpr) ast.VisitResult
func (*Typechecker) VisitCharLit ¶
func (t *Typechecker) VisitCharLit(expr *ast.CharLit) ast.VisitResult
func (*Typechecker) VisitDeclStmt ¶
func (t *Typechecker) VisitDeclStmt(stmt *ast.DeclStmt) ast.VisitResult
func (*Typechecker) VisitExprStmt ¶
func (t *Typechecker) VisitExprStmt(stmt *ast.ExprStmt) ast.VisitResult
func (*Typechecker) VisitFieldAccess ¶
func (t *Typechecker) VisitFieldAccess(expr *ast.FieldAccess) ast.VisitResult
func (*Typechecker) VisitFloatLit ¶
func (t *Typechecker) VisitFloatLit(expr *ast.FloatLit) ast.VisitResult
func (*Typechecker) VisitForRangeStmt ¶
func (t *Typechecker) VisitForRangeStmt(stmt *ast.ForRangeStmt) ast.VisitResult
func (*Typechecker) VisitForStmt ¶
func (t *Typechecker) VisitForStmt(stmt *ast.ForStmt) ast.VisitResult
func (*Typechecker) VisitFuncCall ¶
func (t *Typechecker) VisitFuncCall(callExpr *ast.FuncCall) ast.VisitResult
func (*Typechecker) VisitFuncDecl ¶
func (t *Typechecker) VisitFuncDecl(decl *ast.FuncDecl) ast.VisitResult
func (*Typechecker) VisitGrouping ¶
func (t *Typechecker) VisitGrouping(expr *ast.Grouping) ast.VisitResult
func (*Typechecker) VisitIdent ¶
func (t *Typechecker) VisitIdent(expr *ast.Ident) ast.VisitResult
func (*Typechecker) VisitIfStmt ¶
func (t *Typechecker) VisitIfStmt(stmt *ast.IfStmt) ast.VisitResult
func (*Typechecker) VisitImportStmt ¶
func (t *Typechecker) VisitImportStmt(stmt *ast.ImportStmt) ast.VisitResult
func (*Typechecker) VisitIndexing ¶
func (t *Typechecker) VisitIndexing(expr *ast.Indexing) ast.VisitResult
func (*Typechecker) VisitIntLit ¶
func (t *Typechecker) VisitIntLit(expr *ast.IntLit) ast.VisitResult
func (*Typechecker) VisitListLit ¶
func (t *Typechecker) VisitListLit(expr *ast.ListLit) ast.VisitResult
func (*Typechecker) VisitReturnStmt ¶
func (t *Typechecker) VisitReturnStmt(stmt *ast.ReturnStmt) ast.VisitResult
func (*Typechecker) VisitStringLit ¶
func (t *Typechecker) VisitStringLit(expr *ast.StringLit) ast.VisitResult
func (*Typechecker) VisitStructDecl ¶
func (t *Typechecker) VisitStructDecl(decl *ast.StructDecl) ast.VisitResult
func (*Typechecker) VisitStructLiteral ¶
func (t *Typechecker) VisitStructLiteral(expr *ast.StructLiteral) ast.VisitResult
func (*Typechecker) VisitTernaryExpr ¶
func (t *Typechecker) VisitTernaryExpr(expr *ast.TernaryExpr) ast.VisitResult
func (*Typechecker) VisitTypeOpExpr ¶
func (t *Typechecker) VisitTypeOpExpr(expr *ast.TypeOpExpr) ast.VisitResult
func (*Typechecker) VisitUnaryExpr ¶
func (t *Typechecker) VisitUnaryExpr(expr *ast.UnaryExpr) ast.VisitResult
func (*Typechecker) VisitVarDecl ¶
func (t *Typechecker) VisitVarDecl(decl *ast.VarDecl) ast.VisitResult
func (*Typechecker) VisitWhileStmt ¶
func (t *Typechecker) VisitWhileStmt(stmt *ast.WhileStmt) ast.VisitResult
func (*Typechecker) Visitor ¶
func (*Typechecker) Visitor()
Click to show internal directories.
Click to hide internal directories.