Notify of list deprecation

This commit is contained in:
2026-04-11 09:44:48 +10:00
parent 1939ed019b
commit f5c4468d50

View File

@@ -15,6 +15,8 @@ int currentInstruction = 0;
bool isMainScopeGlobal = true; bool isMainScopeGlobal = true;
bool listDeprecationWarning = true;
char* getFileContents(const char* filename); char* getFileContents(const char* filename);
[[noreturn]] void customError(GroundArg type, GroundArg what, GroundInstruction* where, int whereLine, int exitCode) { [[noreturn]] void customError(GroundArg type, GroundArg what, GroundInstruction* where, int whereLine, int exitCode) {
@@ -963,6 +965,10 @@ GroundValue interpretGroundInstruction(GroundInstruction inst, GroundScope* scop
break; break;
} }
case SETLIST: { case SETLIST: {
if (listDeprecationWarning) {
printf("Lists are deprecated, please migrate to using the \"collections\" library soon.\n");
listDeprecationWarning = false;
}
if (in->args.length < 1) { if (in->args.length < 1) {
runtimeError(TOO_FEW_ARGS, "Expecting 1 arg", in, currentInstruction); runtimeError(TOO_FEW_ARGS, "Expecting 1 arg", in, currentInstruction);
} }
@@ -980,6 +986,10 @@ GroundValue interpretGroundInstruction(GroundInstruction inst, GroundScope* scop
break; break;
} }
case SETLISTAT: { case SETLISTAT: {
if (listDeprecationWarning) {
printf("Lists are deprecated, please migrate to using the \"collections\" library soon.\n");
listDeprecationWarning = false;
}
if (in->args.length < 3) { if (in->args.length < 3) {
runtimeError(TOO_FEW_ARGS, "Expecting 3 args", in, currentInstruction); runtimeError(TOO_FEW_ARGS, "Expecting 3 args", in, currentInstruction);
} }
@@ -1016,6 +1026,10 @@ GroundValue interpretGroundInstruction(GroundInstruction inst, GroundScope* scop
break; break;
} }
case GETLISTAT: { case GETLISTAT: {
if (listDeprecationWarning) {
printf("Lists are deprecated, please migrate to using the \"collections\" library soon.\n");
listDeprecationWarning = false;
}
if (in->args.length < 2) { if (in->args.length < 2) {
runtimeError(TOO_FEW_ARGS, "Expecting 2 args", in, currentInstruction); runtimeError(TOO_FEW_ARGS, "Expecting 2 args", in, currentInstruction);
} }
@@ -1054,6 +1068,10 @@ GroundValue interpretGroundInstruction(GroundInstruction inst, GroundScope* scop
break; break;
} }
case GETLISTSIZE: { case GETLISTSIZE: {
if (listDeprecationWarning) {
printf("Lists are deprecated, please migrate to using the \"collections\" library soon.\n");
listDeprecationWarning = false;
}
if (in->args.length < 2) { if (in->args.length < 2) {
runtimeError(TOO_FEW_ARGS, "Expecting 2 args", in, currentInstruction); runtimeError(TOO_FEW_ARGS, "Expecting 2 args", in, currentInstruction);
} }
@@ -1078,6 +1096,10 @@ GroundValue interpretGroundInstruction(GroundInstruction inst, GroundScope* scop
break; break;
} }
case LISTAPPEND: { case LISTAPPEND: {
if (listDeprecationWarning) {
printf("Lists are deprecated, please migrate to using the \"collections\" library soon.\n");
listDeprecationWarning = false;
}
if (in->args.length < 2) { if (in->args.length < 2) {
runtimeError(TOO_FEW_ARGS, "Expecting 2 args", in, currentInstruction); runtimeError(TOO_FEW_ARGS, "Expecting 2 args", in, currentInstruction);
} }