diff --git a/src/kiss/Kiss.hx b/src/kiss/Kiss.hx index d1e22c2..b61a447 100644 --- a/src/kiss/Kiss.hx +++ b/src/kiss/Kiss.hx @@ -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) -> { diff --git a/src/kiss/Macros.hx b/src/kiss/Macros.hx index 590dbc7..0f75f3d 100644 --- a/src/kiss/Macros.hx +++ b/src/kiss/Macros.hx @@ -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"); }