A question of arguments
Closed this issue · 2 comments
According to ES standard, the identifier arguments
cannot appear to the left of the assignment operator only in strict mode. However, when running this testcase blow which is in non-strict mode, hermes throws an expection. Why does this happen? Is this a feature of hermes?
revision
Test case
var NISLFuzzingFunc = function() {
arguments = 10;
print(arguments);
};
NISLFuzzingFunc();
Command
./build/bin/hermes -w testcase.js
Output
testcase.js:2:5: error: invalid assignment left-hand side
arguments = 10;
Expected behavior
10
Thank you for reporting this. It is a known limitation: we don't support some of the corner cases related to arguments in non-strict mode. See:
hermes/lib/AST/SemanticValidator.cpp
Lines 706 to 708 in 044cf4b
We intend to address it eventually, but it hasn't been a priority since we don't think it likely to be a problem in practice, and we are not aware of any legitimate use case (yet?). Outside of artificially constructed test cases, such code would be a pretty bad idea.
It is unlikely that we will fix this, since we haven't found any legitimate use cases.