mirror of
https://github.com/GayPizzaSpecifications/pork.git
synced 2025-08-03 21:21:33 +00:00
language: implement let definitions
This commit is contained in:
@ -39,6 +39,10 @@ class CompilationUnitContext(
|
||||
|
||||
private fun definitionValue(definition: Definition): Any = when (definition) {
|
||||
is FunctionDefinition -> FunctionContext(this, definition)
|
||||
is LetDefinition -> {
|
||||
EvaluationVisitor(internalScope.fork("let ${definition.symbol.id}"))
|
||||
.visit(definition.value)
|
||||
}
|
||||
}
|
||||
|
||||
private fun processAllImports() {
|
||||
|
@ -30,6 +30,10 @@ class EvaluationVisitor(root: Scope) : NodeVisitor<Any> {
|
||||
return value
|
||||
}
|
||||
|
||||
override fun visitLetDefinition(node: LetDefinition): Any {
|
||||
topLevelUsedError("LetDefinition", "CompilationUnitContext")
|
||||
}
|
||||
|
||||
override fun visitSymbolReference(node: SymbolReference): Any =
|
||||
currentScope.value(node.symbol.id)
|
||||
|
||||
|
Reference in New Issue
Block a user