language: prepare for struct support

This commit is contained in:
2023-11-06 21:37:27 -08:00
parent e3bfa3fbfc
commit 8c48c93663
18 changed files with 42 additions and 41 deletions

View File

@ -414,8 +414,8 @@ class EvaluationVisitor(root: Scope, val stack: CallStack) : NodeVisitor<Any> {
topLevelUsedError("CompilationUnit", "CompilationUnitContext")
}
override fun visitNative(node: Native): Any {
topLevelUsedError("Native", "FunctionContext")
override fun visitNativeFunctionDescriptor(node: NativeFunctionDescriptor): Any {
topLevelUsedError("NativeFunctionDescriptor", "FunctionContext")
}
override fun visitNoneLiteral(node: NoneLiteral): Any = None

View File

@ -5,10 +5,10 @@ import gay.pizza.pork.ast.gen.FunctionDefinition
class FunctionContext(val compilationUnitContext: CompilationUnitContext, val node: FunctionDefinition) : CallableFunction {
val name: String = "${compilationUnitContext.name} ${node.symbol.id}"
private fun resolveMaybeNative(): CallableFunction? = if (node.native == null) {
private fun resolveMaybeNative(): CallableFunction? = if (node.nativeFunctionDescriptor == null) {
null
} else {
val native = node.native!!
val native = node.nativeFunctionDescriptor!!
val nativeFunctionProvider =
compilationUnitContext.evaluator.nativeFunctionProvider(native.form.id)
nativeFunctionProvider.provideNativeFunction(native.definitions.map { it.text }, node.arguments, compilationUnitContext)