Add Array support to functions
This commit is contained in:
12
src/ir.ts
12
src/ir.ts
@ -44,8 +44,8 @@ export type ServiceFunctionDecorators = {
|
||||
|
||||
export interface ServiceFunctionParamsDefinition {
|
||||
name: string;
|
||||
inputs: { type: string; name: string }[];
|
||||
return: string | undefined;
|
||||
inputs: { type: string; name: string, array: boolean }[];
|
||||
return: { type: string, array: boolean } | undefined;
|
||||
decorators: ServiceFunctionDecorators
|
||||
}
|
||||
export type ServiceFunctionDefinition = ServiceFunctionParamsDefinition;
|
||||
@ -191,11 +191,11 @@ export default function get_ir(parsed: Parsed): IR {
|
||||
);
|
||||
alreadyFoundFunctions.add(fnc.name);
|
||||
if (fnc.return_type) {
|
||||
if (defined.indexOf(fnc.return_type) >= 0) {
|
||||
if (!depends.some((a) => a === fnc.return_type))
|
||||
depends.push(fnc.return_type);
|
||||
if (defined.indexOf(fnc.return_type.type) >= 0) {
|
||||
if (!depends.some((a) => a === fnc.return_type.type))
|
||||
depends.push(fnc.return_type.type);
|
||||
} else {
|
||||
if (fnc.return_type !== "void" && builtin.indexOf(fnc.return_type) < 0) {
|
||||
if (fnc.return_type.type !== "void" && builtin.indexOf(fnc.return_type.type) < 0) {
|
||||
throw new IRError(
|
||||
fnc,
|
||||
`Type ${fnc.return_type} is not defined`
|
||||
|
Reference in New Issue
Block a user