hermes icon indicating copy to clipboard operation
hermes copied to clipboard

An issue about Immediately Invoked Function Expression

Open NWU-NISL opened this issue 4 years ago • 1 comments

Description

As the following test case showed, there is a variable called v1 with the same name as the function. In this case, Hermes treats v1 as the variable whose value is 20. But other engines such as v8, spidermonkey, javascriptcore and chakra think that v1 is the function. Is this a normal behavior of the Hermes engine?

Testcase

(function v1(){
    v1 = 20;
    print(v1 !== 20);
    print(typeof v1);
}());

Version

9caeabc

Command

./build/bin/hermes -w testcase.js

Output

false
number

Expected Output

true
function

contributor:@QuXing9

NWU-NISL avatar Oct 10 '20 01:10 NWU-NISL

Thank you for reporting this! It is a known issue and we are working on it.

tmikov avatar Oct 23 '20 23:10 tmikov