You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm running into some issues with a CDP Debugger (vscode-js-debug) connected to Hermes. Namely, when a variable is initialized in a for-loop, like the following:
for (let i=0; i <10; i++) {
{... some code}
}
The variables in the for-loop initializer don't get updated in the debugger. I've narrowed down the root cause to Hermes sending two copies of the variable when Runtime.getProperties is called on the local scope and two copies of the variable are returned. One for the initial value, and one for the current value:
Digging through the code I think it may be how Hermes is transforming a for block, creating two copies of the variable initialized in the initializer const/let x = init; and const/let x = temp_x;:
Are you using the --block-scoping CLI option? It is experimental and unsupported - we have meanwhile switched to a completely different approach for implementing block scoping.
(With that said, we can take a look if this is something easily fixable)
@Beanyy the new implementation will be in the next major version (codename Static Hermes), which we are hoping to release as a drop-in replacement of Hermes by the middle of the year.
Bug Description
I'm running into some issues with a CDP Debugger (vscode-js-debug) connected to Hermes. Namely, when a variable is initialized in a for-loop, like the following:
The variables in the for-loop initializer don't get updated in the debugger. I've narrowed down the root cause to Hermes sending two copies of the variable when
Runtime.getProperties
is called on the local scope and two copies of the variable are returned. One for the initial value, and one for the current value:Digging through the code I think it may be how Hermes is transforming a for block, creating two copies of the variable initialized in the initializer
const/let x = init;
andconst/let x = temp_x;
:hermes/lib/AST/BlockScopingTransformations.cpp
Lines 227 to 245 in 55ccdf1
Moving the variable initialization outside of the for-loop fixes the issue.
Do you think you guys can help with this issue? Thanks!
Hermes git revision (if applicable): 7d9baea7221a1f69828764938fb5de0737419f6b
React Native version: n/a
OS: Android
Platform: arm64-v8a
Steps To Reproduce
i
:The Expected Behavior
Expected behaviour is for there to just be one copy of the for loop's initializer variable to be sent in the debugger info.
The text was updated successfully, but these errors were encountered: