mirror of
https://github.com/Samsung/escargot.git
synced 2026-06-22 10:01:50 +00:00
Eliminate duplicated code
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
This commit is contained in:
parent
2046b1faa9
commit
de4c7eb0db
14 changed files with 129 additions and 290 deletions
|
|
@ -1722,23 +1722,22 @@ public:
|
|||
// wrap right expression with arrow function
|
||||
result = this->finalize(startNode, builder.createArrowFunctionExpressionNode(subCodeBlockIndex));
|
||||
} else {
|
||||
auto startNode = this->createNode();
|
||||
auto node = this->createNode();
|
||||
InterpretedCodeBlock* currentTarget = this->codeBlock;
|
||||
size_t orgIndex = this->lookahead.start;
|
||||
|
||||
InterpretedCodeBlock* childBlock = currentTarget->childBlockAt(this->subCodeBlockIndex);
|
||||
this->scanner->index = childBlock->src().length() + childBlock->functionStart().index - currentTarget->functionStart().index;
|
||||
this->scanner->lineNumber = childBlock->functionStart().line;
|
||||
this->scanner->lineStart = childBlock->functionStart().index - childBlock->functionStart().column;
|
||||
this->scanner->lineNumber = childBlock->functionStart().line;
|
||||
|
||||
this->lookahead.lineNumber = this->scanner->lineNumber;
|
||||
this->lookahead.lineStart = this->scanner->lineStart;
|
||||
this->lookahead.lineNumber = this->scanner->lineNumber;
|
||||
this->nextToken();
|
||||
|
||||
// increase subCodeBlockIndex because parsing of an internal function is skipped
|
||||
this->subCodeBlockIndex++;
|
||||
|
||||
result = this->finalize(startNode, builder.createArrowFunctionExpressionNode(subCodeBlockIndex));
|
||||
result = this->finalize(node, builder.createArrowFunctionExpressionNode(subCodeBlockIndex));
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
@ -3605,7 +3604,6 @@ public:
|
|||
} else {
|
||||
auto startNode = this->createNode();
|
||||
InterpretedCodeBlock* currentTarget = this->codeBlock;
|
||||
size_t orgIndex = this->lookahead.start;
|
||||
|
||||
InterpretedCodeBlock* childBlock = currentTarget->childBlockAt(this->subCodeBlockIndex);
|
||||
this->scanner->index = childBlock->src().length() + childBlock->functionStart().index - currentTarget->functionStart().index;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue