From 3e674c4cddc68cafa139bf3bd878e79b0b6b9971 Mon Sep 17 00:00:00 2001 From: Chiri Vulpes Date: Tue, 10 Dec 2024 23:56:04 +1300 Subject: [PATCH] Fix build --- .../read/consume/expression/consumeExpression.ts | 4 ++-- src/chc/type/typeFunction.ts | 14 ++++++-------- src/chc/util/resolveExpression.ts | 3 +++ 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/chc/read/consume/expression/consumeExpression.ts b/src/chc/read/consume/expression/consumeExpression.ts index f7bcae7..7484503 100644 --- a/src/chc/read/consume/expression/consumeExpression.ts +++ b/src/chc/read/consume/expression/consumeExpression.ts @@ -2,7 +2,7 @@ import { ChiriType } from "../../../type/ChiriType" import type { Operator } from "../../../type/ChiriTypeManager" -import type { ChiriLiteralFunctionReference } from "../../../type/typeFunction" +import type { ChiriFunctionReference } from "../../../type/typeFunction" import typeInt from "../../../type/typeInt" import typeList from "../../../type/typeList" import typeRecord from "../../../type/typeRecord" @@ -103,7 +103,7 @@ export type ChiriExpressionOperand = | ChiriUnaryExpression | ChiriLiteralValue | ChiriVariableReference - | ChiriLiteralFunctionReference + | ChiriFunctionReference | ChiriBaseText | ChiriFunctionCall | ChiriPipe diff --git a/src/chc/type/typeFunction.ts b/src/chc/type/typeFunction.ts index 6ea8489..a6fcbe8 100644 --- a/src/chc/type/typeFunction.ts +++ b/src/chc/type/typeFunction.ts @@ -9,11 +9,10 @@ import TypeDefinition from "./TypeDefinition" export type ChiriLiteralRecordKeyValueTuple = [key: ChiriLiteralString | ChiriWordInterpolated, value: ChiriExpressionOperand] -export interface ChiriLiteralFunctionReference { - type: "literal" - subType: "function" +export interface ChiriFunctionReference { + type: "function" valueType: ChiriType - value: ChiriWord + name: ChiriWord position: ChiriPosition } @@ -22,7 +21,7 @@ export default TypeDefinition({ type: TYPE_FUNCTION, stringable: true, generics: true, - consumeOptionalConstructor: (reader): ChiriLiteralFunctionReference | undefined => { + consumeOptionalConstructor: (reader): ChiriFunctionReference | undefined => { const i = reader.i const name = consumeWordOptional(reader) if (!name || !reader.getFunctionOptional(name.value) || reader.getVariableOptional(name.value)) { @@ -31,10 +30,9 @@ export default TypeDefinition({ } return { - type: "literal", - subType: "function", + type: "function", valueType: TYPE_FUNCTION, - value: name, + name: name, position: name.position, } }, diff --git a/src/chc/util/resolveExpression.ts b/src/chc/util/resolveExpression.ts index 9180388..6122666 100644 --- a/src/chc/util/resolveExpression.ts +++ b/src/chc/util/resolveExpression.ts @@ -30,6 +30,9 @@ function resolveExpression (compiler: ChiriCompiler, expression?: ChiriExpressio case "get": return compiler.getVariable(expression.name.value, expression.name.position) + case "function": + return compiler.getFunction(expression.name.value, expression.name.position) as any + case "function-call": return compiler.callFunction(expression)