From 996a27c4f252de608f87ed38d8d27966b6d07309 Mon Sep 17 00:00:00 2001 From: polyprogrammist Date: Fri, 29 Dec 2023 22:01:37 -0500 Subject: [PATCH] tmp --- .../generators/typescript/generator.ts | 3 +- src/codegen/generators/typescript/utils.ts | 33 ++++++++++--------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/codegen/generators/typescript/generator.ts b/src/codegen/generators/typescript/generator.ts index 8d10c0e..a536ca2 100644 --- a/src/codegen/generators/typescript/generator.ts +++ b/src/codegen/generators/typescript/generator.ts @@ -244,8 +244,7 @@ export class TypescriptGenerator implements CodeGenerator { if (field == undefined) { throw new Error('') } - let thefield: TLBFieldType = field.fieldType - let fieldInfo = this.handleType(field, thefield, true, ctx, currentSlice, currentCell, 0); + let fieldInfo = this.handleType(field, field.fieldType, true, ctx, currentSlice, currentCell, 0); if (fieldInfo.loadExpr) { addLoadProperty(field.name, fieldInfo.loadExpr, fieldInfo.typeParamExpr, ctx.constructorLoadStatements, ctx.subStructLoadProperties); } diff --git a/src/codegen/generators/typescript/utils.ts b/src/codegen/generators/typescript/utils.ts index f23b87e..78b3176 100644 --- a/src/codegen/generators/typescript/utils.ts +++ b/src/codegen/generators/typescript/utils.ts @@ -4,6 +4,22 @@ import { TLBMathExpr, TLBVarExpr, TLBNumberExpr, TLBBinaryOp, TLBCode, TLBType, import { Identifier, BinaryExpression, ASTNode, TypeParametersExpression, ObjectProperty, TypedIdentifier } from './tsgen' import { getCalculatedExpression, getSubStructName, fillConstructors, firstLower, getCurrentSlice, bitLen, convertToMathExpr, splitForTypeValue, deriveMathExpression, goodVariableName } from '../../utils' +export type FieldInfoType = { + typeParamExpr: TypeExpression | undefined + loadExpr: Expression | undefined + loadFunctionExpr: Expression | undefined + storeExpr: Statement | undefined + storeExpr2: Statement | undefined + storeFunctionExpr: Expression | undefined + negatedVariablesLoads: Array<{ name: string; expression: Expression} > +} +export type ExprForParam = { + argLoadExpr: Expression | undefined + argStoreExpr: Expression | undefined + paramType: string + fieldLoadSuffix: string + fieldStoreSuffix: string +} export function sliceLoad(slicePrefix: number[], currentSlice: string) { return tExpressionStatement(tDeclareVariable(tIdentifier(getCurrentSlice(slicePrefix, 'slice')), @@ -122,22 +138,7 @@ export function getCondition(conditions: Array): Expression { return tIdentifier('true'); } } -export type FieldInfoType = { - typeParamExpr: TypeExpression | undefined - loadExpr: Expression | undefined - loadFunctionExpr: Expression | undefined - storeExpr: Statement | undefined - storeExpr2: Statement | undefined - storeFunctionExpr: Expression | undefined - negatedVariablesLoads: Array<{ name: string; expression: Expression} > -} -export type ExprForParam = { - argLoadExpr: Expression | undefined - argStoreExpr: Expression | undefined - paramType: string - fieldLoadSuffix: string - fieldStoreSuffix: string -} + export function isBigInt(fieldType: TLBNumberType) { if (fieldType.bits instanceof TLBNumberExpr) { if (fieldType.bits.n <= 64) {