diff --git a/src/program.ts b/src/program.ts index 64d758d..21710f2 100644 --- a/src/program.ts +++ b/src/program.ts @@ -38,6 +38,9 @@ function pickReturnType(argTypes: Type[], signatures: [Type[], Type][], stateTyp export class Program { constructor(private program: PluginProgram, private plugin: Plugin) { + this.runArguments = this.plugin.typeEnvironment.startTypes.map( + t => t[0].slice(1) + ); }; validate(): string[] { diff --git a/test/test-interpreters.ts b/test/test-interpreters.ts index 2bf451b..8d492b6 100644 --- a/test/test-interpreters.ts +++ b/test/test-interpreters.ts @@ -692,6 +692,8 @@ describe("various interpreters", () => { const prog = new Program(pluginProg, nfa); const stringType = nfa.typeEnvironment.getStringType(); + assert.deepEqual([["string"]], prog.runArguments.map(t => t.map(t2 => t2.name))); + let results; results = prog.run([new CoreValue(stringType, "11")]); assert.equal(3, results.states.length, "correct number of states"); diff --git a/test/test-plugin.ts b/test/test-plugin.ts index 599555b..19c4ae3 100644 --- a/test/test-plugin.ts +++ b/test/test-plugin.ts @@ -50,6 +50,15 @@ describe("plugin", () => { const pluginProgram = new context.global["plugin-stub"].Program({ elements: [] }); program = new Program(pluginProgram, plugin); + + assert.deepEqual([ + ["any", "any"], + ["number", "number"], + ["number", "string"], + ["string", "string"], + ["string", "string"], + ], program.runArguments.map(t => t.map(t2 => t2.name))); + // const anyType = plugin.typeEnvironment.getType(plugin.typeEnvironment.checker.getAnyType()); stringType = plugin.typeEnvironment.getType(plugin.typeEnvironment.checker.getStringType()); numberType = plugin.typeEnvironment.getType(plugin.typeEnvironment.checker.getNumberType()); @@ -90,6 +99,8 @@ describe("plugin", () => { const pluginProgram = new context.global["plugin-stub"].Program({ elements: [] }); program = new Program(pluginProgram, plugin); + assert.deepEqual([["any", "any"]], program.runArguments.map(t => t.map(t2 => t2.name))); + // const anyType = plugin.typeEnvironment.getType(plugin.typeEnvironment.checker.getAnyType()); stringType = plugin.typeEnvironment.getType(plugin.typeEnvironment.checker.getStringType()); numberType = plugin.typeEnvironment.getType(plugin.typeEnvironment.checker.getNumberType());