11import { TLBCode , TLBConstructorTag , TLBField , TLBHashmapType , TLBMathExprType } from "../../ast" ;
22import { findNotReservedName , firstLower , getCurrentSlice } from "../../utils" ;
33import { ConstructorContext } from "./generator" ;
4- import { BinaryExpression , Expression , GenDeclaration , Identifier , ObjectExpression , Statement , TypeExpression , TypeParametersExpression , TypedIdentifier , id , tArrowFunctionExpression , tArrowFunctionType , tBinaryExpression , tDeclareVariable , tExpressionStatement , tForCycle , tFunctionCall , tFunctionDeclaration , tIfStatement , tMemberExpression , tMultiStatement , tNumericLiteral , tObjectExpression , tObjectProperty , tReturnStatement , tStringLiteral , tStructExpression , tTypeParametersExpression , tTypeWithParameters , tTypedIdentifier , tUnaryOpExpression , toCode } from "./tsgen" ;
4+ import { BinaryExpression , Expression , GenDeclaration , Identifier , ObjectExpression , Statement , TypeExpression , TypeParametersExpression , TypedIdentifier , id , tArrowFunctionExpression , tArrowFunctionType , tBinaryExpression , tDeclareVariable , tExpressionStatement , tForCycle , tFunctionCall , tFunctionDeclaration , tIdentifier , tIfStatement , tMemberExpression , tMultiStatement , tNumericLiteral , tObjectExpression , tObjectProperty , tReturnStatement , tStringLiteral , tStructDeclaration , tStructExpression , tTypeParametersExpression , tTypeWithParameters , tTypedIdentifier , tUnaryOpExpression , toCode } from "./tsgen" ;
55import { ExprForParam , convertToAST , getNegationDerivationFunctionBody , isBigIntExpr } from "./utils" ;
66
77export function tEqualExpression ( left : Expression , right : Expression ) {
@@ -40,6 +40,7 @@ export function bitlenFunctionDecl(): GenDeclaration {
4040 [ tExpressionStatement ( id ( "return n.toString(2).length" ) ) ]
4141 ) ;
4242}
43+
4344export function typedSlice ( ) {
4445 return [ tTypedIdentifier ( id ( "slice" ) , id ( "Slice" ) ) ] ;
4546}
@@ -331,8 +332,8 @@ export function negationDerivationFuncDecl(
331332 )
332333 ) ;
333334}
334- export function dictStoreStmt ( currentCell : string , storeParametersInside : Expression [ ] , keyForStore : Expression , valueStore : ObjectExpression ) : Statement | undefined {
335- return tExpressionStatement ( tFunctionCall ( tMemberExpression ( id ( currentCell ) , id ( 'storeDict' ) ) , storeParametersInside . concat ( [ keyForStore , valueStore ] ) ) ) ;
335+ export function dictStoreStmt ( currentCell : string , storeParametersInside : Expression [ ] , keyForStore : Expression , valueStore : ObjectExpression , direct : boolean ) : Statement | undefined {
336+ return tExpressionStatement ( tFunctionCall ( tMemberExpression ( id ( currentCell ) , id ( 'storeDict' + ( direct ? 'Direct' : '' ) ) ) , storeParametersInside . concat ( [ keyForStore , valueStore ] ) ) ) ;
336337}
337338export function dictTypeParamExpr ( fieldType : TLBHashmapType , typeParamExpr : TypeExpression ) : TypeExpression | undefined {
338339 return tTypeWithParameters ( id ( 'Dictionary' ) , tTypeParametersExpression ( [ ( isBigIntExpr ( fieldType . key ) ? id ( 'bigint' ) : id ( 'number' ) ) , typeParamExpr ] ) ) ;
@@ -351,8 +352,8 @@ export function dictValueStore(typeParamExpr: TypeExpression, storeFunctionExpr:
351352 )
352353 ] ) ;
353354}
354- export function dictLoadExpr ( keyForLoad : Expression , loadFunctionExpr : Expression , currentSlice : string ) : Expression | undefined {
355- return tFunctionCall ( tMemberExpression ( id ( 'Dictionary' ) , id ( 'load' ) ) , [ keyForLoad , dictValueLoad ( loadFunctionExpr ) , id ( currentSlice ) ] ) ;
355+ export function dictLoadExpr ( keyForLoad : Expression , loadFunctionExpr : Expression , currentSlice : string , direct : boolean ) : Expression | undefined {
356+ return tFunctionCall ( tMemberExpression ( id ( 'Dictionary' ) , id ( 'load' + ( direct ? 'Direct' : '' ) ) ) , [ keyForLoad , dictValueLoad ( loadFunctionExpr ) , id ( currentSlice ) ] ) ;
356357}
357358function dictValueLoad ( loadFunctionExpr : Expression ) {
358359 return tObjectExpression ( [
0 commit comments