This commit fixes compiler bug where it fails when optional values are compiled into absent values in nested calls. - Throw exception with more context for easier future debugging. - Add better validation of argument values for nested calls. - Refactor `FunctionCallCompiler` for better clarity and modularize it to make it more maintainable and testable. - Refactor related interface to not have `I` prefix, and function/variable names for better clarity. Context: Discovered this issue while attempting to call `RunInlineCodeAsTrustedInstaller` which in turn invokes `RunPowerShell` for issue #246. This led to the realization that despite parameters flagged as optional, the nested argument compilation didn't support them.
17 lines
722 B
TypeScript
17 lines
722 B
TypeScript
import { CodeSegmentMerger } from '@/application/Parser/Script/Compiler/Function/Call/Compiler/CodeSegmentJoin/CodeSegmentMerger';
|
|
import { CompiledCode } from '@/application/Parser/Script/Compiler/Function/Call/Compiler/CompiledCode';
|
|
import { CompiledCodeStub } from './CompiledCodeStub';
|
|
import { StubWithObservableMethodCalls } from './StubWithObservableMethodCalls';
|
|
|
|
export class CodeSegmentMergerStub
|
|
extends StubWithObservableMethodCalls<CodeSegmentMerger>
|
|
implements CodeSegmentMerger {
|
|
public mergeCodeParts(codeSegments: readonly CompiledCode[]): CompiledCode {
|
|
this.registerMethodCall({
|
|
methodName: 'mergeCodeParts',
|
|
args: [codeSegments],
|
|
});
|
|
return new CompiledCodeStub();
|
|
}
|
|
}
|