wrap conditional compilation hscript parsing in the try-catch
This commit is contained in:
@@ -188,11 +188,11 @@ class Macros {
|
|||||||
var parser = new Parser();
|
var parser = new Parser();
|
||||||
var conditionInterp = new KissInterp(true);
|
var conditionInterp = new KissInterp(true);
|
||||||
var conditionStr = Reader.toString(conditionExp.def);
|
var conditionStr = Reader.toString(conditionExp.def);
|
||||||
var conditionHScript = parser.parseString(Prelude.convertToHScript(conditionStr));
|
|
||||||
for (flag => value in Context.getDefines()) {
|
for (flag => value in Context.getDefines()) {
|
||||||
conditionInterp.variables.set(flag, value);
|
conditionInterp.variables.set(flag, value);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
var conditionHScript = parser.parseString(Prelude.convertToHScript(conditionStr));
|
||||||
return if (Prelude.truthy(conditionInterp.execute(conditionHScript))) {
|
return if (Prelude.truthy(conditionInterp.execute(conditionHScript))) {
|
||||||
thenExp;
|
thenExp;
|
||||||
} else {
|
} else {
|
||||||
@@ -231,7 +231,6 @@ class Macros {
|
|||||||
var parser = new Parser();
|
var parser = new Parser();
|
||||||
var caseInterp = new KissInterp();
|
var caseInterp = new KissInterp();
|
||||||
var caseStr = Reader.toString(caseExp.def);
|
var caseStr = Reader.toString(caseExp.def);
|
||||||
var caseHScript = parser.parseString(Prelude.convertToHScript(caseStr));
|
|
||||||
for (matchBodySymbol in matchBodySymbols) {
|
for (matchBodySymbol in matchBodySymbols) {
|
||||||
caseInterp.variables.set(Prelude.symbolNameValue(matchBodySymbol), matchBodies.shift());
|
caseInterp.variables.set(Prelude.symbolNameValue(matchBodySymbol), matchBodies.shift());
|
||||||
}
|
}
|
||||||
@@ -239,6 +238,7 @@ class Macros {
|
|||||||
caseInterp.variables.set(flag, value);
|
caseInterp.variables.set(flag, value);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
var caseHScript = parser.parseString(Prelude.convertToHScript(caseStr));
|
||||||
return caseInterp.execute(caseHScript);
|
return caseInterp.execute(caseHScript);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw CompileError.fromExp(caseExp, '#case evaluation threw error $e');
|
throw CompileError.fromExp(caseExp, '#case evaluation threw error $e');
|
||||||
|
Reference in New Issue
Block a user