@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
|
@@ -16,6 +16,8 @@ export declare class TirExponentiationExpr implements ITirBinaryExpr {
|
|
|
16
16
|
readonly range: SourceRange;
|
|
17
17
|
readonly type: TirType;
|
|
18
18
|
constructor(left: TirExpr, right: TirExpr, range: SourceRange);
|
|
19
|
+
toString(): string;
|
|
20
|
+
pretty(indent: number): string;
|
|
19
21
|
clone(): TirExpr;
|
|
20
22
|
get isConstant(): boolean;
|
|
21
23
|
toIR(ctx: ToIRTermCtx): IRTerm;
|
|
@@ -27,6 +29,8 @@ export declare class TirLessThanExpr implements ITirBinaryExpr {
|
|
|
27
29
|
readonly range: SourceRange;
|
|
28
30
|
readonly type: TirType;
|
|
29
31
|
constructor(left: TirExpr, right: TirExpr, range: SourceRange);
|
|
32
|
+
toString(): string;
|
|
33
|
+
pretty(indent: number): string;
|
|
30
34
|
clone(): TirExpr;
|
|
31
35
|
get isConstant(): boolean;
|
|
32
36
|
toIR(ctx: ToIRTermCtx): IRTerm;
|
|
@@ -38,6 +42,8 @@ export declare class TirGreaterThanExpr implements ITirBinaryExpr {
|
|
|
38
42
|
readonly range: SourceRange;
|
|
39
43
|
readonly type: TirType;
|
|
40
44
|
constructor(left: TirExpr, right: TirExpr, range: SourceRange);
|
|
45
|
+
toString(): string;
|
|
46
|
+
pretty(indent: number): string;
|
|
41
47
|
clone(): TirExpr;
|
|
42
48
|
get isConstant(): boolean;
|
|
43
49
|
toIR(ctx: ToIRTermCtx): IRTerm;
|
|
@@ -49,6 +55,8 @@ export declare class TirLessThanEqualExpr implements ITirBinaryExpr {
|
|
|
49
55
|
readonly range: SourceRange;
|
|
50
56
|
readonly type: TirType;
|
|
51
57
|
constructor(left: TirExpr, right: TirExpr, range: SourceRange);
|
|
58
|
+
toString(): string;
|
|
59
|
+
pretty(indent: number): string;
|
|
52
60
|
clone(): TirExpr;
|
|
53
61
|
get isConstant(): boolean;
|
|
54
62
|
toIR(ctx: ToIRTermCtx): IRTerm;
|
|
@@ -60,6 +68,8 @@ export declare class TirGreaterThanEqualExpr implements ITirBinaryExpr {
|
|
|
60
68
|
readonly range: SourceRange;
|
|
61
69
|
readonly type: TirType;
|
|
62
70
|
constructor(left: TirExpr, right: TirExpr, range: SourceRange);
|
|
71
|
+
toString(): string;
|
|
72
|
+
pretty(indent: number): string;
|
|
63
73
|
clone(): TirExpr;
|
|
64
74
|
get isConstant(): boolean;
|
|
65
75
|
toIR(ctx: ToIRTermCtx): IRTerm;
|
|
@@ -71,6 +81,8 @@ export declare class TirEqualExpr implements ITirBinaryExpr {
|
|
|
71
81
|
readonly range: SourceRange;
|
|
72
82
|
readonly type: TirType;
|
|
73
83
|
constructor(left: TirExpr, right: TirExpr, range: SourceRange);
|
|
84
|
+
toString(): string;
|
|
85
|
+
pretty(indent: number): string;
|
|
74
86
|
clone(): TirExpr;
|
|
75
87
|
get isConstant(): boolean;
|
|
76
88
|
toIR(ctx: ToIRTermCtx): IRTerm;
|
|
@@ -82,6 +94,8 @@ export declare class TirNotEqualExpr implements ITirBinaryExpr {
|
|
|
82
94
|
readonly range: SourceRange;
|
|
83
95
|
readonly type: TirType;
|
|
84
96
|
constructor(left: TirExpr, right: TirExpr, range: SourceRange);
|
|
97
|
+
toString(): string;
|
|
98
|
+
pretty(indent: number): string;
|
|
85
99
|
clone(): TirExpr;
|
|
86
100
|
get isConstant(): boolean;
|
|
87
101
|
toIR(ctx: ToIRTermCtx): IRTerm;
|
|
@@ -91,8 +105,11 @@ export declare class TirAddExpr implements ITirBinaryExpr {
|
|
|
91
105
|
left: TirExpr;
|
|
92
106
|
right: TirExpr;
|
|
93
107
|
readonly range: SourceRange;
|
|
108
|
+
private _creationStack;
|
|
94
109
|
get type(): TirType;
|
|
95
110
|
constructor(left: TirExpr, right: TirExpr, range: SourceRange);
|
|
111
|
+
toString(): string;
|
|
112
|
+
pretty(indent: number): string;
|
|
96
113
|
clone(): TirExpr;
|
|
97
114
|
get isConstant(): boolean;
|
|
98
115
|
toIR(ctx: ToIRTermCtx): IRTerm;
|
|
@@ -104,6 +121,8 @@ export declare class TirSubExpr implements ITirBinaryExpr {
|
|
|
104
121
|
readonly range: SourceRange;
|
|
105
122
|
readonly type: TirType;
|
|
106
123
|
constructor(left: TirExpr, right: TirExpr, range: SourceRange);
|
|
124
|
+
toString(): string;
|
|
125
|
+
pretty(indent: number): string;
|
|
107
126
|
clone(): TirExpr;
|
|
108
127
|
get isConstant(): boolean;
|
|
109
128
|
toIR(ctx: ToIRTermCtx): IRTerm;
|
|
@@ -115,6 +134,8 @@ export declare class TirMultExpr implements ITirBinaryExpr {
|
|
|
115
134
|
readonly range: SourceRange;
|
|
116
135
|
readonly type: TirType;
|
|
117
136
|
constructor(left: TirExpr, right: TirExpr, range: SourceRange);
|
|
137
|
+
toString(): string;
|
|
138
|
+
pretty(indent: number): string;
|
|
118
139
|
clone(): TirExpr;
|
|
119
140
|
get isConstant(): boolean;
|
|
120
141
|
toIR(ctx: ToIRTermCtx): IRTerm;
|
|
@@ -126,6 +147,8 @@ export declare class TirDivExpr implements ITirBinaryExpr {
|
|
|
126
147
|
readonly range: SourceRange;
|
|
127
148
|
readonly type: TirType;
|
|
128
149
|
constructor(left: TirExpr, right: TirExpr, range: SourceRange);
|
|
150
|
+
toString(): string;
|
|
151
|
+
pretty(indent: number): string;
|
|
129
152
|
clone(): TirExpr;
|
|
130
153
|
get isConstant(): boolean;
|
|
131
154
|
toIR(ctx: ToIRTermCtx): IRTerm;
|
|
@@ -137,6 +160,8 @@ export declare class TirModuloExpr implements ITirBinaryExpr {
|
|
|
137
160
|
readonly range: SourceRange;
|
|
138
161
|
readonly type: TirType;
|
|
139
162
|
constructor(left: TirExpr, right: TirExpr, range: SourceRange);
|
|
163
|
+
toString(): string;
|
|
164
|
+
pretty(indent: number): string;
|
|
140
165
|
clone(): TirExpr;
|
|
141
166
|
get isConstant(): boolean;
|
|
142
167
|
toIR(ctx: ToIRTermCtx): IRTerm;
|
|
@@ -148,6 +173,8 @@ export declare class TirShiftLeftExpr implements ITirBinaryExpr {
|
|
|
148
173
|
readonly range: SourceRange;
|
|
149
174
|
readonly type: TirType;
|
|
150
175
|
constructor(left: TirExpr, right: TirExpr, range: SourceRange);
|
|
176
|
+
toString(): string;
|
|
177
|
+
pretty(indent: number): string;
|
|
151
178
|
clone(): TirExpr;
|
|
152
179
|
get isConstant(): boolean;
|
|
153
180
|
toIR(ctx: ToIRTermCtx): IRTerm;
|
|
@@ -159,6 +186,8 @@ export declare class TirShiftRightExpr implements ITirBinaryExpr {
|
|
|
159
186
|
readonly range: SourceRange;
|
|
160
187
|
readonly type: TirType;
|
|
161
188
|
constructor(left: TirExpr, right: TirExpr, range: SourceRange);
|
|
189
|
+
toString(): string;
|
|
190
|
+
pretty(indent: number): string;
|
|
162
191
|
clone(): TirExpr;
|
|
163
192
|
get isConstant(): boolean;
|
|
164
193
|
toIR(ctx: ToIRTermCtx): IRTerm;
|
|
@@ -170,6 +199,8 @@ export declare class TirBitwiseAndExpr implements ITirBinaryExpr {
|
|
|
170
199
|
readonly range: SourceRange;
|
|
171
200
|
readonly type: TirType;
|
|
172
201
|
constructor(left: TirExpr, right: TirExpr, range: SourceRange);
|
|
202
|
+
toString(): string;
|
|
203
|
+
pretty(indent: number): string;
|
|
173
204
|
clone(): TirExpr;
|
|
174
205
|
get isConstant(): boolean;
|
|
175
206
|
toIR(ctx: ToIRTermCtx): IRTerm;
|
|
@@ -181,6 +212,8 @@ export declare class TirBitwiseXorExpr implements ITirBinaryExpr {
|
|
|
181
212
|
readonly range: SourceRange;
|
|
182
213
|
readonly type: TirType;
|
|
183
214
|
constructor(left: TirExpr, right: TirExpr, range: SourceRange);
|
|
215
|
+
toString(): string;
|
|
216
|
+
pretty(indent: number): string;
|
|
184
217
|
clone(): TirExpr;
|
|
185
218
|
get isConstant(): boolean;
|
|
186
219
|
toIR(ctx: ToIRTermCtx): IRTerm;
|
|
@@ -192,6 +225,8 @@ export declare class TirBitwiseOrExpr implements ITirBinaryExpr {
|
|
|
192
225
|
readonly range: SourceRange;
|
|
193
226
|
readonly type: TirType;
|
|
194
227
|
constructor(left: TirExpr, right: TirExpr, range: SourceRange);
|
|
228
|
+
toString(): string;
|
|
229
|
+
pretty(indent: number): string;
|
|
195
230
|
clone(): TirExpr;
|
|
196
231
|
get isConstant(): boolean;
|
|
197
232
|
toIR(ctx: ToIRTermCtx): IRTerm;
|
|
@@ -203,19 +238,25 @@ export declare class TirLogicalAndExpr implements ITirBinaryExpr {
|
|
|
203
238
|
readonly range: SourceRange;
|
|
204
239
|
readonly type: TirType;
|
|
205
240
|
constructor(left: TirExpr, right: TirExpr, range: SourceRange);
|
|
241
|
+
toString(): string;
|
|
242
|
+
pretty(indent: number): string;
|
|
206
243
|
clone(): TirExpr;
|
|
207
244
|
get isConstant(): boolean;
|
|
208
245
|
toIR(ctx: ToIRTermCtx): IRTerm;
|
|
209
246
|
deps(): string[];
|
|
210
247
|
}
|
|
248
|
+
export declare function _ir_and(left: IRTerm, right: IRTerm): IRTerm;
|
|
211
249
|
export declare class TirLogicalOrExpr implements ITirBinaryExpr {
|
|
212
250
|
left: TirExpr;
|
|
213
251
|
right: TirExpr;
|
|
214
252
|
readonly range: SourceRange;
|
|
215
253
|
readonly type: TirType;
|
|
216
254
|
constructor(left: TirExpr, right: TirExpr, range: SourceRange);
|
|
255
|
+
toString(): string;
|
|
256
|
+
pretty(indent: number): string;
|
|
217
257
|
clone(): TirExpr;
|
|
218
258
|
get isConstant(): boolean;
|
|
219
259
|
toIR(ctx: ToIRTermCtx): IRTerm;
|
|
220
260
|
deps(): string[];
|
|
221
261
|
}
|
|
262
|
+
export declare function _ir_or(left: IRTerm, right: IRTerm): IRTerm;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { isObject } from "@harmoniclabs/obj-utils";
|
|
2
2
|
import { bool_t, bytes_t, int_t } from "../../program/stdScope/stdScope.js";
|
|
3
3
|
import { mergeSortedStrArrInplace } from "../../../../utils/array/mergeSortedStrArrInplace.js";
|
|
4
|
-
import { _ir_apps } from "../../../../IR/tree_utils/_ir_apps.js";
|
|
5
4
|
import { getUnaliased } from "../../types/utils/getUnaliased.js";
|
|
6
5
|
import { CEKConst, Machine } from "@harmoniclabs/plutus-machine";
|
|
7
6
|
import { TirBytesT } from "../../types/TirNativeType/native/bytes.js";
|
|
@@ -9,6 +8,8 @@ import { TirIntT } from "../../types/TirNativeType/native/int.js";
|
|
|
9
8
|
import { IRNative } from "../../../../IR/IRNodes/IRNative/index.js";
|
|
10
9
|
import { IRConst } from "../../../../IR/IRNodes/IRConst.js";
|
|
11
10
|
import { compileIRToUPLC } from "../../../../IR/toUPLC/compileIRToUPLC.js";
|
|
11
|
+
import { _ir_apps } from "../../../../IR/IRNodes/IRApp.js";
|
|
12
|
+
import { _ir_lazyIfThenElse } from "../../../../IR/tree_utils/_ir_lazyIfThenElse.js";
|
|
12
13
|
export function isTirBinaryExpr(thing) {
|
|
13
14
|
return isObject(thing) && (thing instanceof TirExponentiationExpr // int
|
|
14
15
|
|| thing instanceof TirLessThanExpr // bool
|
|
@@ -41,6 +42,14 @@ export class TirExponentiationExpr {
|
|
|
41
42
|
this.right = right;
|
|
42
43
|
this.range = range;
|
|
43
44
|
}
|
|
45
|
+
toString() {
|
|
46
|
+
return `(${this.left.toString()} ** ${this.right.toString()})`;
|
|
47
|
+
}
|
|
48
|
+
pretty(indent) {
|
|
49
|
+
const singleIndent = " ";
|
|
50
|
+
const indent_base = singleIndent.repeat(indent);
|
|
51
|
+
return `(${this.left.pretty(indent)} ** ${this.right.pretty(indent)})`;
|
|
52
|
+
}
|
|
44
53
|
clone() {
|
|
45
54
|
return new TirExponentiationExpr(this.left.clone(), this.right.clone(), this.range.clone());
|
|
46
55
|
}
|
|
@@ -64,6 +73,14 @@ export class TirLessThanExpr {
|
|
|
64
73
|
this.right = right;
|
|
65
74
|
this.range = range;
|
|
66
75
|
}
|
|
76
|
+
toString() {
|
|
77
|
+
return `(${this.left.toString()} < ${this.right.toString()})`;
|
|
78
|
+
}
|
|
79
|
+
pretty(indent) {
|
|
80
|
+
const singleIndent = " ";
|
|
81
|
+
const indent_base = singleIndent.repeat(indent);
|
|
82
|
+
return `(${this.left.pretty(indent)} < ${this.right.pretty(indent)})`;
|
|
83
|
+
}
|
|
67
84
|
clone() {
|
|
68
85
|
return new TirLessThanExpr(this.left.clone(), this.right.clone(), this.range.clone());
|
|
69
86
|
}
|
|
@@ -93,6 +110,14 @@ export class TirGreaterThanExpr {
|
|
|
93
110
|
this.right = right;
|
|
94
111
|
this.range = range;
|
|
95
112
|
}
|
|
113
|
+
toString() {
|
|
114
|
+
return `(${this.left.toString()} > ${this.right.toString()})`;
|
|
115
|
+
}
|
|
116
|
+
pretty(indent) {
|
|
117
|
+
const singleIndent = " ";
|
|
118
|
+
const indent_base = singleIndent.repeat(indent);
|
|
119
|
+
return `(${this.left.pretty(indent)} > ${this.right.pretty(indent)})`;
|
|
120
|
+
}
|
|
96
121
|
clone() {
|
|
97
122
|
return new TirGreaterThanExpr(this.left.clone(), this.right.clone(), this.range.clone());
|
|
98
123
|
}
|
|
@@ -124,6 +149,14 @@ export class TirLessThanEqualExpr {
|
|
|
124
149
|
this.right = right;
|
|
125
150
|
this.range = range;
|
|
126
151
|
}
|
|
152
|
+
toString() {
|
|
153
|
+
return `(${this.left.toString()} <= ${this.right.toString()})`;
|
|
154
|
+
}
|
|
155
|
+
pretty(indent) {
|
|
156
|
+
const singleIndent = " ";
|
|
157
|
+
const indent_base = singleIndent.repeat(indent);
|
|
158
|
+
return `(${this.left.pretty(indent)} <= ${this.right.pretty(indent)})`;
|
|
159
|
+
}
|
|
127
160
|
clone() {
|
|
128
161
|
return new TirLessThanEqualExpr(this.left.clone(), this.right.clone(), this.range.clone());
|
|
129
162
|
}
|
|
@@ -153,6 +186,14 @@ export class TirGreaterThanEqualExpr {
|
|
|
153
186
|
this.right = right;
|
|
154
187
|
this.range = range;
|
|
155
188
|
}
|
|
189
|
+
toString() {
|
|
190
|
+
return `(${this.left.toString()} >= ${this.right.toString()})`;
|
|
191
|
+
}
|
|
192
|
+
pretty(indent) {
|
|
193
|
+
const singleIndent = " ";
|
|
194
|
+
const indent_base = singleIndent.repeat(indent);
|
|
195
|
+
return `(${this.left.pretty(indent)} >= ${this.right.pretty(indent)})`;
|
|
196
|
+
}
|
|
156
197
|
clone() {
|
|
157
198
|
return new TirGreaterThanEqualExpr(this.left.clone(), this.right.clone(), this.range.clone());
|
|
158
199
|
}
|
|
@@ -184,6 +225,14 @@ export class TirEqualExpr {
|
|
|
184
225
|
this.right = right;
|
|
185
226
|
this.range = range;
|
|
186
227
|
}
|
|
228
|
+
toString() {
|
|
229
|
+
return `(${this.left.toString()} === ${this.right.toString()})`;
|
|
230
|
+
}
|
|
231
|
+
pretty(indent) {
|
|
232
|
+
const singleIndent = " ";
|
|
233
|
+
const indent_base = singleIndent.repeat(indent);
|
|
234
|
+
return `(${this.left.pretty(indent)} === ${this.right.pretty(indent)})`;
|
|
235
|
+
}
|
|
187
236
|
clone() {
|
|
188
237
|
return new TirEqualExpr(this.left.clone(), this.right.clone(), this.range.clone());
|
|
189
238
|
}
|
|
@@ -207,6 +256,14 @@ export class TirNotEqualExpr {
|
|
|
207
256
|
this.right = right;
|
|
208
257
|
this.range = range;
|
|
209
258
|
}
|
|
259
|
+
toString() {
|
|
260
|
+
return `(${this.left.toString()} !== ${this.right.toString()})`;
|
|
261
|
+
}
|
|
262
|
+
pretty(indent) {
|
|
263
|
+
const singleIndent = " ";
|
|
264
|
+
const indent_base = singleIndent.repeat(indent);
|
|
265
|
+
return `(${this.left.pretty(indent)} !== ${this.right.pretty(indent)})`;
|
|
266
|
+
}
|
|
210
267
|
clone() {
|
|
211
268
|
return new TirNotEqualExpr(this.left.clone(), this.right.clone(), this.range.clone());
|
|
212
269
|
}
|
|
@@ -220,15 +277,17 @@ export class TirNotEqualExpr {
|
|
|
220
277
|
return deps;
|
|
221
278
|
}
|
|
222
279
|
}
|
|
280
|
+
let n_logs = 0;
|
|
223
281
|
export class TirAddExpr {
|
|
224
282
|
left;
|
|
225
283
|
right;
|
|
226
284
|
range;
|
|
285
|
+
_creationStack;
|
|
227
286
|
get type() {
|
|
228
287
|
const leftType = getUnaliased(this.left.type);
|
|
229
288
|
if (leftType instanceof TirIntT
|
|
230
289
|
|| leftType instanceof TirBytesT)
|
|
231
|
-
return
|
|
290
|
+
return leftType;
|
|
232
291
|
throw new Error("invalid type for addition");
|
|
233
292
|
}
|
|
234
293
|
constructor(left, right, range) {
|
|
@@ -236,6 +295,17 @@ export class TirAddExpr {
|
|
|
236
295
|
this.right = right;
|
|
237
296
|
this.range = range;
|
|
238
297
|
}
|
|
298
|
+
toString() {
|
|
299
|
+
return `(${this.left.toString()} + ${this.right.toString()})`;
|
|
300
|
+
}
|
|
301
|
+
pretty(indent) {
|
|
302
|
+
n_logs++;
|
|
303
|
+
if (!(n_logs % 100))
|
|
304
|
+
console.log(this);
|
|
305
|
+
const singleIndent = " ";
|
|
306
|
+
const indent_base = singleIndent.repeat(indent);
|
|
307
|
+
return `(${this.left.pretty(indent)} + ${this.right.pretty(indent)})`;
|
|
308
|
+
}
|
|
239
309
|
clone() {
|
|
240
310
|
return new TirAddExpr(this.left.clone(), this.right.clone(), this.range.clone());
|
|
241
311
|
}
|
|
@@ -265,6 +335,14 @@ export class TirSubExpr {
|
|
|
265
335
|
this.right = right;
|
|
266
336
|
this.range = range;
|
|
267
337
|
}
|
|
338
|
+
toString() {
|
|
339
|
+
return `(${this.left.toString()} - ${this.right.toString()})`;
|
|
340
|
+
}
|
|
341
|
+
pretty(indent) {
|
|
342
|
+
const singleIndent = " ";
|
|
343
|
+
const indent_base = singleIndent.repeat(indent);
|
|
344
|
+
return `(${this.left.pretty(indent)} - ${this.right.pretty(indent)})`;
|
|
345
|
+
}
|
|
268
346
|
clone() {
|
|
269
347
|
return new TirSubExpr(this.left.clone(), this.right.clone(), this.range.clone());
|
|
270
348
|
}
|
|
@@ -288,6 +366,14 @@ export class TirMultExpr {
|
|
|
288
366
|
this.right = right;
|
|
289
367
|
this.range = range;
|
|
290
368
|
}
|
|
369
|
+
toString() {
|
|
370
|
+
return `(${this.left.toString()} * ${this.right.toString()})`;
|
|
371
|
+
}
|
|
372
|
+
pretty(indent) {
|
|
373
|
+
const singleIndent = " ";
|
|
374
|
+
const indent_base = singleIndent.repeat(indent);
|
|
375
|
+
return `(${this.left.pretty(indent)} * ${this.right.pretty(indent)})`;
|
|
376
|
+
}
|
|
291
377
|
clone() {
|
|
292
378
|
return new TirMultExpr(this.left.clone(), this.right.clone(), this.range.clone());
|
|
293
379
|
}
|
|
@@ -311,6 +397,14 @@ export class TirDivExpr {
|
|
|
311
397
|
this.right = right;
|
|
312
398
|
this.range = range;
|
|
313
399
|
}
|
|
400
|
+
toString() {
|
|
401
|
+
return `(${this.left.toString()} / ${this.right.toString()})`;
|
|
402
|
+
}
|
|
403
|
+
pretty(indent) {
|
|
404
|
+
const singleIndent = " ";
|
|
405
|
+
const indent_base = singleIndent.repeat(indent);
|
|
406
|
+
return `(${this.left.pretty(indent)} / ${this.right.pretty(indent)})`;
|
|
407
|
+
}
|
|
314
408
|
clone() {
|
|
315
409
|
return new TirDivExpr(this.left.clone(), this.right.clone(), this.range.clone());
|
|
316
410
|
}
|
|
@@ -334,6 +428,14 @@ export class TirModuloExpr {
|
|
|
334
428
|
this.right = right;
|
|
335
429
|
this.range = range;
|
|
336
430
|
}
|
|
431
|
+
toString() {
|
|
432
|
+
return `(${this.left.toString()} % ${this.right.toString()})`;
|
|
433
|
+
}
|
|
434
|
+
pretty(indent) {
|
|
435
|
+
const singleIndent = " ";
|
|
436
|
+
const indent_base = singleIndent.repeat(indent);
|
|
437
|
+
return `(${this.left.pretty(indent)} % ${this.right.pretty(indent)})`;
|
|
438
|
+
}
|
|
337
439
|
clone() {
|
|
338
440
|
return new TirModuloExpr(this.left.clone(), this.right.clone(), this.range.clone());
|
|
339
441
|
}
|
|
@@ -357,6 +459,14 @@ export class TirShiftLeftExpr {
|
|
|
357
459
|
this.right = right;
|
|
358
460
|
this.range = range;
|
|
359
461
|
}
|
|
462
|
+
toString() {
|
|
463
|
+
return `(${this.left.toString()} << ${this.right.toString()})`;
|
|
464
|
+
}
|
|
465
|
+
pretty(indent) {
|
|
466
|
+
const singleIndent = " ";
|
|
467
|
+
const indent_base = singleIndent.repeat(indent);
|
|
468
|
+
return `(${this.left.pretty(indent)} << ${this.right.pretty(indent)})`;
|
|
469
|
+
}
|
|
360
470
|
clone() {
|
|
361
471
|
return new TirShiftLeftExpr(this.left.clone(), this.right.clone(), this.range.clone());
|
|
362
472
|
}
|
|
@@ -382,6 +492,14 @@ export class TirShiftRightExpr {
|
|
|
382
492
|
this.right = right;
|
|
383
493
|
this.range = range;
|
|
384
494
|
}
|
|
495
|
+
toString() {
|
|
496
|
+
return `(${this.left.toString()} >> ${this.right.toString()})`;
|
|
497
|
+
}
|
|
498
|
+
pretty(indent) {
|
|
499
|
+
const singleIndent = " ";
|
|
500
|
+
const indent_base = singleIndent.repeat(indent);
|
|
501
|
+
return `(${this.left.pretty(indent)} >> ${this.right.pretty(indent)})`;
|
|
502
|
+
}
|
|
385
503
|
clone() {
|
|
386
504
|
return new TirShiftRightExpr(this.left.clone(), this.right.clone(), this.range.clone());
|
|
387
505
|
}
|
|
@@ -425,6 +543,14 @@ export class TirBitwiseAndExpr {
|
|
|
425
543
|
this.right = right;
|
|
426
544
|
this.range = range;
|
|
427
545
|
}
|
|
546
|
+
toString() {
|
|
547
|
+
return `(${this.left.toString()} & ${this.right.toString()})`;
|
|
548
|
+
}
|
|
549
|
+
pretty(indent) {
|
|
550
|
+
const singleIndent = " ";
|
|
551
|
+
const indent_base = singleIndent.repeat(indent);
|
|
552
|
+
return `(${this.left.pretty(indent)} & ${this.right.pretty(indent)})`;
|
|
553
|
+
}
|
|
428
554
|
clone() {
|
|
429
555
|
return new TirBitwiseAndExpr(this.left.clone(), this.right.clone(), this.range.clone());
|
|
430
556
|
}
|
|
@@ -448,6 +574,14 @@ export class TirBitwiseXorExpr {
|
|
|
448
574
|
this.right = right;
|
|
449
575
|
this.range = range;
|
|
450
576
|
}
|
|
577
|
+
toString() {
|
|
578
|
+
return `(${this.left.toString()} ^ ${this.right.toString()})`;
|
|
579
|
+
}
|
|
580
|
+
pretty(indent) {
|
|
581
|
+
const singleIndent = " ";
|
|
582
|
+
const indent_base = singleIndent.repeat(indent);
|
|
583
|
+
return `(${this.left.pretty(indent)} ^ ${this.right.pretty(indent)})`;
|
|
584
|
+
}
|
|
451
585
|
clone() {
|
|
452
586
|
return new TirBitwiseXorExpr(this.left.clone(), this.right.clone(), this.range.clone());
|
|
453
587
|
}
|
|
@@ -471,6 +605,14 @@ export class TirBitwiseOrExpr {
|
|
|
471
605
|
this.right = right;
|
|
472
606
|
this.range = range;
|
|
473
607
|
}
|
|
608
|
+
toString() {
|
|
609
|
+
return `(${this.left.toString()} | ${this.right.toString()})`;
|
|
610
|
+
}
|
|
611
|
+
pretty(indent) {
|
|
612
|
+
const singleIndent = " ";
|
|
613
|
+
const indent_base = singleIndent.repeat(indent);
|
|
614
|
+
return `(${this.left.pretty(indent)} | ${this.right.pretty(indent)})`;
|
|
615
|
+
}
|
|
474
616
|
clone() {
|
|
475
617
|
return new TirBitwiseOrExpr(this.left.clone(), this.right.clone(), this.range.clone());
|
|
476
618
|
}
|
|
@@ -494,12 +636,20 @@ export class TirLogicalAndExpr {
|
|
|
494
636
|
this.right = right;
|
|
495
637
|
this.range = range;
|
|
496
638
|
}
|
|
639
|
+
toString() {
|
|
640
|
+
return `(${this.left.toString()} && ${this.right.toString()})`;
|
|
641
|
+
}
|
|
642
|
+
pretty(indent) {
|
|
643
|
+
const singleIndent = " ";
|
|
644
|
+
const indent_base = singleIndent.repeat(indent);
|
|
645
|
+
return `(${this.left.pretty(indent)} && ${this.right.pretty(indent)})`;
|
|
646
|
+
}
|
|
497
647
|
clone() {
|
|
498
648
|
return new TirLogicalAndExpr(this.left.clone(), this.right.clone(), this.range.clone());
|
|
499
649
|
}
|
|
500
650
|
get isConstant() { return this.left.isConstant && this.right.isConstant; }
|
|
501
651
|
toIR(ctx) {
|
|
502
|
-
return
|
|
652
|
+
return _ir_and(this.left.toIR(ctx), this.right.toIR(ctx));
|
|
503
653
|
}
|
|
504
654
|
deps() {
|
|
505
655
|
const deps = this.left.deps();
|
|
@@ -507,6 +657,15 @@ export class TirLogicalAndExpr {
|
|
|
507
657
|
return deps;
|
|
508
658
|
}
|
|
509
659
|
}
|
|
660
|
+
export function _ir_and(left, right) {
|
|
661
|
+
return _ir_lazyIfThenElse(
|
|
662
|
+
// condition
|
|
663
|
+
left,
|
|
664
|
+
// then
|
|
665
|
+
right,
|
|
666
|
+
// else
|
|
667
|
+
IRConst.bool(false));
|
|
668
|
+
}
|
|
510
669
|
export class TirLogicalOrExpr {
|
|
511
670
|
left;
|
|
512
671
|
right;
|
|
@@ -517,12 +676,20 @@ export class TirLogicalOrExpr {
|
|
|
517
676
|
this.right = right;
|
|
518
677
|
this.range = range;
|
|
519
678
|
}
|
|
679
|
+
toString() {
|
|
680
|
+
return `(${this.left.toString()} || ${this.right.toString()})`;
|
|
681
|
+
}
|
|
682
|
+
pretty(indent) {
|
|
683
|
+
const singleIndent = " ";
|
|
684
|
+
const indent_base = singleIndent.repeat(indent);
|
|
685
|
+
return `(${this.left.pretty(indent)} || ${this.right.pretty(indent)})`;
|
|
686
|
+
}
|
|
520
687
|
clone() {
|
|
521
688
|
return new TirLogicalOrExpr(this.left.clone(), this.right.clone(), this.range.clone());
|
|
522
689
|
}
|
|
523
690
|
get isConstant() { return this.left.isConstant && this.right.isConstant; }
|
|
524
691
|
toIR(ctx) {
|
|
525
|
-
return
|
|
692
|
+
return _ir_or(this.left.toIR(ctx), this.right.toIR(ctx));
|
|
526
693
|
}
|
|
527
694
|
deps() {
|
|
528
695
|
const deps = this.left.deps();
|
|
@@ -530,3 +697,12 @@ export class TirLogicalOrExpr {
|
|
|
530
697
|
return deps;
|
|
531
698
|
}
|
|
532
699
|
}
|
|
700
|
+
export function _ir_or(left, right) {
|
|
701
|
+
return _ir_lazyIfThenElse(
|
|
702
|
+
// condition
|
|
703
|
+
left,
|
|
704
|
+
// then
|
|
705
|
+
IRConst.bool(true),
|
|
706
|
+
// else
|
|
707
|
+
right);
|
|
708
|
+
}
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { SourceRange } from "../../../../ast/Source/SourceRange.js";
|
|
2
|
-
import { IRTerm } from "../../../../IR/index.js";
|
|
3
2
|
import { TirType } from "../../types/TirType.js";
|
|
4
3
|
import { ITirExpr } from "../ITirExpr.js";
|
|
5
4
|
import { TirExpr } from "../TirExpr.js";
|
|
6
5
|
import { ToIRTermCtx } from "../ToIRTermCtx.js";
|
|
6
|
+
import type { IRTerm } from "../../../../IR/IRTerm.js";
|
|
7
7
|
export declare class TirLitArrExpr implements ITirExpr {
|
|
8
8
|
readonly elems: TirExpr[];
|
|
9
9
|
readonly type: TirType;
|
|
10
10
|
readonly range: SourceRange;
|
|
11
11
|
get isConstant(): boolean;
|
|
12
12
|
constructor(elems: TirExpr[], type: TirType, range: SourceRange);
|
|
13
|
-
|
|
13
|
+
pretty(): string;
|
|
14
|
+
toString(): string;
|
|
15
|
+
clone(): TirExpr;
|
|
14
16
|
deps(): string[];
|
|
15
17
|
toIR(ctx: ToIRTermCtx): IRTerm;
|
|
16
18
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { Machine, CEKConst } from "@harmoniclabs/plutus-machine";
|
|
2
|
-
import { compileIRToUPLC, IRConst, IRNative } from "../../../../IR/index.js";
|
|
3
2
|
import { mergeSortedStrArrInplace } from "../../../../utils/array/mergeSortedStrArrInplace.js";
|
|
4
3
|
import { getListTypeArg } from "../../types/utils/getListTypeArg.js";
|
|
5
4
|
import { getUnaliased } from "../../types/utils/getUnaliased.js";
|
|
6
|
-
import { _ir_apps } from "../../../../IR/
|
|
5
|
+
import { _ir_apps } from "../../../../IR/IRNodes/IRApp.js";
|
|
6
|
+
import { IRNative } from "../../../../IR/IRNodes/IRNative/index.js";
|
|
7
|
+
import { IRConst } from "../../../../IR/IRNodes/IRConst.js";
|
|
8
|
+
import { compileIRToUPLC } from "../../../../IR/toUPLC/compileIRToUPLC.js";
|
|
7
9
|
export class TirLitArrExpr {
|
|
8
10
|
elems;
|
|
9
11
|
type;
|
|
@@ -16,6 +18,10 @@ export class TirLitArrExpr {
|
|
|
16
18
|
this.type = type;
|
|
17
19
|
this.range = range;
|
|
18
20
|
}
|
|
21
|
+
pretty() { return this.toString(); }
|
|
22
|
+
toString() {
|
|
23
|
+
return `[ ${this.elems.map(e => e.toString()).join(", ")} ]`;
|
|
24
|
+
}
|
|
19
25
|
clone() {
|
|
20
26
|
return new TirLitArrExpr(this.elems.map(e => e.clone()), this.type.clone(), this.range.clone());
|
|
21
27
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SourceRange } from "../../../../ast/Source/SourceRange.js";
|
|
2
|
+
import { IRTerm } from "../../../../IR/index.js";
|
|
3
|
+
import { TirType } from "../../types/TirType.js";
|
|
4
|
+
import { ITirExpr } from "../ITirExpr.js";
|
|
5
|
+
import { TirExpr } from "../TirExpr.js";
|
|
6
|
+
import { ToIRTermCtx } from "../ToIRTermCtx.js";
|
|
7
|
+
export declare class TirLitFailExpr implements ITirExpr {
|
|
8
|
+
readonly range: SourceRange;
|
|
9
|
+
readonly type: TirType;
|
|
10
|
+
readonly isConstant: boolean;
|
|
11
|
+
constructor(range: SourceRange);
|
|
12
|
+
pretty(): string;
|
|
13
|
+
toString(): string;
|
|
14
|
+
clone(): TirExpr;
|
|
15
|
+
deps(): string[];
|
|
16
|
+
toIR(ctx: ToIRTermCtx): IRTerm;
|
|
17
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { IRError } from "../../../../IR/index.js";
|
|
2
|
+
import { void_t } from "../../program/stdScope/stdScope.js";
|
|
3
|
+
export class TirLitFailExpr {
|
|
4
|
+
range;
|
|
5
|
+
type = void_t;
|
|
6
|
+
isConstant = true;
|
|
7
|
+
constructor(range) {
|
|
8
|
+
this.range = range;
|
|
9
|
+
}
|
|
10
|
+
pretty() { return this.toString(); }
|
|
11
|
+
toString() {
|
|
12
|
+
return "fail";
|
|
13
|
+
}
|
|
14
|
+
clone() {
|
|
15
|
+
return new TirLitFailExpr(this.range.clone());
|
|
16
|
+
}
|
|
17
|
+
deps() { return []; }
|
|
18
|
+
toIR(ctx) {
|
|
19
|
+
return new IRError();
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -3,12 +3,15 @@ import { SourceRange } from "../../../../ast/Source/SourceRange.js";
|
|
|
3
3
|
import { TirType } from "../../types/TirType.js";
|
|
4
4
|
import { IRTerm } from "../../../../IR/index.js";
|
|
5
5
|
import { ToIRTermCtx } from "../ToIRTermCtx.js";
|
|
6
|
+
import { TirExpr } from "../TirExpr.js";
|
|
6
7
|
export declare class TirLitFalseExpr implements ITirExpr {
|
|
7
8
|
readonly range: SourceRange;
|
|
8
9
|
readonly type: TirType;
|
|
9
10
|
readonly isConstant: boolean;
|
|
10
11
|
constructor(range: SourceRange);
|
|
11
|
-
|
|
12
|
+
pretty(): string;
|
|
13
|
+
toString(): string;
|
|
14
|
+
clone(): TirExpr;
|
|
12
15
|
deps(): string[];
|
|
13
16
|
toIR(ctx: ToIRTermCtx): IRTerm;
|
|
14
17
|
}
|
|
@@ -3,13 +3,16 @@ import { SourceRange } from "../../../../ast/Source/SourceRange.js";
|
|
|
3
3
|
import { TirType } from "../../types/TirType.js";
|
|
4
4
|
import { IRTerm } from "../../../../IR/index.js";
|
|
5
5
|
import { ToIRTermCtx } from "../ToIRTermCtx.js";
|
|
6
|
+
import { TirExpr } from "../TirExpr.js";
|
|
6
7
|
export declare class TirLitHexBytesExpr implements ITirExpr {
|
|
7
8
|
readonly bytes: Uint8Array;
|
|
8
9
|
readonly range: SourceRange;
|
|
9
10
|
readonly type: TirType;
|
|
10
11
|
readonly isConstant: boolean;
|
|
11
12
|
constructor(bytes: Uint8Array, range: SourceRange);
|
|
12
|
-
|
|
13
|
+
pretty(): string;
|
|
14
|
+
toString(): string;
|
|
15
|
+
clone(): TirExpr;
|
|
13
16
|
deps(): string[];
|
|
14
17
|
toIR(ctx: ToIRTermCtx): IRTerm;
|
|
15
18
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { bytes_t } from "../../program/stdScope/stdScope.js";
|
|
2
2
|
import { IRConst } from "../../../../IR/index.js";
|
|
3
|
+
import { toHex } from "@harmoniclabs/uint8array-utils";
|
|
3
4
|
export class TirLitHexBytesExpr {
|
|
4
5
|
bytes;
|
|
5
6
|
range;
|
|
@@ -9,6 +10,10 @@ export class TirLitHexBytesExpr {
|
|
|
9
10
|
this.bytes = bytes;
|
|
10
11
|
this.range = range;
|
|
11
12
|
}
|
|
13
|
+
pretty() { return this.toString(); }
|
|
14
|
+
toString() {
|
|
15
|
+
return `#${toHex(this.bytes)}`;
|
|
16
|
+
}
|
|
12
17
|
clone() {
|
|
13
18
|
return new TirLitHexBytesExpr(new Uint8Array(this.bytes), this.range.clone());
|
|
14
19
|
}
|