mirror of
https://github.com/Samsung/escargot.git
synced 2026-06-22 10:01:50 +00:00
Remove unused codes found by cppcheck
* remove unused functions * remove unused variables * mark necessary but unused variables with UNUSED_VARIABLE Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
This commit is contained in:
parent
a1b464f24a
commit
f168e4bd7b
30 changed files with 35 additions and 111 deletions
|
|
@ -155,34 +155,28 @@ InterpretedCodeBlock* ScriptParser::generateCodeBlockTreeFromASTWalker(Context*
|
|||
}
|
||||
}
|
||||
|
||||
bool usingNameIsResolvedOnCompileTime = false;
|
||||
if (codeBlock->canUseIndexedVariableStorage()) {
|
||||
if (codeBlock->hasName(blockIndex, uname)) {
|
||||
usingNameIsResolvedOnCompileTime = true;
|
||||
} else {
|
||||
auto parentBlockIndex = codeBlock->lexicalBlockIndexFunctionLocatedIn();
|
||||
InterpretedCodeBlock* c = codeBlock->parent();
|
||||
while (c && parentBlockIndex != LEXICAL_BLOCK_INDEX_MAX) {
|
||||
auto r = c->tryCaptureIdentifiersFromChildCodeBlock(parentBlockIndex, uname);
|
||||
if (codeBlock->canUseIndexedVariableStorage() && !codeBlock->hasName(blockIndex, uname)) {
|
||||
auto parentBlockIndex = codeBlock->lexicalBlockIndexFunctionLocatedIn();
|
||||
InterpretedCodeBlock* c = codeBlock->parent();
|
||||
while (c && parentBlockIndex != LEXICAL_BLOCK_INDEX_MAX) {
|
||||
auto r = c->tryCaptureIdentifiersFromChildCodeBlock(parentBlockIndex, uname);
|
||||
|
||||
if (r.first) {
|
||||
usingNameIsResolvedOnCompileTime = true;
|
||||
// if variable is global variable, we don't need to capture it
|
||||
if (!codeBlock->hasAncestorUsesNonIndexedVariableStorage() && !c->isKindOfFunction() && (r.second == SIZE_MAX || c->blockInfos()[r.second]->m_parentBlockIndex == LEXICAL_BLOCK_INDEX_MAX)) {
|
||||
if (r.first) {
|
||||
// if variable is global variable, we don't need to capture it
|
||||
if (!codeBlock->hasAncestorUsesNonIndexedVariableStorage() && !c->isKindOfFunction() && (r.second == SIZE_MAX || c->blockInfos()[r.second]->m_parentBlockIndex == LEXICAL_BLOCK_INDEX_MAX)) {
|
||||
} else {
|
||||
if (r.second == SIZE_MAX) {
|
||||
// captured variable is `var` declared variable
|
||||
c->markHeapAllocatedEnvironmentFromHere(LEXICAL_BLOCK_INDEX_MAX, c);
|
||||
} else {
|
||||
if (r.second == SIZE_MAX) {
|
||||
// captured variable is `var` declared variable
|
||||
c->markHeapAllocatedEnvironmentFromHere(LEXICAL_BLOCK_INDEX_MAX, c);
|
||||
} else {
|
||||
// captured variable is `let` declared variable
|
||||
c->markHeapAllocatedEnvironmentFromHere(r.second, c);
|
||||
}
|
||||
// captured variable is `let` declared variable
|
||||
c->markHeapAllocatedEnvironmentFromHere(r.second, c);
|
||||
}
|
||||
break;
|
||||
}
|
||||
parentBlockIndex = c->lexicalBlockIndexFunctionLocatedIn();
|
||||
c = c->parent();
|
||||
break;
|
||||
}
|
||||
parentBlockIndex = c->lexicalBlockIndexFunctionLocatedIn();
|
||||
c = c->parent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue