make null-extern no-extern, which throws an error

This commit is contained in:
2021-10-12 13:44:15 -06:00
parent 7a4bf94905
commit a1ec7d19c3
2 changed files with 4 additions and 5 deletions

View File

@@ -794,12 +794,11 @@ class Macros {
wholeExp.checkNumArgs(4, null, "(#extern <BodyType> <lang> <?compileArgs object> [<typed bindings...>] <body...>)"); wholeExp.checkNumArgs(4, null, "(#extern <BodyType> <lang> <?compileArgs object> [<typed bindings...>] <body...>)");
var b = wholeExp.expBuilder(); var b = wholeExp.expBuilder();
// Skip all extern code generation if -D null-extern is provided to the compiler // Skip all extern code generation if -D no-extern is provided to the compiler
if (Context.defined("null-extern")) { if (Context.defined("no-extern")) {
return b.symbol("null"); return b.callSymbol("throw", [b.str("tried to call #extern code when -D no-extern was provided during compilation")]);
} }
var bodyType = exps.shift(); var bodyType = exps.shift();
var langExp = exps.shift(); var langExp = exps.shift();
var originalLang = langExp.symbolNameValue(); var originalLang = langExp.symbolNameValue();

View File

@@ -37,7 +37,7 @@ class Main {
// kiss implement [type] [fromLib] // kiss implement [type] [fromLib]
var _pwd = args.pop(); var _pwd = args.pop();
var theInterface = args.shift(); var theInterface = args.shift();
var pArgs = ["-D", "null-extern", "build-scripts/common-args.hxml", "-lib", "kiss"]; var pArgs = ["-D", "no-extern", "build-scripts/common-args.hxml", "-lib", "kiss"];
// pass --lib and the lib containing the interface as specified // pass --lib and the lib containing the interface as specified
if (args.length > 0) { if (args.length > 0) {
pArgs = pArgs.concat(["-lib", args.shift()]); pArgs = pArgs.concat(["-lib", args.shift()]);