Skip to content

Commit

Permalink
feat: 修复带有参数的函数会报错的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
EnchangDu committed Dec 6, 2023
1 parent 0471db7 commit 1f4ec8e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/processes/executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,17 @@ function packageEntrance(inputParams: Map<string, any>, materials: Namespace[],
})
} else {
(ns.items as FunInfo[]).forEach((funInfo) => {
const funcInputParam = funInfo.input? funInfo.input.map(item => item.name): ''
if (funInfo.isAsync) {
const AsyncFunction = Object.getPrototypeOf(async function () {
}).constructor
// Add async function
$[ns.name][funInfo.name] = new AsyncFunction(funInfo.body)
$[ns.name][funInfo.name] = funcInputParam? new AsyncFunction(...funcInputParam, funInfo.body): new AsyncFunction(funInfo.body)
} else {
const syncFunction = Object.getPrototypeOf(function () {
}).constructor
// Add sync function
$[ns.name][funInfo.name] = new syncFunction(funInfo.body)
$[ns.name][funInfo.name] = funcInputParam? new syncFunction(...funcInputParam, funInfo.body): new syncFunction(funInfo.body)
}
})
}
Expand Down

0 comments on commit 1f4ec8e

Please sign in to comment.