Start work on WASM compatibility, lambda fix

This commit is contained in:
2026-03-06 09:24:16 +11:00
parent 00ef8a7d56
commit 41a2fa53c6
4 changed files with 122 additions and 25 deletions

View File

@@ -735,6 +735,8 @@ ResultType(GroundProgram, charptr) generateLambdaNode(SolsNode* node, SolsScope*
// Create a scope for lambda arguments
SolsScope lambdaScope = copySolsScope(scope);
// Set the scope's return type
lambdaScope.returnType = *node->as.type.returnType;
for (size_t i = 0; i < node->as.type.children.count; i++) {
addVariableToScope(&lambdaScope, node->as.type.children.at[i].name, node->as.type.children.at[i].type);
@@ -924,13 +926,13 @@ ResultType(GroundProgram, charptr) generateUseNode(SolsNode* node, SolsScope* sc
if (lexer.error) {
printf("While lexing file %s:\n", filePath.str);
printf("Error while creating lexer: %s", lexer.as.error);
exit(1);
return Error(GroundProgram, charptr, "Error with use");
}
ResultType(Nothing, charptr) lexed = lex(&lexer.as.success);
if (lexed.error) {
printf("While lexing file %s:\n", filePath.str);
printf("%s\n", lexed.as.error);
exit(1);
return Error(GroundProgram, charptr, "Error with use");
}
// Parse file
@@ -938,13 +940,13 @@ ResultType(GroundProgram, charptr) generateUseNode(SolsNode* node, SolsScope* sc
if (parser.error) {
printf("While parsing file %s:\n", filePath.str);
printf("Error while creating parser: %s\n", parser.as.error);
exit(1);
return Error(GroundProgram, charptr, "Error with use");
}
ResultType(Nothing, charptr) parsed = parse(&parser.as.success);
if (parsed.error) {
printf("While parsing file %s:\n", filePath.str);
printf("%s\n", parsed.as.error);
exit(1);
return Error(GroundProgram, charptr, "Error with use");
}
SolsScope newScope = {
@@ -958,7 +960,7 @@ ResultType(GroundProgram, charptr) generateUseNode(SolsNode* node, SolsScope* sc
if (codegen.error) {
printf("While generating code for file %s:\n", filePath.str);
printf("%s\n", codegen.as.error);
exit(1);
return Error(GroundProgram, charptr, "Error with use");
}
// Insert all the stuff into our scope