Skip to content

Commit 989e692

Browse files
clover2123ksh8281
authored andcommitted
Remove duplicated parameter-check methods
Signed-off-by: Hyukwoo Park <hyukwoo.park@jbnu.ac.kr>
1 parent 6ebbd22 commit 989e692

File tree

4 files changed

+5
-15
lines changed

4 files changed

+5
-15
lines changed

src/parser/CodeBlock.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ void InterpretedCodeBlock::recordFunctionParsingInfo(ASTScopeContext* scopeCtx,
423423
void InterpretedCodeBlock::captureArguments(bool needToAllocateOnStack)
424424
{
425425
AtomicString arguments = m_context->staticStrings().arguments;
426-
ASSERT(!hasParameterName(arguments));
426+
ASSERT(!isParameterName(arguments));
427427
ASSERT(!isGlobalCodeBlock() && !isArrowFunctionExpression() && isKindOfFunction());
428428

429429
if (m_usesArgumentsObject) {

src/parser/CodeBlock.h

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -925,7 +925,7 @@ class InterpretedCodeBlock : public CodeBlock {
925925
return findVarName(name) != SIZE_MAX;
926926
}
927927

928-
bool hasParameterName(const AtomicString& name)
928+
bool isParameterName(const AtomicString& name)
929929
{
930930
for (size_t i = 0; i < parameterNamesCount(); i++) {
931931
if (m_parameterNames[i] == name) {
@@ -935,16 +935,6 @@ class InterpretedCodeBlock : public CodeBlock {
935935
return false;
936936
}
937937

938-
bool isParameterName(const AtomicString& name)
939-
{
940-
size_t r = findVarName(name);
941-
if (r != SIZE_MAX) {
942-
return m_identifierInfos[r].m_isParameterName;
943-
}
944-
945-
return false;
946-
}
947-
948938
void markHeapAllocatedEnvironmentFromHere(LexicalBlockIndex blockIndex = 0, InterpretedCodeBlock* to = nullptr);
949939

950940
void setConstructedObjectPropertyCount(size_t s)

src/parser/ScriptParser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ InterpretedCodeBlock* ScriptParser::generateCodeBlockTreeFromASTWalker(Context*
186186
bool needToCaptureArguments = false;
187187
InterpretedCodeBlock* argumentsObjectHolder = codeBlock;
188188
while (argumentsObjectHolder && !argumentsObjectHolder->isGlobalCodeBlock()) {
189-
if (UNLIKELY(argumentsObjectHolder->hasParameterName(arguments))) {
189+
if (UNLIKELY(argumentsObjectHolder->isParameterName(arguments))) {
190190
// no need to create arguments object since it has a parameter of which name is `arguments`
191191
break;
192192
}

src/parser/ast/IdentifierNode.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class IdentifierNode : public Node {
107107
context->addLexicallyDeclaredNames(m_name);
108108
}
109109

110-
if (context->m_inParameterInitialization && codeBlock->m_codeBlock->hasParameterName(m_name)) {
110+
if (context->m_inParameterInitialization && codeBlock->m_codeBlock->isParameterName(m_name)) {
111111
context->addInitializedParameterNames(m_name);
112112
}
113113

@@ -205,7 +205,7 @@ class IdentifierNode : public Node {
205205
codeBlock->pushCode(EnsureArgumentsObject(ByteCodeLOC(m_loc.index)), context, this->m_loc.index);
206206
}
207207

208-
if (context->m_inParameterInitialization && codeBlock->m_codeBlock->hasParameterName(m_name)) {
208+
if (context->m_inParameterInitialization && codeBlock->m_codeBlock->isParameterName(m_name)) {
209209
addParameterReferenceErrorIfNeeds(codeBlock, context);
210210
}
211211

0 commit comments

Comments
 (0)