fix multiple-loading regression

This commit is contained in:
2021-06-14 00:02:26 -06:00
parent adf5cffaa7
commit 580b10bd79
2 changed files with 5 additions and 6 deletions

View File

@@ -128,6 +128,9 @@ class Kiss {
if (loadingDirectory == null)
loadingDirectory = k.loadingDirectory;
var fullPath = Path.join([loadingDirectory, kissFile]);
if (k.loadedFiles.exists(fullPath)) {
return;
}
k.loadedFiles[fullPath] = true;
var stream = Stream.fromFile(fullPath);
Reader.readAndProcess(stream, k, (nextExp) -> {

View File

@@ -24,9 +24,7 @@ class Macros {
wholeExp.checkNumArgs(1, 1, '(load "[file]")');
switch (args[0].def) {
case StrExp(otherKissFile):
if (!k.loadedFiles.exists(otherKissFile)) {
Kiss.load(otherKissFile, k);
}
Kiss.load(otherKissFile, k);
default:
throw CompileError.fromExp(args[0], "only argument to load should be a string literal of a .kiss file path");
}
@@ -44,9 +42,7 @@ class Macros {
};
switch (args[1].def) {
case StrExp(otherKissFile):
if (!k.loadedFiles.exists(otherKissFile)) {
Kiss.load(otherKissFile, k, libPath);
}
Kiss.load(otherKissFile, k, libPath);
default:
throw CompileError.fromExp(args[1], "second argument to loadFrom should be a string literal of a .kiss file path");
}