qooxdoo / qooxdoo

qooxdoo - Universal JavaScript Framework
http://qooxdoo.org
Other
764 stars 259 forks source link

`verboseCreatedAt`: compiler flag to add stack trace to `$$createdAt` for more detail when debugging #10683

Closed WillsterJohnsonAtZenesis closed 1 month ago

WillsterJohnsonAtZenesis commented 1 month ago

In several places we use helper methods to more easily instantiate classes when there will be a lot of instances. Unfortunately, that means the $$createdAt for each of them points to the same place - the helper method - and doesn't give any information on the call stack which got to the helper method, which is what we really want to know when debugging.

This PR adds a new compiler flag, verboseCreatedAt, which is off by default. When enabled, this adds a stack field to the $$createdAt object. When debugging, it can be used to find exactly where we deferred control to some automation rather than simply the point where the new expression was written (as in the existing fields).

Downside: the line and column numbers are generated by the native Error class, which in the runtimes I've tested does not read source maps, so line and column numbers often won't match source code.

enabling this flag won't remove the existing $$createdAt fields, they still are/are not present based solely on addCreatedAt.

This PR should have no effect on existing code