facebook / facebook/hermes

An issue about Immediately Invoked Function Expression

Open
#389 2 comments 0 reactions 1 assignee Claimed by @tmikov View on GitHub
bug in-progress
Dominant language
JavaScript
Stars
11.3k
Forks
859
Avg merge
1h 30m
Merged PRs (30d)
3

Description

## 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

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

#### Version

[9caeabc](https://github.com/facebook/hermes/commit/9caeabcda3876828e25c2aa816356a70224c0813)

#### Command

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

#### Output

~~~javascript
false
number
~~~

#### Expected Output

~~~javascript
true
function
~~~

contributor:@QuXing9

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.