extern code use args, not readLine()

This commit is contained in:
2021-08-12 18:49:00 -06:00
parent 96fc58aed9
commit 821656b423
2 changed files with 12 additions and 10 deletions

View File

@@ -190,7 +190,7 @@ class CompilerTools {
} }
// return an expression for a lambda that calls new Process() that runs the target-specific file // return an expression for a lambda that calls new Process() that runs the target-specific file
var callingCode = 'function (?inputLines:Array<String>) { return kiss.Prelude.assertProcess("$command", [haxe.io.Path.join(["${args.outputFolder}", "$mainClassName.$scriptExt"])], inputLines); }'; var callingCode = 'function (?inputLines:Array<String>) { return kiss.Prelude.assertProcess("$command", [haxe.io.Path.join(["${args.outputFolder}", "$mainClassName.$scriptExt"])].concat(inputLines)); }';
#if test #if test
trace(callingCode); trace(callingCode);
#end #end

View File

@@ -856,21 +856,23 @@ class Macros {
bindingList[idx + 1] = untypedName; bindingList[idx + 1] = untypedName;
default: default:
} }
stringifyExpList.push(b.the(b.symbol("String"), b.callSymbol("tink.Json.stringify", [b.the(b.symbol(type), bindingList[idx + 1])]))); stringifyExpList.push(b.the(b.symbol("String"), b.callSymbol("tink.Json.stringify", [b.the(b.symbol(type), bindingList[idx + 1])])));
parseBindingList.push(bindingList[idx]); parseBindingList.push(bindingList[idx]);
parseBindingList.push(b.callSymbol("tink.Json.parse", [b.callField("readLine", b.callSymbol("Sys.stdin", []), [])])); parseBindingList.push(b.callSymbol("tink.Json.parse", [b.callField("shift", b.symbol("__args__"), [])]));
idx += 2; idx += 2;
} }
var externExps = [ var externExps = [
b.print( b.let([b.symbol("__args__"), b.callSymbol("Sys.args", [])],
b.callSymbol("tink.Json.stringify", [ [b.print(
b.the(bodyType, if (bindingList.length > 0) { b.callSymbol("tink.Json.stringify", [
b.let(parseBindingList, exps); b.the(bodyType, if (bindingList.length > 0) {
} else { b.let(parseBindingList, exps);
b.begin(exps); } else {
}) b.begin(exps);
])) })
]))])
]; ];
b.the( b.the(
bodyType, bodyType,