From a869d0c4bfa21b29493653d9cbe297979752ead8 Mon Sep 17 00:00:00 2001 From: kim jeong yong Date: Tue, 6 Jan 2026 18:09:18 +0900 Subject: [PATCH 1/2] =?UTF-8?q?=ED=95=A8=EC=88=98=20=EB=B8=94=EB=A1=9D?= =?UTF-8?q?=EC=9D=98=20=EC=B4=88=EA=B8=B0=20=ED=8C=8C=EB=9D=BC=EB=AF=B8?= =?UTF-8?q?=ED=84=B0=20=ED=8F=89=EA=B0=80=20=EB=A1=9C=EC=A7=81=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84=20=EB=B0=8F=20=EC=8B=A4=ED=96=89=EA=B8=B0(executor)?= =?UTF-8?q?=20=EC=83=81=ED=83=9C=20=EC=97=85=EB=8D=B0=EC=9D=B4=ED=8A=B8.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/playground/blocks/block_func.js | 1 + src/playground/scope.js | 25 +++++++++++++++++++++---- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/playground/blocks/block_func.js b/src/playground/blocks/block_func.js index ab67c770e9..423e9ae0bd 100644 --- a/src/playground/blocks/block_func.js +++ b/src/playground/blocks/block_func.js @@ -463,6 +463,7 @@ module.exports = { this.funcExecutor.parentScope = script; this.funcExecutor.isFuncExecutor = true; this.funcExecutor.localVariables = _cloneDeep(func.localVariables); + this.funcExecutor.isNotSetParams = true; } const { promises } = this.funcExecutor.execute(); diff --git a/src/playground/scope.js b/src/playground/scope.js index 01dd09ef05..232e1ac243 100644 --- a/src/playground/scope.js +++ b/src/playground/scope.js @@ -26,12 +26,30 @@ class Scope { return Scope._reservedKeywords.has(param) ? '' : param; } + /** + * 함수 정의 블록의 초기 실행 시, 첫 번째 파라미터(FIELD)만 평가 + * 나머지 파라미터는 이 시점에서 평가할 필요가 없으므로 더미값(0) 반환 + */ + getFirstFuncParam(param, i) { + if (i !== 0) { + this.executor.isNotSetParams = false; + return 0; // 첫 번째 외 파라미터는 초기 실행 시 무시 + } + const newScope = new Entry.Scope(param, this.executor); + const result = newScope.run(this.entity, true); + return result; + } + getParams() { - const that = this; - return this.block.params.map((param) => { + const isNotSetParams = + this.executor.isNotSetParams && this.block.data.type === 'function_create_value'; + return this.block.params.map((param, i) => { if (param instanceof Entry.Block) { + if (isNotSetParams) { + return this.getFirstFuncParam(param, i); + } const fieldBlock = param; - const newScope = new Entry.Scope(fieldBlock, that.executor); + const newScope = new Entry.Scope(fieldBlock, this.executor); return newScope.run(this.entity, true); } else { return this.filterReservedKeywords(param); @@ -185,7 +203,6 @@ class Scope { } const values = this.getParams(); const isPromise = values.some((value) => value instanceof Promise); - // const schema = this.block.getSchema(); if (!schema.func) { return; } From 220535c3ffc633911b1d5eae8b0c4b15ae770a95 Mon Sep 17 00:00:00 2001 From: kim jeong yong Date: Wed, 7 Jan 2026 16:26:47 +0900 Subject: [PATCH 2/2] =?UTF-8?q?Scope=20=ED=81=B4=EB=9E=98=EC=8A=A4?= =?UTF-8?q?=EC=9D=98=20=ED=8C=8C=EB=9D=BC=EB=AF=B8=ED=84=B0=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC=20=EB=A1=9C=EC=A7=81=20=EB=A6=AC=ED=8C=A9=ED=84=B0?= =?UTF-8?q?=EB=A7=81.=20Entry.Block=20=EC=9D=B8=EC=8A=A4=ED=84=B4=EC=8A=A4?= =?UTF-8?q?=EC=99=80=20=EC=98=88=EC=95=BD=EC=96=B4=EB=A5=BC=20=EA=B5=AC?= =?UTF-8?q?=EB=B6=84=ED=95=98=EB=8F=84=EB=A1=9D=20=EA=B0=9C=EC=84=A0?= =?UTF-8?q?=ED=95=B4=20=ED=95=A8=EC=88=98=20=ED=8C=8C=EB=9D=BC=EB=AF=B8?= =?UTF-8?q?=ED=84=B0=20=EC=8B=A4=ED=96=89=20=EB=A1=9C=EC=A7=81=20=EC=A0=95?= =?UTF-8?q?=ED=99=95=EC=84=B1=20=ED=96=A5=EC=83=81.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/playground/blocks/block_func.js | 6 +++++- src/playground/scope.js | 33 ++++++++--------------------- 2 files changed, 14 insertions(+), 25 deletions(-) diff --git a/src/playground/blocks/block_func.js b/src/playground/blocks/block_func.js index 423e9ae0bd..295ee6c968 100644 --- a/src/playground/blocks/block_func.js +++ b/src/playground/blocks/block_func.js @@ -463,9 +463,13 @@ module.exports = { this.funcExecutor.parentScope = script; this.funcExecutor.isFuncExecutor = true; this.funcExecutor.localVariables = _cloneDeep(func.localVariables); - this.funcExecutor.isNotSetParams = true; } + this.funcExecutor.result = this.funcExecutor.scope; + this.funcExecutor.scope = new Entry.Scope( + this.funcExecutor.scope.block.statements[0].getFirstBlock(), + this.funcExecutor + ); const { promises } = this.funcExecutor.execute(); if (!this.funcExecutor.isEnd()) { diff --git a/src/playground/scope.js b/src/playground/scope.js index 232e1ac243..bcf714db76 100644 --- a/src/playground/scope.js +++ b/src/playground/scope.js @@ -13,10 +13,14 @@ class Scope { } getParam(index) { - const fieldBlock = this.block.params[index]; - const newScope = new Entry.Scope(fieldBlock, this.executor); - const result = newScope.run(this.entity, true); - return result; + const param = this.block.params[index]; + if (param instanceof Entry.Block) { + const newScope = new Entry.Scope(param, this.executor); + const result = newScope.run(this.entity, true); + return result; + } else { + return this.filterReservedKeywords(param); + } } // 클래스 레벨에서 한 번만 생성 @@ -26,28 +30,9 @@ class Scope { return Scope._reservedKeywords.has(param) ? '' : param; } - /** - * 함수 정의 블록의 초기 실행 시, 첫 번째 파라미터(FIELD)만 평가 - * 나머지 파라미터는 이 시점에서 평가할 필요가 없으므로 더미값(0) 반환 - */ - getFirstFuncParam(param, i) { - if (i !== 0) { - this.executor.isNotSetParams = false; - return 0; // 첫 번째 외 파라미터는 초기 실행 시 무시 - } - const newScope = new Entry.Scope(param, this.executor); - const result = newScope.run(this.entity, true); - return result; - } - getParams() { - const isNotSetParams = - this.executor.isNotSetParams && this.block.data.type === 'function_create_value'; - return this.block.params.map((param, i) => { + return this.block.params.map((param) => { if (param instanceof Entry.Block) { - if (isNotSetParams) { - return this.getFirstFuncParam(param, i); - } const fieldBlock = param; const newScope = new Entry.Scope(fieldBlock, this.executor); return newScope.run(this.entity, true);