fix multiple-loading regression
This commit is contained in:
@@ -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) -> {
|
||||
|
@@ -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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
default:
|
||||
throw CompileError.fromExp(args[1], "second argument to loadFrom should be a string literal of a .kiss file path");
|
||||
}
|
||||
|
@@ -87,13 +87,11 @@
|
||||
|
||||
// Day 8
|
||||
(when (<= 0 (days.indexOf 8))
|
||||
(print "BootCodeExample")
|
||||
(let [example (new BootCodeExample)]
|
||||
(example.setBreakHandler (lambda [example] (assert (= 5 .accumulator example))))
|
||||
(example.run))
|
||||
(print "BootCodeReal")
|
||||
(let [bootCode (new BootCodeReal)]
|
||||
(bootCode.setBreakHandler (lambda [bootCode] (assert (= 2058 (print bootCode.accumulator)))))
|
||||
(bootCode.setBreakHandler (lambda [bootCode] (assert (= 2058 bootCode.accumulator))))
|
||||
(bootCode.run))
|
||||
/* (print "BootCodeFixExample")
|
||||
(let [bootCode (new BootCodeFixExample)]
|
||||
|
Reference in New Issue
Block a user