-
-
Notifications
You must be signed in to change notification settings - Fork 691
Description
Haxe code:
trace("hi!");Expected JavaScript output:
console.log("Foo.hx:1: " + "hi!");Actual JavaScript output:
console.log("hi!");According to the Haxe manual, the trace call should include location information, such as Test.hx:11, but with the JavaScript target it does not.
Printing the location is such a useful feature when using the trace function in multiple places when debugging.
And there shouldn't be any performance penalty because Haxe can inline the location information into the call to console.log
I know that you can use haxe.Log.trace("hi!"), which correctly logs the location info, but that's a lot less convenient than trace("hi!")
Fixing this issue also has another benefit: if you use trace on an enum (or any type which implements toString), it will print the raw JavaScript object, because it doesn't call toString on the enum. But with the expected JavaScript output it would pretty-print the enum, which is much nicer.