This PR fixes a couple of incompatibilities between the console.debug/log/warn/error statements. console.log("a", "b", "c"); in the exits js-pdk does not output the expected a b c but just outputs a. also, an empty console.log errors out, but it normally is a no-op.
Test script
console.debug();
console.debug("debug: single console statement");
console.debug("debug:", "multiple", "console", "statements");
console.log();
console.log("log: single console statement");
console.log("log:", "multiple", "console", "statements");
console.warn();
console.warn("warn: single console statement");
console.warn("warn:", "multiple", "console", "statements");
console.error();
console.error("error: single console statement");
console.error("error:", "multiple", "console", "statements");
Output in chrome devtools
Output in current js-pdk
2024/05/26 11:18:19 Calling function : greet
Error: Uncaught InternalError: Need at least one arg
at greet (script.js:43)
note that the no-op behavior of an empty call is not present here and it instead errors.
Output in current js-pdk with empty calls removed
2024/05/26 11:19:26 debug: single console statement
2024/05/26 11:19:26 debug:
2024/05/26 11:19:26 log: single console statement
2024/05/26 11:19:26 log:
2024/05/26 11:19:26 warn: single console statement
2024/05/26 11:19:26 warn:
2024/05/26 11:19:26 error: single console statement
2024/05/26 11:19:26 error:
note the multi-statement lines do not print all arguments.
Output with the code change from the PR (including empty statements)
@bhelx anything else you'd like to see to make this a candidate for merging? I keep forgetting that console.log doesn't take multiple parameters in the pdk
Issue Summary
This PR fixes a couple of incompatibilities between the console.debug/log/warn/error statements.
console.log("a", "b", "c");
in the exits js-pdk does not output the expecteda b c
but just outputsa
. also, an empty console.log errors out, but it normally is a no-op.Test script
Output in chrome devtools
Output in current js-pdk
note that the no-op behavior of an empty call is not present here and it instead errors.
Output in current js-pdk with empty calls removed
note the multi-statement lines do not print all arguments.
Output with the code change from the PR (including empty statements)
note that the empty statements are properly no-ops, and the multiple args are properly printed.