mirror of
https://github.com/GayPizzaSpecifications/pork.git
synced 2025-08-04 05:31:33 +00:00
idea: proper scoping support, completion now works
This commit is contained in:
@ -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() {
|
||||
|
Reference in New Issue
Block a user