Skip to content

Commit 1b09237

Browse files
authored
Merge pull request #3035 from entrylabs/issue/10197
함수 블록의 초기 파라미터 평가 로직 구현 및
2 parents 0ed3190 + 220535c commit 1b09237

2 files changed

Lines changed: 14 additions & 7 deletions

File tree

src/playground/blocks/block_func.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,11 @@ module.exports = {
465465
this.funcExecutor.localVariables = _cloneDeep(func.localVariables);
466466
}
467467

468+
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+
);
468473
const { promises } = this.funcExecutor.execute();
469474

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

src/playground/scope.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,14 @@ class Scope {
1313
}
1414

1515
getParam(index) {
16-
const fieldBlock = this.block.params[index];
17-
const newScope = new Entry.Scope(fieldBlock, this.executor);
18-
const result = newScope.run(this.entity, true);
19-
return result;
16+
const param = this.block.params[index];
17+
if (param instanceof Entry.Block) {
18+
const newScope = new Entry.Scope(param, this.executor);
19+
const result = newScope.run(this.entity, true);
20+
return result;
21+
} else {
22+
return this.filterReservedKeywords(param);
23+
}
2024
}
2125

2226
// 클래스 레벨에서 한 번만 생성
@@ -27,11 +31,10 @@ class Scope {
2731
}
2832

2933
getParams() {
30-
const that = this;
3134
return this.block.params.map((param) => {
3235
if (param instanceof Entry.Block) {
3336
const fieldBlock = param;
34-
const newScope = new Entry.Scope(fieldBlock, that.executor);
37+
const newScope = new Entry.Scope(fieldBlock, this.executor);
3538
return newScope.run(this.entity, true);
3639
} else {
3740
return this.filterReservedKeywords(param);
@@ -185,7 +188,6 @@ class Scope {
185188
}
186189
const values = this.getParams();
187190
const isPromise = values.some((value) => value instanceof Promise);
188-
// const schema = this.block.getSchema();
189191
if (!schema.func) {
190192
return;
191193
}

0 commit comments

Comments
 (0)