Skip to content

Commit ee036ce

Browse files
ksh8281yichoi
authored andcommitted
Optimize script parser (#173)
* Implement lazy string literal parsing * Fix bug in Vector Signed-off-by: seonghyun kim <[email protected]>
1 parent 060df09 commit ee036ce

File tree

9 files changed

+432
-222
lines changed

9 files changed

+432
-222
lines changed

src/parser/ast/FunctionExpressionNode.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,13 @@ class FunctionExpressionNode : public ExpressionNode {
4242
{
4343
CodeBlock* blk = nullptr;
4444
size_t cnt = 0;
45-
for (size_t i = 0; i < context->m_codeBlock->asInterpretedCodeBlock()->childBlocks().size(); i++) {
46-
CodeBlock* c = context->m_codeBlock->asInterpretedCodeBlock()->childBlocks()[i];
45+
const auto& childBlocks = context->m_codeBlock->asInterpretedCodeBlock()->childBlocks();
46+
size_t len = childBlocks.size();
47+
size_t counter = context->m_feCounter;
48+
for (size_t i = 0; i < len; i++) {
49+
CodeBlock* c = childBlocks[i];
4750
if (c->isFunctionExpression()) {
48-
if (cnt == context->m_feCounter) {
51+
if (cnt == counter) {
4952
blk = c;
5053
break;
5154
}

0 commit comments

Comments
 (0)