Bug 160970 - Variable::isReadOnly() and Variable::isConst() are almost the same
Summary: Variable::isReadOnly() and Variable::isConst() are almost the same
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-08-18 13:29 PDT by JF Bastien
Modified: 2016-08-18 13:29 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description JF Bastien 2016-08-18 13:29:28 PDT
It looks like BytecodeGenerator::emitReadOnlyExceptionIfNeeded() is the only one that uses Variable::isConst() in: `isStrictMode() || variable.isConst()`.
isConst is: `isReadOnly() && m_isLexicallyScoped`.
All calls to emitReadOnlyExceptionIfNeeded are guarded by isReadOnly().

This means that the code for emitReadOnlyExceptionIfNeeded is equivalent to: `isReadOnly && (isStrictMode || (isReadOnly && m_isLexicallyScoped))`.

isReadOnly is only set by BytecodeGenerator::variable