@harmoniclabs/pebble 0.1.0-dev5 → 0.1.0-dev7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/IR/IRHash.d.ts +3 -3
- package/dist/IR/IRHash.js +47 -52
- package/dist/IR/IRNodes/IRApp.d.ts +12 -8
- package/dist/IR/IRNodes/IRApp.js +34 -20
- package/dist/IR/IRNodes/IRCase.d.ts +11 -7
- package/dist/IR/IRNodes/IRCase.js +33 -32
- package/dist/IR/IRNodes/IRConst.d.ts +7 -5
- package/dist/IR/IRNodes/IRConst.js +23 -13
- package/dist/IR/IRNodes/IRConstr.d.ts +11 -7
- package/dist/IR/IRNodes/IRConstr.js +34 -37
- package/dist/IR/IRNodes/IRDelayed.d.ts +12 -9
- package/dist/IR/IRNodes/IRDelayed.js +22 -18
- package/dist/IR/IRNodes/IRError.d.ts +9 -6
- package/dist/IR/IRNodes/IRError.js +12 -5
- package/dist/IR/IRNodes/IRForced.d.ts +9 -6
- package/dist/IR/IRNodes/IRForced.js +22 -18
- package/dist/IR/IRNodes/IRFunc.d.ts +14 -10
- package/dist/IR/IRNodes/IRFunc.js +35 -38
- package/dist/IR/IRNodes/IRHoisted.d.ts +16 -9
- package/dist/IR/IRNodes/IRHoisted.js +36 -18
- package/dist/IR/IRNodes/IRLetted.d.ts +14 -34
- package/dist/IR/IRNodes/IRLetted.js +65 -297
- package/dist/IR/IRNodes/IRNative/IRNativeTag.d.ts +3 -3
- package/dist/IR/IRNodes/IRNative/IRNativeTag.js +4 -4
- package/dist/IR/IRNodes/IRNative/index.d.ts +10 -8
- package/dist/IR/IRNodes/IRNative/index.js +56 -18
- package/dist/IR/IRNodes/IRNative/isForcedNative.d.ts +2 -0
- package/dist/IR/IRNodes/IRNative/isForcedNative.js +1 -1
- package/dist/IR/IRNodes/IRRecursive.d.ts +18 -10
- package/dist/IR/IRNodes/IRRecursive.js +36 -44
- package/dist/IR/IRNodes/IRSelfCall.d.ts +10 -24
- package/dist/IR/IRNodes/IRSelfCall.js +25 -87
- package/dist/IR/IRNodes/IRVar.d.ts +11 -19
- package/dist/IR/IRNodes/IRVar.js +26 -54
- package/dist/IR/IRNodes/utils/dependsByDbns.d.ts +1 -1
- package/dist/IR/IRNodes/utils/dependsByDbns.js +5 -11
- package/dist/IR/IRNodes/utils/hashVarSym.d.ts +1 -0
- package/dist/IR/IRNodes/utils/hashVarSym.js +37 -0
- package/dist/IR/IRNodes/utils/makeArrayLikeProxy.d.ts +2 -1
- package/dist/IR/IRTerm.d.ts +7 -0
- package/dist/IR/toUPLC/CompilerOptions.d.ts +5 -0
- package/dist/IR/toUPLC/CompilerOptions.js +10 -1
- package/dist/IR/toUPLC/_internal/_modifyChildFromTo.js +3 -0
- package/dist/IR/toUPLC/_internal/findAll.js +2 -73
- package/dist/IR/toUPLC/_internal/getDebruijnInTerm.js +7 -34
- package/dist/IR/toUPLC/_internal/iterTree.js +3 -17
- package/dist/IR/toUPLC/common_hoisted.d.ts +2 -0
- package/dist/IR/toUPLC/common_hoisted.js +4 -0
- package/dist/IR/toUPLC/compileIRToUPLC.d.ts +1 -1
- package/dist/IR/toUPLC/compileIRToUPLC.js +91 -14
- package/dist/IR/toUPLC/ctx/ToUplcCtx.d.ts +16 -0
- package/dist/IR/toUPLC/ctx/ToUplcCtx.js +67 -0
- package/dist/IR/toUPLC/subRoutines/_comptimeDropN.d.ts +8 -0
- package/dist/IR/toUPLC/subRoutines/_comptimeDropN.js +95 -0
- package/dist/IR/toUPLC/subRoutines/handleHoistedAndReturnRoot/index.js +7 -54
- package/dist/IR/toUPLC/subRoutines/handleLetted/groupByScope.d.ts +6 -13
- package/dist/IR/toUPLC/subRoutines/handleLetted/groupByScope.js +65 -71
- package/dist/IR/toUPLC/subRoutines/handleLetted/index.js +44 -170
- package/dist/IR/toUPLC/subRoutines/handleRecursiveTerms.js +7 -3
- package/dist/IR/toUPLC/subRoutines/hoistForcedNatives.js +3 -2
- package/dist/IR/toUPLC/subRoutines/inlineSingleUseAndReturnRoot/InlineSingleUseCtx.d.ts +22 -0
- package/dist/IR/toUPLC/subRoutines/inlineSingleUseAndReturnRoot/InlineSingleUseCtx.js +59 -0
- package/dist/IR/toUPLC/subRoutines/inlineSingleUseAndReturnRoot/inlineSingleUseAndReturnRoot.d.ts +0 -0
- package/dist/IR/toUPLC/subRoutines/inlineSingleUseAndReturnRoot/inlineSingleUseAndReturnRoot.js +217 -0
- package/dist/IR/toUPLC/subRoutines/markRecursiveHoistsAsForced.js +12 -49
- package/dist/IR/toUPLC/subRoutines/performUplcOptimizationsAndReturnRoot/expandFuncsAndReturnRoot.d.ts +1 -1
- package/dist/IR/toUPLC/subRoutines/performUplcOptimizationsAndReturnRoot/expandFuncsAndReturnRoot.js +11 -14
- package/dist/IR/toUPLC/subRoutines/performUplcOptimizationsAndReturnRoot/{index.d.ts → performUplcOptimizationsAndReturnRoot.d.ts} +0 -2
- package/dist/IR/toUPLC/subRoutines/performUplcOptimizationsAndReturnRoot/performUplcOptimizationsAndReturnRoot.js +151 -0
- package/dist/IR/toUPLC/subRoutines/removeUnusuedVarsAndReturnRoot/RemoveUnusedVarsCtx.d.ts +11 -0
- package/dist/IR/toUPLC/subRoutines/removeUnusuedVarsAndReturnRoot/RemoveUnusedVarsCtx.js +46 -0
- package/dist/IR/toUPLC/subRoutines/removeUnusuedVarsAndReturnRoot/removeUnusuedVarsAndReturnRoot.d.ts +2 -0
- package/dist/IR/toUPLC/subRoutines/removeUnusuedVarsAndReturnRoot/removeUnusuedVarsAndReturnRoot.js +80 -0
- package/dist/IR/toUPLC/subRoutines/replaceHoistedWithLetted.js +18 -11
- package/dist/IR/toUPLC/subRoutines/replaceNatives/nativeToIR.d.ts +45 -0
- package/dist/IR/toUPLC/subRoutines/replaceNatives/nativeToIR.js +277 -478
- package/dist/IR/toUPLC/subRoutines/rewriteNativesAppliedToConstantsAndReturnRoot.d.ts +2 -0
- package/dist/IR/toUPLC/subRoutines/rewriteNativesAppliedToConstantsAndReturnRoot.js +85 -0
- package/dist/IR/toUPLC/subRoutines/sanifyTree.js +1 -0
- package/dist/IR/toUPLC/utils/getApplicationTerms.d.ts +6 -0
- package/dist/IR/toUPLC/utils/getApplicationTerms.js +37 -0
- package/dist/IR/tree_utils/_ir_lazyChooseList.d.ts +2 -2
- package/dist/IR/tree_utils/_ir_lazyChooseList.js +4 -2
- package/dist/IR/tree_utils/_ir_lazyIfThenElse.d.ts +1 -1
- package/dist/IR/tree_utils/_ir_lazyIfThenElse.js +4 -2
- package/dist/IR/tree_utils/_ir_let.d.ts +2 -1
- package/dist/IR/tree_utils/_ir_let.js +6 -2
- package/dist/IR/utils/isClosedIRTerm.d.ts +1 -0
- package/dist/IR/utils/isClosedIRTerm.js +40 -26
- package/dist/IR/utils/positiveIntAsBytes.d.ts +1 -0
- package/dist/IR/utils/positiveIntAsBytes.js +4 -4
- package/dist/IR/utils/showIR.d.ts +10 -21
- package/dist/IR/utils/showIR.js +66 -64
- package/dist/ast/nodes/common/Identifier.d.ts +1 -0
- package/dist/ast/nodes/common/Identifier.js +3 -0
- package/dist/ast/nodes/expr/CaseExpr.d.ts +5 -5
- package/dist/ast/nodes/expr/ElemAccessExpr.d.ts +2 -2
- package/dist/ast/nodes/expr/ParentesizedExpr.d.ts +1 -1
- package/dist/ast/nodes/expr/PebbleExpr.d.ts +2 -1
- package/dist/ast/nodes/expr/PropAccessExpr.d.ts +3 -3
- package/dist/ast/nodes/expr/TernaryExpr.d.ts +3 -3
- package/dist/ast/nodes/expr/TypeConversionExpr.d.ts +2 -1
- package/dist/ast/nodes/expr/TypeConversionExpr.js +2 -0
- package/dist/ast/nodes/expr/binary/BinaryExpr.d.ts +42 -42
- package/dist/ast/nodes/expr/functions/CallExpr.d.ts +1 -1
- package/dist/ast/nodes/expr/functions/FuncExpr.d.ts +2 -1
- package/dist/ast/nodes/expr/functions/FuncExpr.js +6 -0
- package/dist/ast/nodes/expr/litteral/LitContextExpr.d.ts +6 -0
- package/dist/ast/nodes/expr/litteral/LitContextExpr.js +6 -0
- package/dist/ast/nodes/expr/litteral/LitFailExpr.d.ts +6 -0
- package/dist/ast/nodes/expr/litteral/LitFailExpr.js +6 -0
- package/dist/ast/nodes/expr/litteral/LitteralExpr.d.ts +3 -1
- package/dist/ast/nodes/expr/litteral/LitteralExpr.js +5 -1
- package/dist/ast/nodes/statements/AssertStmt.d.ts +2 -2
- package/dist/ast/nodes/statements/AssignmentStmt.d.ts +1 -1
- package/dist/ast/nodes/statements/BlockStmt.d.ts +1 -1
- package/dist/ast/nodes/statements/FailStmt.d.ts +1 -1
- package/dist/ast/nodes/statements/ForOfStmt.d.ts +4 -2
- package/dist/ast/nodes/statements/ForOfStmt.js +6 -0
- package/dist/ast/nodes/statements/ForStmt.d.ts +6 -4
- package/dist/ast/nodes/statements/ForStmt.js +6 -0
- package/dist/ast/nodes/statements/IfStmt.d.ts +8 -5
- package/dist/ast/nodes/statements/IfStmt.js +13 -0
- package/dist/ast/nodes/statements/MatchStmt.d.ts +13 -4
- package/dist/ast/nodes/statements/MatchStmt.js +22 -1
- package/dist/ast/nodes/statements/PebbleStmt.d.ts +2 -1
- package/dist/ast/nodes/statements/PebbleStmt.js +3 -1
- package/dist/ast/nodes/statements/ReturnStmt.d.ts +1 -1
- package/dist/ast/nodes/statements/WhileStmt.d.ts +4 -2
- package/dist/ast/nodes/statements/WhileStmt.js +6 -0
- package/dist/ast/nodes/statements/declarations/ContractDecl.d.ts +17 -0
- package/dist/ast/nodes/statements/declarations/ContractDecl.js +22 -0
- package/dist/ast/nodes/statements/declarations/VarDecl/ArrayLikeDeconstr.d.ts +1 -1
- package/dist/ast/nodes/statements/declarations/VarDecl/HasInit.d.ts +1 -1
- package/dist/ast/nodes/statements/declarations/VarDecl/NamedDeconstructVarDecl.d.ts +1 -1
- package/dist/ast/nodes/statements/declarations/VarDecl/SimpleVarDecl.d.ts +2 -1
- package/dist/ast/nodes/statements/declarations/VarDecl/SimpleVarDecl.js +6 -0
- package/dist/ast/nodes/statements/declarations/VarDecl/SingleDeconstructVarDecl.d.ts +1 -1
- package/dist/compiler/AstCompiler/AstCompiler.d.ts +7 -2
- package/dist/compiler/AstCompiler/AstCompiler.js +129 -25
- package/dist/compiler/AstCompiler/internal/_deriveContractBody/_deriveContractBody.d.ts +10 -0
- package/dist/compiler/AstCompiler/internal/_deriveContractBody/_deriveContractBody.js +777 -0
- package/dist/compiler/AstCompiler/internal/exprs/_compileBinaryExpr.js +1 -1
- package/dist/compiler/AstCompiler/internal/exprs/_compileExpr.js +5 -1
- package/dist/compiler/AstCompiler/internal/exprs/_compileFuncExpr.js +7 -4
- package/dist/compiler/AstCompiler/internal/exprs/_compileLitteralExpr.js +8 -2
- package/dist/compiler/AstCompiler/internal/exprs/_compilePropAccessExpr.js +1 -1
- package/dist/compiler/AstCompiler/internal/exprs/_compileTypeConversionExpr.js +2 -1
- package/dist/compiler/AstCompiler/internal/exprs/_compileUnaryPrefixExpr.js +1 -1
- package/dist/compiler/AstCompiler/internal/exprs/_compileVarAccessExpr.js +3 -1
- package/dist/compiler/AstCompiler/internal/statements/_compileAssignmentStmt.js +8 -8
- package/dist/compiler/AstCompiler/internal/statements/_compileMatchStmt.d.ts +2 -2
- package/dist/compiler/AstCompiler/internal/statements/_compileMatchStmt.js +48 -24
- package/dist/compiler/AstCompiler/internal/statements/_compileStatement.js +4 -1
- package/dist/compiler/AstCompiler/internal/statements/_compileVarStmt.d.ts +2 -1
- package/dist/compiler/AstCompiler/internal/statements/_compileVarStmt.js +4 -3
- package/dist/compiler/AstCompiler/internal/types/_compileDataEncodedConcreteType.js +1 -1
- package/dist/compiler/AstCompiler/internal/types/_compileSopEncodedConcreteType.js +4 -1
- package/dist/compiler/AstCompiler/scope/AstScope.d.ts +1 -0
- package/dist/compiler/AstCompiler/scope/AstScope.js +9 -3
- package/dist/compiler/AstCompiler/utils/getPropAccessReturnType.js +6 -4
- package/dist/compiler/Compiler.js +7 -1
- package/dist/compiler/TirCompiler/compileTirProgram.js +4 -1
- package/dist/compiler/TirCompiler/expressify/ExpressifyCtx.d.ts +17 -5
- package/dist/compiler/TirCompiler/expressify/ExpressifyCtx.js +79 -49
- package/dist/compiler/TirCompiler/expressify/determineReassignedVariablesAndReturn.js +13 -2
- package/dist/compiler/TirCompiler/expressify/expressify.d.ts +2 -1
- package/dist/compiler/TirCompiler/expressify/expressify.js +102 -41
- package/dist/compiler/TirCompiler/expressify/expressifyForStmt.d.ts +2 -1
- package/dist/compiler/TirCompiler/expressify/expressifyForStmt.js +77 -12
- package/dist/compiler/TirCompiler/expressify/expressifyIfBranch.js +1 -1
- package/dist/compiler/TirCompiler/expressify/expressifyVarAssignmentStmt.d.ts +1 -2
- package/dist/compiler/TirCompiler/expressify/expressifyVarAssignmentStmt.js +16 -9
- package/dist/compiler/TirCompiler/expressify/expressifyVarDecl.js +6 -8
- package/dist/compiler/TirCompiler/expressify/expressifyVars.js +146 -13
- package/dist/compiler/TirCompiler/expressify/flattenSopNamedDeconstructInplace_addTopDestructToCtx_getNestedDeconstruct.js +1 -0
- package/dist/compiler/internalVar.d.ts +1 -1
- package/dist/compiler/internalVar.js +31 -24
- package/dist/compiler/io/CompilerIoApi.d.ts +1 -1
- package/dist/compiler/io/IOutputStream.d.ts +1 -0
- package/dist/compiler/io/IOutputStream.js +18 -3
- package/dist/compiler/path/getAbsolutePath.js +4 -6
- package/dist/compiler/tir/expressions/ITirExpr.d.ts +2 -0
- package/dist/compiler/tir/expressions/TirAssertAndContinueExpr.d.ts +4 -2
- package/dist/compiler/tir/expressions/TirAssertAndContinueExpr.js +16 -2
- package/dist/compiler/tir/expressions/TirCallExpr.d.ts +3 -1
- package/dist/compiler/tir/expressions/TirCallExpr.js +16 -1
- package/dist/compiler/tir/expressions/TirCaseExpr.d.ts +6 -1
- package/dist/compiler/tir/expressions/TirCaseExpr.js +105 -60
- package/dist/compiler/tir/expressions/TirElemAccessExpr.d.ts +3 -1
- package/dist/compiler/tir/expressions/TirElemAccessExpr.js +9 -1
- package/dist/compiler/tir/expressions/TirFailExpr.d.ts +3 -1
- package/dist/compiler/tir/expressions/TirFailExpr.js +9 -1
- package/dist/compiler/tir/expressions/TirFromDataExpr.d.ts +3 -2
- package/dist/compiler/tir/expressions/TirFromDataExpr.js +85 -56
- package/dist/compiler/tir/expressions/TirFuncExpr.d.ts +4 -10
- package/dist/compiler/tir/expressions/TirFuncExpr.js +30 -13
- package/dist/compiler/tir/expressions/TirHoistedExpr.d.ts +3 -1
- package/dist/compiler/tir/expressions/TirHoistedExpr.js +8 -0
- package/dist/compiler/tir/expressions/TirInlineClosedIR.d.ts +4 -1
- package/dist/compiler/tir/expressions/TirInlineClosedIR.js +8 -0
- package/dist/compiler/tir/expressions/TirLettedExpr.d.ts +6 -3
- package/dist/compiler/tir/expressions/TirLettedExpr.js +20 -7
- package/dist/compiler/tir/expressions/TirNativeFunc.d.ts +9 -5
- package/dist/compiler/tir/expressions/TirNativeFunc.js +58 -22
- package/dist/compiler/tir/expressions/TirParentesizedExpr.d.ts +3 -1
- package/dist/compiler/tir/expressions/TirParentesizedExpr.js +6 -0
- package/dist/compiler/tir/expressions/TirPropAccessExpr.d.ts +3 -1
- package/dist/compiler/tir/expressions/TirPropAccessExpr.js +9 -1
- package/dist/compiler/tir/expressions/TirTernaryExpr.d.ts +3 -1
- package/dist/compiler/tir/expressions/TirTernaryExpr.js +16 -5
- package/dist/compiler/tir/expressions/TirToDataExpr.d.ts +3 -1
- package/dist/compiler/tir/expressions/TirToDataExpr.js +56 -25
- package/dist/compiler/tir/expressions/TirTraceIfFalseExpr.d.ts +3 -1
- package/dist/compiler/tir/expressions/TirTraceIfFalseExpr.js +21 -4
- package/dist/compiler/tir/expressions/TirTypeConversionExpr.d.ts +3 -1
- package/dist/compiler/tir/expressions/TirTypeConversionExpr.js +9 -1
- package/dist/compiler/tir/expressions/TirVariableAccessExpr.d.ts +6 -3
- package/dist/compiler/tir/expressions/TirVariableAccessExpr.js +22 -8
- package/dist/compiler/tir/expressions/ToIRTermCtx.d.ts +19 -20
- package/dist/compiler/tir/expressions/ToIRTermCtx.js +74 -50
- package/dist/compiler/tir/expressions/binary/TirBinaryExpr.d.ts +41 -0
- package/dist/compiler/tir/expressions/binary/TirBinaryExpr.js +180 -4
- package/dist/compiler/tir/expressions/litteral/TirLitArrExpr.d.ts +4 -2
- package/dist/compiler/tir/expressions/litteral/TirLitArrExpr.js +8 -2
- package/dist/compiler/tir/expressions/litteral/TirLitFailExpr.d.ts +17 -0
- package/dist/compiler/tir/expressions/litteral/TirLitFailExpr.js +21 -0
- package/dist/compiler/tir/expressions/litteral/TirLitFalseExpr.d.ts +4 -1
- package/dist/compiler/tir/expressions/litteral/TirLitFalseExpr.js +4 -0
- package/dist/compiler/tir/expressions/litteral/TirLitHexBytesExpr.d.ts +4 -1
- package/dist/compiler/tir/expressions/litteral/TirLitHexBytesExpr.js +5 -0
- package/dist/compiler/tir/expressions/litteral/TirLitIntExpr.d.ts +4 -1
- package/dist/compiler/tir/expressions/litteral/TirLitIntExpr.js +4 -0
- package/dist/compiler/tir/expressions/litteral/TirLitNamedObjExpr.d.ts +3 -1
- package/dist/compiler/tir/expressions/litteral/TirLitNamedObjExpr.js +5 -0
- package/dist/compiler/tir/expressions/litteral/TirLitObjExpr.d.ts +3 -1
- package/dist/compiler/tir/expressions/litteral/TirLitObjExpr.js +5 -0
- package/dist/compiler/tir/expressions/litteral/TirLitStrExpr.d.ts +4 -1
- package/dist/compiler/tir/expressions/litteral/TirLitStrExpr.js +4 -0
- package/dist/compiler/tir/expressions/litteral/TirLitThisExpr.d.ts +4 -1
- package/dist/compiler/tir/expressions/litteral/TirLitThisExpr.js +7 -3
- package/dist/compiler/tir/expressions/litteral/TirLitTrueExpr.d.ts +4 -1
- package/dist/compiler/tir/expressions/litteral/TirLitTrueExpr.js +4 -0
- package/dist/compiler/tir/expressions/litteral/TirLitUndefExpr.d.ts +4 -1
- package/dist/compiler/tir/expressions/litteral/TirLitUndefExpr.js +4 -0
- package/dist/compiler/tir/expressions/litteral/TirLitVoidExpr.d.ts +4 -1
- package/dist/compiler/tir/expressions/litteral/TirLitVoidExpr.js +4 -0
- package/dist/compiler/tir/expressions/litteral/TirLitteralExpr.d.ts +2 -1
- package/dist/compiler/tir/expressions/litteral/TirLitteralExpr.js +3 -1
- package/dist/compiler/tir/expressions/unary/TirUnaryExclamation.d.ts +4 -2
- package/dist/compiler/tir/expressions/unary/TirUnaryExclamation.js +8 -3
- package/dist/compiler/tir/expressions/unary/TirUnaryMinus.d.ts +4 -2
- package/dist/compiler/tir/expressions/unary/TirUnaryMinus.js +8 -2
- package/dist/compiler/tir/expressions/unary/TirUnaryPlus.d.ts +3 -1
- package/dist/compiler/tir/expressions/unary/TirUnaryPlus.js +6 -0
- package/dist/compiler/tir/expressions/unary/TirUnaryTilde.d.ts +4 -2
- package/dist/compiler/tir/expressions/unary/TirUnaryTilde.js +8 -2
- package/dist/compiler/tir/program/TypedProgram.d.ts +3 -2
- package/dist/compiler/tir/program/TypedProgram.js +9 -0
- package/dist/compiler/tir/program/stdScope/stdScope.js +135 -149
- package/dist/compiler/tir/statements/TirAssertStmt.d.ts +2 -0
- package/dist/compiler/tir/statements/TirAssertStmt.js +10 -0
- package/dist/compiler/tir/statements/TirAssignmentStmt.d.ts +2 -0
- package/dist/compiler/tir/statements/TirAssignmentStmt.js +8 -0
- package/dist/compiler/tir/statements/TirBlockStmt.d.ts +2 -0
- package/dist/compiler/tir/statements/TirBlockStmt.js +16 -0
- package/dist/compiler/tir/statements/TirBreakStmt.d.ts +2 -0
- package/dist/compiler/tir/statements/TirBreakStmt.js +8 -0
- package/dist/compiler/tir/statements/TirContinueStmt.d.ts +2 -0
- package/dist/compiler/tir/statements/TirContinueStmt.js +8 -0
- package/dist/compiler/tir/statements/TirFailStmt.d.ts +2 -0
- package/dist/compiler/tir/statements/TirFailStmt.js +8 -0
- package/dist/compiler/tir/statements/TirForOfStmt.d.ts +2 -0
- package/dist/compiler/tir/statements/TirForOfStmt.js +14 -0
- package/dist/compiler/tir/statements/TirForStmt.d.ts +2 -0
- package/dist/compiler/tir/statements/TirForStmt.js +21 -0
- package/dist/compiler/tir/statements/TirIfStmt.d.ts +2 -0
- package/dist/compiler/tir/statements/TirIfStmt.js +16 -0
- package/dist/compiler/tir/statements/TirMatchStmt.d.ts +2 -0
- package/dist/compiler/tir/statements/TirMatchStmt.js +30 -0
- package/dist/compiler/tir/statements/TirReturnStmt.d.ts +2 -0
- package/dist/compiler/tir/statements/TirReturnStmt.js +8 -0
- package/dist/compiler/tir/statements/TirStmt.d.ts +2 -0
- package/dist/compiler/tir/statements/TirVarDecl/TirArrayLikeDeconstr.d.ts +2 -0
- package/dist/compiler/tir/statements/TirVarDecl/TirArrayLikeDeconstr.js +30 -0
- package/dist/compiler/tir/statements/TirVarDecl/TirNamedDeconstructVarDecl.d.ts +3 -1
- package/dist/compiler/tir/statements/TirVarDecl/TirNamedDeconstructVarDecl.js +28 -0
- package/dist/compiler/tir/statements/TirVarDecl/TirSimpleVarDecl.d.ts +3 -0
- package/dist/compiler/tir/statements/TirVarDecl/TirSimpleVarDecl.js +13 -0
- package/dist/compiler/tir/statements/TirVarDecl/TirSingleDeconstructVarDecl.d.ts +3 -1
- package/dist/compiler/tir/statements/TirVarDecl/TirSingleDeconstructVarDecl.js +28 -0
- package/dist/compiler/tir/statements/TirWhileStmt.d.ts +2 -0
- package/dist/compiler/tir/statements/TirWhileStmt.js +14 -0
- package/dist/compiler/tir/types/utils/canAssignTo.js +1 -1
- package/dist/diagnostics/DiagnosticEmitter.js +1 -1
- package/dist/diagnostics/diagnosticMessages.generated.d.ts +10 -1
- package/dist/diagnostics/diagnosticMessages.generated.js +20 -2
- package/dist/parser/Parser.d.ts +8 -3
- package/dist/parser/Parser.js +180 -32
- package/dist/parser/Precedence.js +1 -0
- package/dist/tokenizer/Token.d.ts +81 -72
- package/dist/tokenizer/Token.js +82 -72
- package/dist/tokenizer/utils/tokenFromKeyword.js +32 -10
- package/dist/tokenizer/utils/tokenIsAlsoIdentifier.js +10 -0
- package/dist/utils/BitUtils/index.js +1 -1
- package/dist/utils/UPLCFlatUtils/index.js +1 -1
- package/dist/utils/array/keepSortedArrInplace.js +1 -0
- package/package.json +3 -1
- package/dist/IR/IRNodes/utils/isClosedAtDbn.d.ts +0 -2
- package/dist/IR/IRNodes/utils/isClosedAtDbn.js +0 -22
- package/dist/IR/toUPLC/_internal/_irToUplc.d.ts +0 -9
- package/dist/IR/toUPLC/_internal/_irToUplc.js +0 -156
- package/dist/IR/toUPLC/subRoutines/handleLetted/incrementUnboundDbns.d.ts +0 -9
- package/dist/IR/toUPLC/subRoutines/handleLetted/incrementUnboundDbns.js +0 -73
- package/dist/IR/toUPLC/subRoutines/inlineSingleUseApplications.d.ts +0 -1
- package/dist/IR/toUPLC/subRoutines/inlineSingleUseApplications.js +0 -12
- package/dist/IR/toUPLC/subRoutines/performUplcOptimizationsAndReturnRoot/index.js +0 -227
- package/dist/IR/tree_utils/_ir_apps.d.ts +0 -3
- package/dist/IR/tree_utils/_ir_apps.js +0 -8
- package/dist/compiler/TirCompiler/internal/_compileHoistedDeps.d.ts +0 -5
- package/dist/compiler/TirCompiler/internal/_compileHoistedDeps.js +0 -37
|
@@ -60,7 +60,7 @@ export function _compileBinaryExpr(ctx, expr, typeHint) {
|
|
|
60
60
|
return _compileLogicalOrExpr(ctx, expr, typeHint);
|
|
61
61
|
if (expr instanceof OptionalDefaultExpr)
|
|
62
62
|
return _compileOptionalDefaultExpr(ctx, expr, typeHint);
|
|
63
|
-
const
|
|
63
|
+
const tsEnsureExhautstiveCheck = expr;
|
|
64
64
|
console.error(expr);
|
|
65
65
|
throw new Error("unreachable::AstCompiler::_compileBinaryExpr");
|
|
66
66
|
}
|
|
@@ -11,6 +11,7 @@ import { TernaryExpr } from "../../../../ast/nodes/expr/TernaryExpr.js";
|
|
|
11
11
|
import { TypeConversionExpr } from "../../../../ast/nodes/expr/TypeConversionExpr.js";
|
|
12
12
|
import { NonNullExpr } from "../../../../ast/nodes/expr/unary/NonNullExpr.js";
|
|
13
13
|
import { isUnaryPrefixExpr } from "../../../../ast/nodes/expr/unary/UnaryPrefixExpr.js";
|
|
14
|
+
import { isTirExpr } from "../../../tir/expressions/TirExpr.js";
|
|
14
15
|
import { _compileBinaryExpr } from "./_compileBinaryExpr.js";
|
|
15
16
|
import { _compileCallExpr } from "./_compileCallExpr.js";
|
|
16
17
|
import { _compileCaseExpr } from "./_compileCaseExpr.js";
|
|
@@ -41,6 +42,9 @@ export function _compileExpr(ctx, expr,
|
|
|
41
42
|
* if that is the case, it needs to be checked OUTSIDE this function
|
|
42
43
|
**/
|
|
43
44
|
typeHint) {
|
|
45
|
+
// already compiled (TODO: how did we get here?)
|
|
46
|
+
if (isTirExpr(expr))
|
|
47
|
+
return expr;
|
|
44
48
|
if (expr instanceof Identifier)
|
|
45
49
|
return _compileVarAccessExpr(ctx, expr, typeHint);
|
|
46
50
|
if (isUnaryPrefixExpr(expr))
|
|
@@ -71,7 +75,7 @@ typeHint) {
|
|
|
71
75
|
//*/
|
|
72
76
|
if (isLitteralExpr(expr))
|
|
73
77
|
return _compileLitteralExpr(ctx, expr, typeHint);
|
|
74
|
-
const
|
|
78
|
+
const tsEnsureExhautstiveCheck = expr;
|
|
75
79
|
console.error(expr);
|
|
76
80
|
throw new Error("unreachable::AstCompiler::_compileExpr");
|
|
77
81
|
}
|
|
@@ -77,7 +77,7 @@ export function _compileFuncExpr(ctx, expr, expectedFuncType, isMethod = false)
|
|
|
77
77
|
// if( _hasDuplicateTypeParams( ctx, expr.typeParams ) ) return undefined;
|
|
78
78
|
if (expr.typeParams.length > 0)
|
|
79
79
|
return ctx.error(DiagnosticCode.Not_implemented_0, expr.typeParams[0].range, "generic functions");
|
|
80
|
-
const destructuredParamsResult = _getDestructuredParamsAsVarDecls(funcCtx, expr);
|
|
80
|
+
const destructuredParamsResult = _getDestructuredParamsAsVarDecls(funcCtx, expr, expectedFuncType);
|
|
81
81
|
if (!destructuredParamsResult)
|
|
82
82
|
return undefined;
|
|
83
83
|
const { blockInitStmts, params } = destructuredParamsResult;
|
|
@@ -91,11 +91,14 @@ export function _compileFuncExpr(ctx, expr, expectedFuncType, isMethod = false)
|
|
|
91
91
|
const funcExpr = new TirFuncExpr(expr.name.text, params, returnType, body, expr.range);
|
|
92
92
|
return funcExpr;
|
|
93
93
|
}
|
|
94
|
-
function _getDestructuredParamsAsVarDecls(funcCtx, expr) {
|
|
94
|
+
function _getDestructuredParamsAsVarDecls(funcCtx, expr, expectedFuncType) {
|
|
95
95
|
const blockInitStmts = [];
|
|
96
96
|
const params = [];
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
const nParams = expr.signature.params.length;
|
|
98
|
+
for (let i = 0; i < nParams; i++) {
|
|
99
|
+
const astParam = expr.signature.params[i];
|
|
100
|
+
const paramTypeHint = expectedFuncType.argTypes[i];
|
|
101
|
+
const tirParam = _compileVarDecl(funcCtx, astParam, paramTypeHint);
|
|
99
102
|
if (!tirParam)
|
|
100
103
|
return undefined;
|
|
101
104
|
if (tirParam instanceof TirSimpleVarDecl) {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { LitArrExpr } from "../../../../ast/nodes/expr/litteral/LitArrExpr.js";
|
|
2
|
+
import { LitContextExpr } from "../../../../ast/nodes/expr/litteral/LitContextExpr.js";
|
|
3
|
+
import { LitFailExpr } from "../../../../ast/nodes/expr/litteral/LitFailExpr.js";
|
|
2
4
|
import { LitFalseExpr } from "../../../../ast/nodes/expr/litteral/LitFalseExpr.js";
|
|
3
5
|
import { LitHexBytesExpr } from "../../../../ast/nodes/expr/litteral/LitHexBytesExpr.js";
|
|
4
6
|
import { LitIntExpr } from "../../../../ast/nodes/expr/litteral/LitIntExpr.js";
|
|
@@ -11,6 +13,7 @@ import { LitUndefExpr } from "../../../../ast/nodes/expr/litteral/LitUndefExpr.j
|
|
|
11
13
|
import { LitVoidExpr } from "../../../../ast/nodes/expr/litteral/LitVoidExpr.js";
|
|
12
14
|
import { DiagnosticCode } from "../../../../diagnostics/diagnosticMessages.generated.js";
|
|
13
15
|
import { TirLitArrExpr } from "../../../tir/expressions/litteral/TirLitArrExpr.js";
|
|
16
|
+
import { TirLitFailExpr } from "../../../tir/expressions/litteral/TirLitFailExpr.js";
|
|
14
17
|
import { TirLitFalseExpr } from "../../../tir/expressions/litteral/TirLitFalseExpr.js";
|
|
15
18
|
import { TirLitHexBytesExpr } from "../../../tir/expressions/litteral/TirLitHexBytesExpr.js";
|
|
16
19
|
import { TirLitIntExpr } from "../../../tir/expressions/litteral/TirLitIntExpr.js";
|
|
@@ -61,8 +64,11 @@ export function _compileLitteralExpr(ctx, expr, typeHint) {
|
|
|
61
64
|
return _compileLitteralObjExpr(ctx, expr, typeHint);
|
|
62
65
|
if (expr instanceof LitNamedObjExpr)
|
|
63
66
|
return _compileLitteralNamedObjExpr(ctx, expr, typeHint);
|
|
64
|
-
|
|
65
|
-
|
|
67
|
+
if (expr instanceof LitFailExpr)
|
|
68
|
+
return new TirLitFailExpr(expr.range);
|
|
69
|
+
if (expr instanceof LitContextExpr)
|
|
70
|
+
throw new Error("Litteral `context` should have been handled while desugaring.");
|
|
71
|
+
const tsEnsureExhautstiveCheck = expr;
|
|
66
72
|
throw new Error("unreachable::AstCompiler::_compileLitteralExpr");
|
|
67
73
|
}
|
|
68
74
|
export function _compileLitteralUndefExpr(ctx, expr, typeHint) {
|
|
@@ -20,7 +20,7 @@ export function _compilePropAccessExpr(ctx, expr, typeHint) {
|
|
|
20
20
|
return _compileNonNullPropAccessExpr(ctx, expr, typeHint);
|
|
21
21
|
if (expr instanceof DotPropAccessExpr)
|
|
22
22
|
return _compileDotPropAccessExpr(ctx, expr, typeHint);
|
|
23
|
-
const
|
|
23
|
+
const tsEnsureExhautstiveCheck = expr;
|
|
24
24
|
console.error(expr);
|
|
25
25
|
throw new Error("unreachable::AstCompiler::_compilePropAccessExpr");
|
|
26
26
|
}
|
|
@@ -6,8 +6,9 @@ import { _compileExpr } from "./_compileExpr.js";
|
|
|
6
6
|
export function _compileTypeConversionExpr(ctx, ast, typeHint) {
|
|
7
7
|
const data_t = ctx.program.stdTypes.data;
|
|
8
8
|
const possibleTargetTypeTirNames = ctx.scope.resolveType(ast.asType.toAstName());
|
|
9
|
-
if (!possibleTargetTypeTirNames)
|
|
9
|
+
if (!possibleTargetTypeTirNames) {
|
|
10
10
|
return ctx.error(DiagnosticCode._0_is_not_defined, ast.asType.range, ast.asType.toAstName());
|
|
11
|
+
}
|
|
11
12
|
const sopTargetType = ctx.program.types.get(possibleTargetTypeTirNames.sopTirName);
|
|
12
13
|
if (!sopTargetType)
|
|
13
14
|
return ctx.error(DiagnosticCode._0_is_not_defined, ast.asType.range, ast.asType.toAstName());
|
|
@@ -48,7 +48,7 @@ export function _compileUnaryPrefixExpr(ctx, expr, _typeHint) {
|
|
|
48
48
|
}
|
|
49
49
|
return new TirUnaryTilde(operand, int_t, expr.range);
|
|
50
50
|
}
|
|
51
|
-
const
|
|
51
|
+
const tsEnsureExhautstiveCheck = expr;
|
|
52
52
|
console.error(expr);
|
|
53
53
|
throw new Error("unreachable::AstCompiler::_compileUnaryPrefixExpr");
|
|
54
54
|
}
|
|
@@ -2,8 +2,10 @@ import { DiagnosticCode } from "../../../../diagnostics/diagnosticMessages.gener
|
|
|
2
2
|
import { TirVariableAccessExpr } from "../../../tir/expressions/TirVariableAccessExpr.js";
|
|
3
3
|
export function _compileVarAccessExpr(ctx, expr, typeHint) {
|
|
4
4
|
const resolvedValue = ctx.scope.resolveValue(expr.text);
|
|
5
|
-
if (!resolvedValue)
|
|
5
|
+
if (!resolvedValue) {
|
|
6
|
+
console.trace(ctx.scope.allVariables(), expr.text);
|
|
6
7
|
return ctx.error(DiagnosticCode._0_is_not_defined, expr.range, expr.text);
|
|
8
|
+
}
|
|
7
9
|
// const { variableInfos, isDefinedOutsideFuncScope } = resolvedValue;
|
|
8
10
|
return new TirVariableAccessExpr(resolvedValue, expr.range);
|
|
9
11
|
}
|
|
@@ -20,9 +20,9 @@ export function _compileAssignmentStmt(ctx, stmt) {
|
|
|
20
20
|
if (!canAssignTo(varType, int_t))
|
|
21
21
|
return ctx.error(DiagnosticCode.Type_0_is_not_assignable_to_type_1, stmt.varIdentifier.range, varType.toString(), int_t.toString());
|
|
22
22
|
const varAccessExpr = new TirVariableAccessExpr(resolvedValue, stmt.varIdentifier.range);
|
|
23
|
-
return ([new TirAssignmentStmt(varAccessExpr, stmt instanceof IncrStmt ?
|
|
24
|
-
new TirAddExpr(varAccessExpr, new TirLitIntExpr(BigInt(1), stmt.range), stmt.range) :
|
|
25
|
-
new TirSubExpr(varAccessExpr, new TirLitIntExpr(BigInt(1), stmt.range), stmt.range), stmt.range)]);
|
|
23
|
+
return ([new TirAssignmentStmt(varAccessExpr.clone(), stmt instanceof IncrStmt ?
|
|
24
|
+
new TirAddExpr(varAccessExpr.clone(), new TirLitIntExpr(BigInt(1), stmt.range), stmt.range) :
|
|
25
|
+
new TirSubExpr(varAccessExpr.clone(), new TirLitIntExpr(BigInt(1), stmt.range), stmt.range), stmt.range)]);
|
|
26
26
|
}
|
|
27
27
|
if (isExplicitAssignmentStmt(stmt)) {
|
|
28
28
|
const tirStmt = _compileExplicitAssignmentStmt(ctx, stmt);
|
|
@@ -31,7 +31,7 @@ export function _compileAssignmentStmt(ctx, stmt) {
|
|
|
31
31
|
return [tirStmt];
|
|
32
32
|
}
|
|
33
33
|
else {
|
|
34
|
-
const
|
|
34
|
+
// const tsEnsureExhautstiveCheck: never = stmt;
|
|
35
35
|
console.error(stmt);
|
|
36
36
|
throw new Error("unreachable::AstCompiler::_compileForUpdateStmts");
|
|
37
37
|
}
|
|
@@ -61,13 +61,13 @@ export function _compileExplicitAssignmentStmt(ctx, stmt) {
|
|
|
61
61
|
expr = __getBinOpAssignmentLeftArg(ctx, stmt, varType, int_t);
|
|
62
62
|
if (!expr)
|
|
63
63
|
return undefined;
|
|
64
|
-
expr = new TirAddExpr(varAccessExpr, expr, stmt.range);
|
|
64
|
+
expr = new TirAddExpr(varAccessExpr.clone(), expr.clone(), stmt.range);
|
|
65
65
|
}
|
|
66
66
|
else if (stmt instanceof SubAssignmentStmt) {
|
|
67
67
|
expr = __getBinOpAssignmentLeftArg(ctx, stmt, varType, int_t);
|
|
68
68
|
if (!expr)
|
|
69
69
|
return undefined;
|
|
70
|
-
expr = new TirSubExpr(varAccessExpr, expr, stmt.range);
|
|
70
|
+
expr = new TirSubExpr(varAccessExpr.clone(), expr.clone(), stmt.range);
|
|
71
71
|
}
|
|
72
72
|
else if (stmt instanceof ExpAssignmentStmt) {
|
|
73
73
|
expr = __getBinOpAssignmentLeftArg(ctx, stmt, varType, int_t);
|
|
@@ -136,11 +136,11 @@ export function _compileExplicitAssignmentStmt(ctx, stmt) {
|
|
|
136
136
|
expr = new TirLogicalOrExpr(varAccessExpr, expr, stmt.range);
|
|
137
137
|
}
|
|
138
138
|
else {
|
|
139
|
-
const
|
|
139
|
+
const tsEnsureExhautstiveCheck = stmt;
|
|
140
140
|
console.error(stmt);
|
|
141
141
|
throw new Error("unreachable::AstCompiler::_compileExplicitAssignmentStmt");
|
|
142
142
|
}
|
|
143
|
-
return new TirAssignmentStmt(varAccessExpr, expr, stmt.range);
|
|
143
|
+
return new TirAssignmentStmt(varAccessExpr.clone(), expr, stmt.range);
|
|
144
144
|
}
|
|
145
145
|
export function __getBinOpAssignmentLeftArg(ctx, stmt, varType, exprType) {
|
|
146
146
|
if (!canAssignTo(varType, exprType))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MatchStmt, MatchStmtCase } from "../../../../ast/nodes/statements/MatchStmt.js";
|
|
2
|
-
import { TirMatchStmt, TirMatchStmtCase
|
|
2
|
+
import { TirMatchStmt, TirMatchStmtCase } from "../../../tir/statements/TirMatchStmt.js";
|
|
3
3
|
import { DeconstructableTirType } from "../../../tir/types/utils/getDeconstructableType.js";
|
|
4
4
|
import { AstCompilationCtx } from "../../AstCompilationCtx.js";
|
|
5
5
|
export declare function _compileMatchStmt(ctx: AstCompilationCtx, stmt: MatchStmt): [TirMatchStmt] | undefined;
|
|
6
|
-
export declare function _compileTirMatchStmtCase(ctx: AstCompilationCtx, matchCase: MatchStmtCase, deconstructableType: DeconstructableTirType, constrNamesAlreadySpecified: string[]): TirMatchStmtCase |
|
|
6
|
+
export declare function _compileTirMatchStmtCase(ctx: AstCompilationCtx, matchCase: MatchStmtCase, deconstructableType: DeconstructableTirType, constrNamesAlreadySpecified: string[]): TirMatchStmtCase | undefined;
|
|
@@ -13,7 +13,7 @@ import { getDeconstructableType } from "../../../tir/types/utils/getDeconstructa
|
|
|
13
13
|
import { wrapManyStatements } from "../../utils/wrapManyStatementsOrReturnSame.js";
|
|
14
14
|
import { _compileExpr } from "../exprs/_compileExpr.js";
|
|
15
15
|
import { _compileStatement } from "./_compileStatement.js";
|
|
16
|
-
import { _compileNamedDeconstructVarDecl, _compileSingleDeconstructVarDecl
|
|
16
|
+
import { _compileNamedDeconstructVarDecl, _compileSingleDeconstructVarDecl } from "./_compileVarStmt.js";
|
|
17
17
|
export function _compileMatchStmt(ctx, stmt) {
|
|
18
18
|
if (!ctx.functionCtx)
|
|
19
19
|
return ctx.error(DiagnosticCode.A_match_statement_can_only_be_used_within_a_function_body, stmt.range);
|
|
@@ -34,16 +34,18 @@ export function _compileMatchStmt(ctx, stmt) {
|
|
|
34
34
|
if (stmt.cases.length === 0)
|
|
35
35
|
return ctx.error(DiagnosticCode.A_match_statement_must_have_at_least_one_case, stmt.range);
|
|
36
36
|
const cases = [];
|
|
37
|
-
let wildcardCase = undefined;
|
|
38
37
|
const constrNamesAlreadySpecified = [];
|
|
39
38
|
for (const matchCase of stmt.cases) {
|
|
40
39
|
const branch = _compileTirMatchStmtCase(ctx, matchCase, deconstructableType, constrNamesAlreadySpecified);
|
|
41
40
|
if (!branch)
|
|
42
41
|
return undefined;
|
|
43
|
-
|
|
42
|
+
/*
|
|
43
|
+
if( branch instanceof TirMatchStmtWildcardCase )
|
|
44
|
+
{
|
|
44
45
|
wildcardCase = branch;
|
|
45
46
|
break; // wildcard case catches any branch specified after it
|
|
46
47
|
}
|
|
48
|
+
//*/
|
|
47
49
|
const indexOfCtor = missingCtors.indexOf(branch.pattern.constrName);
|
|
48
50
|
if (indexOfCtor === -1) {
|
|
49
51
|
return ctx.error(DiagnosticCode.Unknown_0_constructor_1, branch.pattern.range, deconstructableType.toString(), branch.pattern.constrName);
|
|
@@ -51,23 +53,44 @@ export function _compileMatchStmt(ctx, stmt) {
|
|
|
51
53
|
missingCtors.splice(indexOfCtor, 1);
|
|
52
54
|
cases.push(branch);
|
|
53
55
|
}
|
|
56
|
+
let wildcardCase = undefined;
|
|
57
|
+
if (stmt.elseCase) {
|
|
58
|
+
const matchCase = stmt.elseCase;
|
|
59
|
+
const branchCtx = ctx.newBranchChildScope();
|
|
60
|
+
const branchBody = wrapManyStatements(_compileStatement(branchCtx, matchCase.body), matchCase.body.range);
|
|
61
|
+
if (!branchBody)
|
|
62
|
+
return undefined;
|
|
63
|
+
wildcardCase = new TirMatchStmtWildcardCase(branchBody, matchCase.range);
|
|
64
|
+
}
|
|
54
65
|
if (!wildcardCase && cases.length < ctors.length) {
|
|
55
66
|
return ctx.error(DiagnosticCode.Match_cases_are_not_exhaustive, stmt.range);
|
|
56
67
|
}
|
|
57
68
|
return [new TirMatchStmt(matchExpr, cases, wildcardCase, stmt.range)];
|
|
58
69
|
}
|
|
59
70
|
export function _compileTirMatchStmtCase(ctx, matchCase, deconstructableType, constrNamesAlreadySpecified) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
71
|
+
/*
|
|
72
|
+
const pattern = _compileVarDecl( ctx, matchCase.pattern, deconstructableType );
|
|
73
|
+
if( !pattern ) return undefined;
|
|
74
|
+
//*/
|
|
75
|
+
const pattern = matchCase.pattern;
|
|
63
76
|
if (pattern instanceof SimpleVarDecl) {
|
|
64
|
-
|
|
77
|
+
/*
|
|
78
|
+
if( pattern.name.text === "_" ) {
|
|
65
79
|
const branchCtx = ctx.newBranchChildScope();
|
|
66
|
-
const branchBody = wrapManyStatements(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
80
|
+
const branchBody = wrapManyStatements(
|
|
81
|
+
_compileStatement(
|
|
82
|
+
branchCtx,
|
|
83
|
+
matchCase.body
|
|
84
|
+
),
|
|
85
|
+
matchCase.body.range
|
|
86
|
+
);
|
|
87
|
+
if( !branchBody ) return undefined;
|
|
88
|
+
return new TirMatchStmtWildcardCase(
|
|
89
|
+
branchBody,
|
|
90
|
+
matchCase.range
|
|
91
|
+
);
|
|
70
92
|
}
|
|
93
|
+
//*/
|
|
71
94
|
return ctx.error(DiagnosticCode.The_argument_of_a_match_statement_branch_must_be_deconstructed, matchCase.pattern.range);
|
|
72
95
|
}
|
|
73
96
|
else if (pattern instanceof NamedDeconstructVarDecl) {
|
|
@@ -76,14 +99,11 @@ export function _compileTirMatchStmtCase(ctx, matchCase, deconstructableType, co
|
|
|
76
99
|
if (constrNamesAlreadySpecified.includes(deconstructedCtorName))
|
|
77
100
|
return ctx.error(DiagnosticCode.Constructor_0_was_already_specified, deconstructedCtorIdentifier.range, deconstructedCtorName);
|
|
78
101
|
constrNamesAlreadySpecified.push(deconstructedCtorName);
|
|
79
|
-
if (deconstructableType instanceof
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|| deconstructedCtorName === "I" // { int, ...rest }
|
|
85
|
-
))
|
|
86
|
-
return ctx.error(DiagnosticCode.Unknown_0_constructor_1, pattern.name.range, "data", deconstructedCtorName);
|
|
102
|
+
if (deconstructableType instanceof TirSoPStructType
|
|
103
|
+
|| deconstructableType instanceof TirDataStructType) {
|
|
104
|
+
const ctorDef = deconstructableType.constructors.find(c => c.name === deconstructedCtorName);
|
|
105
|
+
if (!ctorDef)
|
|
106
|
+
return ctx.error(DiagnosticCode.Unknown_0_constructor_1, pattern.name.range, deconstructableType.toString(), deconstructedCtorName);
|
|
87
107
|
const branchCtx = ctx.newBranchChildScope();
|
|
88
108
|
const branchArg = _compileNamedDeconstructVarDecl(branchCtx, pattern, deconstructableType);
|
|
89
109
|
if (!branchArg)
|
|
@@ -108,11 +128,14 @@ export function _compileTirMatchStmtCase(ctx, matchCase, deconstructableType, co
|
|
|
108
128
|
return undefined;
|
|
109
129
|
return new TirMatchStmtCase(branchArg, branchBody, matchCase.range);
|
|
110
130
|
}
|
|
111
|
-
else if (deconstructableType instanceof
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
131
|
+
else if (deconstructableType instanceof TirDataT) {
|
|
132
|
+
if (!(deconstructedCtorName === "Constr" // { index, fields, ...rest }
|
|
133
|
+
|| deconstructedCtorName === "Map" // { map, ...rest }
|
|
134
|
+
|| deconstructedCtorName === "List" // { list, ...rest }
|
|
135
|
+
|| deconstructedCtorName === "B" // { bytes, ...rest }
|
|
136
|
+
|| deconstructedCtorName === "I" // { int, ...rest }
|
|
137
|
+
))
|
|
138
|
+
return ctx.error(DiagnosticCode.Unknown_0_constructor_1, pattern.name.range, "data", deconstructedCtorName);
|
|
116
139
|
const branchCtx = ctx.newBranchChildScope();
|
|
117
140
|
const branchArg = _compileNamedDeconstructVarDecl(branchCtx, pattern, deconstructableType);
|
|
118
141
|
if (!branchArg)
|
|
@@ -179,4 +202,5 @@ export function _compileTirMatchStmtCase(ctx, matchCase, deconstructableType, co
|
|
|
179
202
|
);
|
|
180
203
|
//*/
|
|
181
204
|
}
|
|
205
|
+
throw new Error("unreachable::AstCompiler::_compileTirMatchStmtCase");
|
|
182
206
|
}
|
|
@@ -3,6 +3,7 @@ import { isAssignmentStmt } from "../../../../ast/nodes/statements/AssignmentStm
|
|
|
3
3
|
import { BlockStmt } from "../../../../ast/nodes/statements/BlockStmt.js";
|
|
4
4
|
import { BreakStmt } from "../../../../ast/nodes/statements/BreakStmt.js";
|
|
5
5
|
import { ContinueStmt } from "../../../../ast/nodes/statements/ContinueStmt.js";
|
|
6
|
+
import { isVarDecl } from "../../../../ast/nodes/statements/declarations/VarDecl/VarDecl.js";
|
|
6
7
|
import { EmptyStmt } from "../../../../ast/nodes/statements/EmptyStmt.js";
|
|
7
8
|
import { FailStmt } from "../../../../ast/nodes/statements/FailStmt.js";
|
|
8
9
|
import { ForOfStmt } from "../../../../ast/nodes/statements/ForOfStmt.js";
|
|
@@ -37,6 +38,8 @@ import { _compileWhileStmt } from "./_compileWhileStmt.js";
|
|
|
37
38
|
export function _compileStatement(ctx, stmt) {
|
|
38
39
|
if (stmt instanceof IfStmt)
|
|
39
40
|
return _compileIfStmt(ctx, stmt);
|
|
41
|
+
if (isVarDecl(stmt))
|
|
42
|
+
stmt = new VarStmt([stmt], stmt.range); // sometime these slip through
|
|
40
43
|
if (stmt instanceof VarStmt)
|
|
41
44
|
return _compileVarStmt(ctx, stmt);
|
|
42
45
|
if (stmt instanceof ForStmt)
|
|
@@ -67,7 +70,7 @@ export function _compileStatement(ctx, stmt) {
|
|
|
67
70
|
// if( stmt instanceof ExprStmt ) return _compileExprStmt( ctx, stmt );
|
|
68
71
|
if (stmt instanceof UsingStmt)
|
|
69
72
|
return _compileUsingStmt(ctx, stmt);
|
|
70
|
-
const
|
|
73
|
+
const tsEnsureExhautstiveCheck = stmt;
|
|
71
74
|
console.error(stmt);
|
|
72
75
|
throw new Error("unreachable::AstCompiler::_compileStatement");
|
|
73
76
|
}
|
|
@@ -10,13 +10,14 @@ import { SourceRange } from "../../../../ast/Source/SourceRange.js";
|
|
|
10
10
|
import { TirExpr } from "../../../tir/expressions/TirExpr.js";
|
|
11
11
|
import { TirArrayLikeDeconstr } from "../../../tir/statements/TirVarDecl/TirArrayLikeDeconstr.js";
|
|
12
12
|
import { TirNamedDeconstructVarDecl } from "../../../tir/statements/TirVarDecl/TirNamedDeconstructVarDecl.js";
|
|
13
|
+
import { TirSimpleVarDecl } from "../../../tir/statements/TirVarDecl/TirSimpleVarDecl.js";
|
|
13
14
|
import { TirVarDecl } from "../../../tir/statements/TirVarDecl/TirVarDecl.js";
|
|
14
15
|
import { TirStructConstr } from "../../../tir/types/TirStructType.js";
|
|
15
16
|
import { TirType } from "../../../tir/types/TirType.js";
|
|
16
17
|
import { AstCompilationCtx } from "../../AstCompilationCtx.js";
|
|
17
18
|
export declare function _compileVarStmt(ctx: AstCompilationCtx, stmt: VarStmt): TirVarDecl[] | undefined;
|
|
18
19
|
export declare function _compileVarDecl(ctx: AstCompilationCtx, decl: VarDecl, typeHint: TirType | undefined): TirVarDecl | undefined;
|
|
19
|
-
export declare function _compileSimpleVarDecl(ctx: AstCompilationCtx, decl: SimpleVarDecl, typeHint: TirType | undefined):
|
|
20
|
+
export declare function _compileSimpleVarDecl(ctx: AstCompilationCtx, decl: SimpleVarDecl, typeHint: TirType | undefined): TirSimpleVarDecl | undefined;
|
|
20
21
|
export declare function _compileNamedDeconstructVarDecl(ctx: AstCompilationCtx, decl: NamedDeconstructVarDecl, typeHint: TirType | undefined): TirNamedDeconstructVarDecl | undefined;
|
|
21
22
|
export declare function _compileSingleDeconstructVarDecl(ctx: AstCompilationCtx, decl: SingleDeconstructVarDecl, typeHint: TirType | undefined): TirVarDecl | undefined;
|
|
22
23
|
export declare function _compileArrayLikeDeconstr(ctx: AstCompilationCtx, decl: ArrayLikeDeconstr, typeHint: TirType | undefined): TirArrayLikeDeconstr | undefined;
|
|
@@ -27,15 +27,16 @@ export function _compileVarStmt(ctx, stmt) {
|
|
|
27
27
|
return tirVarDecls;
|
|
28
28
|
}
|
|
29
29
|
export function _compileVarDecl(ctx, decl, typeHint) {
|
|
30
|
-
if (decl instanceof SimpleVarDecl)
|
|
30
|
+
if (decl instanceof SimpleVarDecl) {
|
|
31
31
|
return _compileSimpleVarDecl(ctx, decl, typeHint);
|
|
32
|
+
}
|
|
32
33
|
if (decl instanceof NamedDeconstructVarDecl)
|
|
33
34
|
return _compileNamedDeconstructVarDecl(ctx, decl, typeHint);
|
|
34
35
|
if (decl instanceof SingleDeconstructVarDecl)
|
|
35
36
|
return _compileSingleDeconstructVarDecl(ctx, decl, typeHint);
|
|
36
37
|
if (decl instanceof ArrayLikeDeconstr)
|
|
37
38
|
return _compileArrayLikeDeconstr(ctx, decl, typeHint);
|
|
38
|
-
const
|
|
39
|
+
const tsEnsureExhautstiveCheck = decl;
|
|
39
40
|
console.error(decl);
|
|
40
41
|
throw new Error("unreachable::AstCompiler::_compileVarDecl");
|
|
41
42
|
}
|
|
@@ -176,7 +177,7 @@ export function _getVarDeclTypeAndExpr(ctx, decl, deconstructTypeHint) {
|
|
|
176
177
|
// // stmtIdx
|
|
177
178
|
// // )
|
|
178
179
|
// );
|
|
179
|
-
const typeHint =
|
|
180
|
+
const typeHint = declarationType ?? deconstructTypeHint;
|
|
180
181
|
// even in deconstructions
|
|
181
182
|
// we allow for `as` type assertions
|
|
182
183
|
// and we store the type to be converted to in the var decl type
|
|
@@ -55,7 +55,7 @@ export function _compileDataEncodedConcreteType(ctx, typeExpr, optionalsAsSop =
|
|
|
55
55
|
return undefined;
|
|
56
56
|
return ctx.program.types.get(possibleTirNames.dataTirName);
|
|
57
57
|
}
|
|
58
|
-
const
|
|
58
|
+
const tsEnsureExhautstiveCheck = typeExpr;
|
|
59
59
|
console.error(typeExpr);
|
|
60
60
|
throw new Error("unreachable::AstCompiler::_compileDataEncodedConcreteType");
|
|
61
61
|
}
|
|
@@ -52,8 +52,11 @@ export function _compileSopEncodedConcreteType(ctx, typeExpr) {
|
|
|
52
52
|
if (typeof possibleTirNames.dataTirName !== "string")
|
|
53
53
|
return undefined;
|
|
54
54
|
return ctx.program.types.get(possibleTirNames.dataTirName);
|
|
55
|
+
// const result = ctx.program.types.get( possibleTirNames.dataTirName );
|
|
56
|
+
// console.log( "possibleTirNames", possibleTirNames, result );
|
|
57
|
+
// return result;
|
|
55
58
|
}
|
|
56
|
-
const
|
|
59
|
+
const tsEnsureExhautstiveCheck = typeExpr;
|
|
57
60
|
console.error(typeExpr);
|
|
58
61
|
throw new Error("unreachable::AstCompiler::_compileSopEncodedConcreteType");
|
|
59
62
|
}
|
|
@@ -80,6 +80,7 @@ export declare class AstScope {
|
|
|
80
80
|
constructor(parent: AstScope | undefined, program: TypedProgram, infos: Partial<ScopeInfos>);
|
|
81
81
|
defineValue(valueInfos: IVariableInfos): boolean;
|
|
82
82
|
resolveValue(name: string): ResolveValueResult | undefined;
|
|
83
|
+
allVariables(): string[];
|
|
83
84
|
defineUnambigousType(name: string, tirTypeKey: string, allowsDataEncoding: boolean, methodsNames: Map<AstFuncName, TirFuncName>): boolean;
|
|
84
85
|
defineType(name: string, possibleTirTypes: PossibleTirTypes): boolean;
|
|
85
86
|
resolveLocalType(name: string): PossibleTirTypes | undefined;
|
|
@@ -62,6 +62,8 @@ export class AstScope {
|
|
|
62
62
|
this.parent = parent;
|
|
63
63
|
}
|
|
64
64
|
defineValue(valueInfos) {
|
|
65
|
+
if (valueInfos.name === "§tx_3")
|
|
66
|
+
console.log("Defining variable tx3");
|
|
65
67
|
if (this._isReadonly)
|
|
66
68
|
return false;
|
|
67
69
|
if (invalidSymbolNames.has(valueInfos.name)
|
|
@@ -90,6 +92,9 @@ export class AstScope {
|
|
|
90
92
|
}
|
|
91
93
|
return undefined;
|
|
92
94
|
}
|
|
95
|
+
allVariables() {
|
|
96
|
+
return (this.parent?.allVariables() ?? []).concat(Array.from(this.variables.keys()));
|
|
97
|
+
}
|
|
93
98
|
defineUnambigousType(name, tirTypeKey, allowsDataEncoding, methodsNames) {
|
|
94
99
|
if (this._isReadonly)
|
|
95
100
|
return false;
|
|
@@ -99,7 +104,7 @@ export class AstScope {
|
|
|
99
104
|
return false; // already defined
|
|
100
105
|
this.types.set(name, {
|
|
101
106
|
sopTirName: tirTypeKey,
|
|
102
|
-
dataTirName: allowsDataEncoding ?
|
|
107
|
+
dataTirName: allowsDataEncoding ? tirTypeKey : undefined,
|
|
103
108
|
allTirNames: new Set([tirTypeKey]),
|
|
104
109
|
methodsNames,
|
|
105
110
|
isGeneric: false
|
|
@@ -107,8 +112,9 @@ export class AstScope {
|
|
|
107
112
|
return true;
|
|
108
113
|
}
|
|
109
114
|
defineType(name, possibleTirTypes) {
|
|
110
|
-
if (this._isReadonly)
|
|
111
|
-
|
|
115
|
+
if (this._isReadonly) {
|
|
116
|
+
throw new Error("Cannot define type on readonly scope");
|
|
117
|
+
}
|
|
112
118
|
if (invalidSymbolNames.has(name))
|
|
113
119
|
return false;
|
|
114
120
|
if (this.types.has(name))
|
|
@@ -60,6 +60,7 @@ function getListMethods(elemsType) {
|
|
|
60
60
|
const mapReturnT = new TirTypeParam("T");
|
|
61
61
|
return {
|
|
62
62
|
length: new TirFuncT([], int_t),
|
|
63
|
+
isEmpty: new TirFuncT([], bool_t),
|
|
63
64
|
show: new TirFuncT([], bytes_t),
|
|
64
65
|
head: new TirFuncT([], elemsType),
|
|
65
66
|
tail: new TirFuncT([], new TirListT(elemsType)),
|
|
@@ -79,7 +80,8 @@ function getListMethods(elemsType) {
|
|
|
79
80
|
], bool_t),
|
|
80
81
|
some: new TirFuncT([
|
|
81
82
|
new TirFuncT([elemsType], bool_t)
|
|
82
|
-
], bool_t)
|
|
83
|
+
], bool_t),
|
|
84
|
+
includes: new TirFuncT([elemsType], bool_t),
|
|
83
85
|
};
|
|
84
86
|
}
|
|
85
87
|
function getLinearMapMethods(kT, vT) {
|
|
@@ -112,10 +114,10 @@ function findPropInImpls(ctx, methodsNamesPtr, propName) {
|
|
|
112
114
|
const tirFuncName = methodsNamesPtr.get(propName);
|
|
113
115
|
if (!tirFuncName)
|
|
114
116
|
return undefined;
|
|
115
|
-
const
|
|
116
|
-
if (!
|
|
117
|
+
const funcExpr = ctx.program.functions.get(tirFuncName);
|
|
118
|
+
if (!funcExpr)
|
|
117
119
|
return undefined;
|
|
118
|
-
const fullSig =
|
|
120
|
+
const fullSig = funcExpr.sig();
|
|
119
121
|
const methodSig = new TirFuncT(fullSig.argTypes.slice(1), fullSig.returnType);
|
|
120
122
|
return methodSig;
|
|
121
123
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { compileUPLC, UPLCProgram } from "@harmoniclabs/uplc";
|
|
2
2
|
import { DiagnosticEmitter } from "../diagnostics/DiagnosticEmitter.js";
|
|
3
|
-
import { compileIRToUPLC } from "../IR/index.js";
|
|
4
3
|
import { defaultOptions } from "../IR/toUPLC/CompilerOptions.js";
|
|
5
4
|
import { AstCompiler } from "./AstCompiler/AstCompiler.js";
|
|
6
5
|
import { createMemoryCompilerIoApi } from "./io/CompilerIoApi.js";
|
|
7
6
|
import { compileTypedProgram } from "./TirCompiler/compileTirProgram.js";
|
|
7
|
+
import { __VERY_UNSAFE_FORGET_IRHASH_ONLY_USE_AT_END_OF_UPLC_COMPILATION } from "../IR/IRHash.js";
|
|
8
|
+
import { compileIRToUPLC } from "../IR/toUPLC/compileIRToUPLC.js";
|
|
8
9
|
export class Compiler extends DiagnosticEmitter {
|
|
9
10
|
io;
|
|
10
11
|
cfg;
|
|
@@ -12,6 +13,9 @@ export class Compiler extends DiagnosticEmitter {
|
|
|
12
13
|
super(diagnostics);
|
|
13
14
|
this.io = io;
|
|
14
15
|
this.cfg = cfg;
|
|
16
|
+
if (cfg.silent === true) {
|
|
17
|
+
this.io.stdout = { write() { } };
|
|
18
|
+
}
|
|
15
19
|
}
|
|
16
20
|
async compile(config) {
|
|
17
21
|
const cfg = {
|
|
@@ -30,6 +34,7 @@ export class Compiler extends DiagnosticEmitter {
|
|
|
30
34
|
}
|
|
31
35
|
throw new Error("compilation failed with " + nDiags + " diagnostic messages; first message: " + fstErrorMsg);
|
|
32
36
|
}
|
|
37
|
+
// backend starts here
|
|
33
38
|
const ir = compileTypedProgram(cfg, program);
|
|
34
39
|
const uplc = compileIRToUPLC(ir);
|
|
35
40
|
const serialized = compileUPLC(new UPLCProgram(cfg.targetUplcVersion, uplc)).toBuffer().buffer;
|
|
@@ -37,6 +42,7 @@ export class Compiler extends DiagnosticEmitter {
|
|
|
37
42
|
const outPath = outDir + (outDir.endsWith("/") ? "" : "/") + "out.flat";
|
|
38
43
|
this.io.writeFile(outPath, serialized, cfg.root);
|
|
39
44
|
this.io.stdout.write(`compiled program written to ${outPath}\n`);
|
|
45
|
+
__VERY_UNSAFE_FORGET_IRHASH_ONLY_USE_AT_END_OF_UPLC_COMPILATION();
|
|
40
46
|
return;
|
|
41
47
|
}
|
|
42
48
|
}
|
|
@@ -13,6 +13,9 @@ export function compileTypedProgram(cfg, tirProgram) {
|
|
|
13
13
|
);
|
|
14
14
|
//*/
|
|
15
15
|
const mainFuncExpr = tirProgram.getMainOrThrow();
|
|
16
|
-
|
|
16
|
+
// console.log("main func:", mainFuncExpr.pretty() );
|
|
17
|
+
void expressify(mainFuncExpr, undefined, // loopReplacements
|
|
18
|
+
tirProgram);
|
|
19
|
+
// console.log("main func expressified:", mainFuncExpr.pretty() );
|
|
17
20
|
return mainFuncExpr.toIR(ToIRTermCtx.root());
|
|
18
21
|
}
|
|
@@ -9,6 +9,8 @@ import { TirNamedDeconstructVarDecl } from "../../tir/statements/TirVarDecl/TirN
|
|
|
9
9
|
import { TirSimpleVarDecl } from "../../tir/statements/TirVarDecl/TirSimpleVarDecl.js";
|
|
10
10
|
import { TirDataStructType } from "../../tir/types/TirStructType.js";
|
|
11
11
|
import { TirType } from "../../tir/types/TirType.js";
|
|
12
|
+
import { TypedProgram } from "../../tir/program/TypedProgram.js";
|
|
13
|
+
import { TirVarDecl } from "../../tir/statements/TirVarDecl/TirVarDecl.js";
|
|
12
14
|
/**
|
|
13
15
|
* Static Single Assignment (SSA) variable name.
|
|
14
16
|
*
|
|
@@ -29,16 +31,17 @@ export declare function isExpressifyFuncParam(thing: any): thing is ExpressifyFu
|
|
|
29
31
|
export declare class ExpressifyCtx {
|
|
30
32
|
readonly parent: ExpressifyCtx | undefined;
|
|
31
33
|
returnType: TirType;
|
|
34
|
+
readonly program: TypedProgram;
|
|
32
35
|
/** var name -> latest constant name */
|
|
33
|
-
readonly variables
|
|
36
|
+
private readonly variables;
|
|
34
37
|
/** constant name -> func param name (to build var access) */
|
|
35
38
|
readonly funcParams: Map<string, ExpressifyFuncParam>;
|
|
36
39
|
/** constant name -> letted expr */
|
|
37
|
-
readonly lettedConstants
|
|
40
|
+
private readonly lettedConstants;
|
|
38
41
|
/** var name -> prop name -> constant name (letted field extraction expr or var access for SoP)*/
|
|
39
42
|
readonly properties: Map<string, Map<string, string>>;
|
|
40
43
|
readonly hoisted: Map<string, TirHoistedExpr | TirNativeFunc>;
|
|
41
|
-
constructor(parent: ExpressifyCtx | undefined, returnType: TirType, hoisted?: Map<string, TirHoistedExpr | TirNativeFunc>,
|
|
44
|
+
constructor(parent: ExpressifyCtx | undefined, returnType: TirType, program: TypedProgram, hoisted?: Map<string, TirHoistedExpr | TirNativeFunc>,
|
|
42
45
|
/** var name -> latest constant name */
|
|
43
46
|
variables?: Map<string, LatestVarNameSSA>,
|
|
44
47
|
/** constant name -> func param name (to build var access) */
|
|
@@ -47,6 +50,8 @@ export declare class ExpressifyCtx {
|
|
|
47
50
|
lettedConstants?: Map<string, TirLettedExpr>,
|
|
48
51
|
/** var name -> prop name -> constant name (letted field extraction expr or var access for SoP)*/
|
|
49
52
|
properties?: Map<string, Map<string, string>>);
|
|
53
|
+
allVariablesNoLetted(): string[];
|
|
54
|
+
allVariables(): string[];
|
|
50
55
|
newChild(): ExpressifyCtx;
|
|
51
56
|
setNewVariableName(oldName: string, newName: string): void;
|
|
52
57
|
setFuncParam(name: string, type: TirType): void;
|
|
@@ -62,11 +67,18 @@ export declare class ExpressifyCtx {
|
|
|
62
67
|
*/
|
|
63
68
|
private _getNonHoistedVariable;
|
|
64
69
|
getVariable(name: string): ExpressifyFuncParam | TirHoistedExpr | TirNativeFunc | TirLettedExpr;
|
|
70
|
+
getVariableSSA(name: string): LatestVarNameSSA | undefined;
|
|
65
71
|
introduceFuncParams(params: readonly TirSimpleVarDecl[]): void;
|
|
66
72
|
introduceLettedConstant(name: string, lettedExpr: TirExpr, declRange: SourceRange): TirLettedExpr;
|
|
67
73
|
introduceSopConstrFieldsAsProperties(sopName: string, destructuredPattern: TirNamedDeconstructVarDecl): void;
|
|
68
74
|
introduceSopConstrFieldsAsParamsOnly(destructuredPattern: TirNamedDeconstructVarDecl): void;
|
|
69
75
|
introduceSingleConstrDataLettedFields(varName: string, structExpr: TirExpr, structType: TirDataStructType): void;
|
|
70
|
-
introduceDeconstrDataLettedFields(stmt: TirNamedDeconstructVarDecl):
|
|
71
|
-
|
|
76
|
+
introduceDeconstrDataLettedFields(stmt: TirNamedDeconstructVarDecl, lettedInitExpr: TirLettedExpr): {
|
|
77
|
+
implicitAssertions: TirAssertStmt[];
|
|
78
|
+
nestedDeconstructs: TirVarDecl[];
|
|
79
|
+
};
|
|
80
|
+
introduceArrayDeconstr(stmt: TirArrayLikeDeconstr, isDestructuredField?: boolean): {
|
|
81
|
+
implicitAssertions: TirAssertStmt[];
|
|
82
|
+
nestedDeconstructs: TirVarDecl[];
|
|
83
|
+
};
|
|
72
84
|
}
|