Closed yuxiaomao closed 4 months ago
Interesting failure in tests/optimization:
src/Test.hx:125: lines 125-127 : Warning : Expected: var _g_set_amount = 10;var _g_current = 0;while(_g_current++ < 10) {var i = null;}
src/Test.hx:125: lines 125-127 : Warning : Actual : var inlCollectionIterator_set_amount = 10;var _g_current = 0;while(_g_current++ < 10) {var i = null;}
I think the new version is actually better because the variable name is more descriptive. I'm not sure why this changed here though.
Hum, I think it is because I alloc VInlinedConstructorVariable
instead of VInlined
, so during get_pretty_name
it get the VGenerated
name (which is cl_path
) instead of VInlined
name (which is just fname
)?
I'm fine with merging this, we can deal with the is_gen_local
question later because I won't be able to help much with that anyway. Unless there's anything else you wanted to do here before merging?
Just discussed with @ncannasse , I'll rename is_gen_local
and change argument of VInlinedConstructorVariable
from string to string list. Please wait next commit.
I wanted to suggest a string list too but I'm not sure if we actually care about the individual parts of it. If so then yes, that's better indeed.
This PR try to address https://github.com/vshaxe/hashlink-debugger/issues/91 (ping @ncannasse) : When performing inline constructor optimization, the original variable is lost and cannot be reconstructed at the debugger side. In this original example,
pt
is replaced bypt_x
,pt_y
(withv_kind
ofVInlined
).At the same time, other inlined variable should not appear in debugger, such as
z2
in thefoo2()
function below (z2
appear also asVInlined
infoo2()
)This PR do the following:
v_kind
VInlinedConstructorVariable
, and add astring
parameter to it, in order to keep information about the original variable path (pt.x
,pt.y
in the first example).v_name
, but I think it might damage source code generation so I finally choose to pass it inv_kind
.VInlinedConstructorVariable
instead ofVInlined
, when the variable is replacing a VUser variable.pp.pt.x
I have done some tests in local, and my HL debugger can see those variables that I'd like to have (it can't parse the value correctly with the "." but I would like to validate the haxe change in a first place).