class Kaze::Resolver
- Kaze::Resolver
- Reference
- Object
Overview
The resolver.
Resolves variable locations so that the interpreter can know exactly where a variable is, and what it is.
Also checks for semantic errors like self-assignment in variable definitions and return
s outside a function.
Included Modules
Defined in:
resolver.crConstructors
Instance Method Summary
- #resolve(statements : Array(Stmt))
- #resolve(stmt : Stmt)
- #resolve(expr : Expr)
- #resolve(statement : Stmt | Expr | Nil)
- #visit_assign_expr(expr : Expr::Assign) : Nil
- #visit_binary_expr(expr : Expr::Binary) : Nil
- #visit_block_stmt(stmt : Stmt::Block) : Nil
- #visit_break_stmt(stmt : Stmt::Break) : Nil
- #visit_call_expr(expr : Expr::Call) : Nil
- #visit_class_stmt(stmt : Stmt::Class) : Nil
- #visit_expression_stmt(stmt : Stmt::Expression) : Nil
- #visit_function_stmt(stmt : Stmt::Function) : Nil
- #visit_get_expr(expr : Expr::Get) : Nil
- #visit_grouping_expr(expr : Expr::Grouping) : Nil
- #visit_if_stmt(stmt : Stmt::If) : Nil
- #visit_lambda_expr(expr : Expr::Lambda) : Nil
- #visit_literal_expr(expr : Expr::Literal) : Nil
- #visit_logical_expr(expr : Expr::Logical) : Nil
- #visit_return_stmt(stmt : Stmt::Return) : Nil
- #visit_self_expr(expr : Expr::Self) : Nil
- #visit_set_expr(expr : Expr::Set) : Nil
- #visit_super_expr(expr : Expr::Super) : Nil
- #visit_ternary_expr(expr : Expr::Ternary) : Nil
- #visit_unary_expr(expr : Expr::Unary) : Nil
-
#visit_var_stmt(stmt : Stmt::Var) : Nil
The variable isn't resolved if it is named
_
. - #visit_variable_expr(expr : Expr::Variable) : Nil
- #visit_while_stmt(stmt : Stmt::While) : Nil
Instance methods inherited from module Kaze::Stmt::Visitor
visit_block_stmt(stmt : Block) : VG
visit_block_stmt,
visit_break_stmt(stmt : Break) : VG
visit_break_stmt,
visit_class_stmt(stmt : Class) : VG
visit_class_stmt,
visit_expression_stmt(stmt : Expression) : VG
visit_expression_stmt,
visit_function_stmt(stmt : Function) : VG
visit_function_stmt,
visit_if_stmt(stmt : If) : VG
visit_if_stmt,
visit_return_stmt(stmt : Return) : VG
visit_return_stmt,
visit_var_stmt(stmt : Var) : VG
visit_var_stmt,
visit_while_stmt(stmt : While) : VG
visit_while_stmt
Instance methods inherited from module Kaze::Expr::Visitor
visit_assign_expr(expr : Assign) : VG
visit_assign_expr,
visit_binary_expr(expr : Binary) : VG
visit_binary_expr,
visit_call_expr(expr : Call) : VG
visit_call_expr,
visit_get_expr(expr : Get) : VG
visit_get_expr,
visit_grouping_expr(expr : Grouping) : VG
visit_grouping_expr,
visit_lambda_expr(expr : Lambda) : VG
visit_lambda_expr,
visit_literal_expr(expr : Literal) : VG
visit_literal_expr,
visit_logical_expr(expr : Logical) : VG
visit_logical_expr,
visit_self_expr(expr : Self) : VG
visit_self_expr,
visit_set_expr(expr : Set) : VG
visit_set_expr,
visit_super_expr(expr : Super) : VG
visit_super_expr,
visit_ternary_expr(expr : Ternary) : VG
visit_ternary_expr,
visit_unary_expr(expr : Unary) : VG
visit_unary_expr,
visit_variable_expr(expr : Variable) : VG
visit_variable_expr
Constructor Detail
Instance Method Detail
The variable isn't resolved if it is named _
.
That is due to the _
variables not creating any variable definition.
This is useful to evaluate expressions since Kaze doesn't support expression statements in most cases.