Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
PolyProgrammist committed Dec 30, 2023
1 parent bccc4a6 commit 996a27c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
3 changes: 1 addition & 2 deletions src/codegen/generators/typescript/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
33 changes: 17 additions & 16 deletions src/codegen/generators/typescript/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')),
Expand Down Expand Up @@ -122,22 +138,7 @@ export function getCondition(conditions: Array<BinaryExpression>): 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) {
Expand Down

0 comments on commit 996a27c

Please sign in to comment.