Better (load) call error checking
This commit is contained in:
@@ -97,14 +97,20 @@ class Kiss {
|
|||||||
#end
|
#end
|
||||||
switch (nextExp.def) {
|
switch (nextExp.def) {
|
||||||
// (load... ) is the specialest of forms because it calls build() again and those fields need to be merged
|
// (load... ) is the specialest of forms because it calls build() again and those fields need to be merged
|
||||||
case CallExp({pos: _, def: Symbol("load")}, [{pos: _, def: StrExp(otherKissFile)}]):
|
case CallExp({pos: _, def: Symbol("load")}, loadArgs):
|
||||||
var filePath = Path.join([loadingDirectory, otherKissFile]);
|
nextExp.checkNumArgs(1, 1, "(load \"[file]\")");
|
||||||
if (!k.loadedFiles.exists(filePath)) {
|
switch (loadArgs[0].def) {
|
||||||
var loadedFields = Kiss.build(filePath, k, false);
|
case StrExp(otherKissFile):
|
||||||
for (field in loadedFields) {
|
var filePath = Path.join([loadingDirectory, otherKissFile]);
|
||||||
classFields.push(field);
|
if (!k.loadedFiles.exists(filePath)) {
|
||||||
}
|
var loadedFields = Kiss.build(filePath, k, false);
|
||||||
k.loadedFiles[filePath] = true;
|
for (field in loadedFields) {
|
||||||
|
classFields.push(field);
|
||||||
|
}
|
||||||
|
k.loadedFiles[filePath] = true;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
throw CompileError.fromExp(loadArgs[0], "only argument to load should be a string literal");
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
var field = readerExpToField(nextExp, k);
|
var field = readerExpToField(nextExp, k);
|
||||||
|
Reference in New Issue
Block a user