idea: proper scoping support, completion now works

This commit is contained in:
2023-09-21 23:07:22 -07:00
parent c92a111af7
commit f60715dfb3
25 changed files with 265 additions and 83 deletions

View File

@ -26,7 +26,7 @@ class EvaluationVisitor(root: Scope, val stack: CallStack) : NodeVisitor<Any> {
}
scoped(reuseScope, node = node) {
currentScope.define(node.symbol.id, item ?: None)
currentScope.define(node.item.symbol.id, item ?: None)
result = blockFunction.call()
}
} catch (_: BreakMarker) {
@ -39,6 +39,9 @@ class EvaluationVisitor(root: Scope, val stack: CallStack) : NodeVisitor<Any> {
return result ?: None
}
override fun visitForInItem(node: ForInItem): Any =
throw RuntimeException("Visiting ForInItem is not supported.")
override fun visitStringLiteral(node: StringLiteral): Any = node.text
override fun visitBooleanLiteral(node: BooleanLiteral): Any = node.value
@ -363,6 +366,9 @@ class EvaluationVisitor(root: Scope, val stack: CallStack) : NodeVisitor<Any> {
}
}
override fun visitArgumentSpec(node: ArgumentSpec): Any =
throw RuntimeException("Visiting ArgumentSpec is not supported.")
override fun visitBlock(node: Block): BlockFunction {
val visitor = this
return object : BlockFunction() {