extern code use args, not readLine()

This commit is contained in:
2021-08-12 18:49:00 -06:00
parent 290a5e7de1
commit a1eb3f2b97
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
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
trace(callingCode);
#end

View File

@@ -856,21 +856,23 @@ class Macros {
bindingList[idx + 1] = untypedName;
default:
}
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(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;
}
var externExps = [
b.print(
b.callSymbol("tink.Json.stringify", [
b.the(bodyType, if (bindingList.length > 0) {
b.let(parseBindingList, exps);
} else {
b.begin(exps);
})
]))
b.let([b.symbol("__args__"), b.callSymbol("Sys.args", [])],
[b.print(
b.callSymbol("tink.Json.stringify", [
b.the(bodyType, if (bindingList.length > 0) {
b.let(parseBindingList, exps);
} else {
b.begin(exps);
})
]))])
];
b.the(
bodyType,