Open DruggedBunny opened 7 years ago
It is most certainly a macro, and in fact this is the exact area it is defined in:
// Emitted after every Haxe line. number is the original Haxe line number.
// Only if stack lines are to be tracked
#ifdef HXCPP_STACK_LINE
// If the debugger is enabled, must check for a breakpoint at every line.
#ifdef HXCPP_DEBUGGER
#define HX_STACK_LINE(number) \
_hx_stackframe.lineNumber = number; \
/* This is incorrect - a read memory barrier is needed here. */ \
/* For now, just live with the exceedingly rare cases where */ \
/* breakpoints are missed */ \
if (hx::gShouldCallHandleBreakpoints) { \
__hxcpp_on_line_changed(_hx_stackframe.ctx); \
}
#define HX_STACK_LINE_QUICK(number) _hx_stackframe.lineNumber = number;
#else
// Just set it
#define HX_STACK_LINE(number) _hx_stackframe.lineNumber = number;
#define HX_STACK_LINE_QUICK(number) _hx_stackframe.lineNumber = number;
#endif
#else
#define HX_STACK_LINE(number)
#define HX_STACK_LINE_QUICK(number)
#endif
// For tidier generated code
#define HXLINE(number) HX_STACK_LINE(number)
Literally just slap it right after whatever line was most recently transpiled. And I assume if there was an error, the last line is marked and can be pointed too on exit. That's an awesome thing to have if we can get this in.
Not sure if this is the right place for it, but...
Just idly looked at the latest Haxe release info in passing on Hacker News (I've never actually used it), and noticed this:
I think HXLINE is probably a no-op macro something like this, or gets converted into "" (if macros can do that!).
Thought it might be something worth looking at, whether for allowing manual cross-referencing between .mx2 and output, or perhaps, even better, it might even help with debugging, taking (eg.) C++ debugger output and referencing it back to the .mx2 source in the Ted2 debug output.