Skip to content

Commit 76d32e4

Browse files
author
kim jeong yong
committed
Refactor scope assignment in block_func.js to use optional chaining and improve safety. Added a check for the first block before creating a new Entry.Scope instance.
1 parent 1d3eb49 commit 76d32e4

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/playground/blocks/block_func.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -466,10 +466,11 @@ module.exports = {
466466
}
467467

468468
this.funcExecutor.result = this.funcExecutor.scope;
469-
this.funcExecutor.scope = new Entry.Scope(
470-
this.funcExecutor.scope.block.statements[0].getFirstBlock(),
471-
this.funcExecutor
472-
);
469+
470+
const firstBlock = this.funcExecutor?.scope?.block?.statements[0]?.getFirstBlock();
471+
if(firstBlock) {
472+
this.funcExecutor.scope = new Entry.Scope(firstBlock, this.funcExecutor);
473+
}
473474
const { promises } = this.funcExecutor.execute();
474475

475476
if (!this.funcExecutor.isEnd()) {

0 commit comments

Comments
 (0)