diff options
author | bobzel <zzzman@gmail.com> | 2024-04-14 16:32:50 -0400 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2024-04-14 16:32:50 -0400 |
commit | 116b2d692e93a14d7ef68c859edf4b7f723a9f54 (patch) | |
tree | dc9be8a9e36b6cc2a8a2d94bfd6b713f526bed37 /src/client/util/Scripting.ts | |
parent | d8e4ff91b55736608a02d1ac68cb5c165841d6bb (diff) | |
parent | a6577f0c085d206db11e491bd4a1e4bae70e0ee6 (diff) |
update to master
Diffstat (limited to 'src/client/util/Scripting.ts')
-rw-r--r-- | src/client/util/Scripting.ts | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/client/util/Scripting.ts b/src/client/util/Scripting.ts index f5e162d16..422e708bc 100644 --- a/src/client/util/Scripting.ts +++ b/src/client/util/Scripting.ts @@ -88,15 +88,10 @@ function Run(script: string | undefined, customParams: string[], diagnostics: an } const result = compiledFunction.apply(thisParam, params).apply(thisParam, argsArray); - if (batch) { - batch.end(); - } - + batch?.end(); return { success: true, result }; } catch (error) { - if (batch) { - batch.end(); - } + batch?.end(); onError?.(script + ' ' + error); return { success: false, error, result: errorVal }; } @@ -255,7 +250,7 @@ export function CompileScript(script: string, options: ScriptOptions = {}): Comp const outputText = host.readFile('file.js'); const diagnostics = ts.getPreEmitDiagnostics(program).concat(testResult.diagnostics); - + if (script.startsWith('@')) options.typecheck = true; // need the compilation to fail so that the script will return itself as a string (instead of nothing) const result = Run(outputText, paramNames, diagnostics, script, options); if (options.globals) { |