@harmoniclabs/pebble 0.1.0-dev5 → 0.1.0-dev6
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 +0 -2
- package/dist/IR/IRNodes/IRNative/IRNativeTag.js +0 -4
- package/dist/IR/IRNodes/IRNative/index.d.ts +9 -8
- package/dist/IR/IRNodes/IRNative/index.js +55 -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/_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 +75 -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 +67 -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 +43 -0
- package/dist/IR/toUPLC/subRoutines/replaceNatives/nativeToIR.js +255 -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 +39 -25
- package/dist/IR/utils/positiveIntAsBytes.d.ts +1 -0
- package/dist/IR/utils/positiveIntAsBytes.js +4 -0
- 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 +6 -2
- package/dist/compiler/AstCompiler/AstCompiler.js +91 -24
- 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 +1 -1
- 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 +3 -1
- package/dist/compiler/AstCompiler/internal/exprs/_compileUnaryPrefixExpr.js +1 -1
- package/dist/compiler/AstCompiler/internal/statements/_compileAssignmentStmt.js +2 -2
- 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.js +2 -2
- 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.js +4 -3
- package/dist/compiler/AstCompiler/utils/getPropAccessReturnType.js +6 -4
- package/dist/compiler/Compiler.js +3 -1
- package/dist/compiler/TirCompiler/compileTirProgram.js +3 -1
- package/dist/compiler/TirCompiler/expressify/ExpressifyCtx.d.ts +13 -3
- package/dist/compiler/TirCompiler/expressify/ExpressifyCtx.js +41 -37
- package/dist/compiler/TirCompiler/expressify/determineReassignedVariablesAndReturn.js +11 -2
- package/dist/compiler/TirCompiler/expressify/expressify.d.ts +2 -1
- package/dist/compiler/TirCompiler/expressify/expressify.js +82 -36
- package/dist/compiler/TirCompiler/expressify/expressifyForStmt.d.ts +2 -1
- package/dist/compiler/TirCompiler/expressify/expressifyForStmt.js +57 -8
- package/dist/compiler/TirCompiler/expressify/expressifyIfBranch.js +1 -1
- package/dist/compiler/TirCompiler/expressify/expressifyVarAssignmentStmt.js +1 -1
- package/dist/compiler/TirCompiler/expressify/expressifyVarDecl.js +1 -0
- package/dist/compiler/TirCompiler/expressify/expressifyVars.js +131 -9
- package/dist/compiler/TirCompiler/internal/_compileHoistedDeps.js +3 -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 +103 -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 +5 -2
- package/dist/compiler/tir/expressions/TirLettedExpr.js +19 -4
- package/dist/compiler/tir/expressions/TirNativeFunc.d.ts +8 -5
- package/dist/compiler/tir/expressions/TirNativeFunc.js +50 -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 -0
- 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 +7 -3
- package/dist/compiler/tir/expressions/TirVariableAccessExpr.js +17 -7
- package/dist/compiler/tir/expressions/ToIRTermCtx.d.ts +16 -20
- package/dist/compiler/tir/expressions/ToIRTermCtx.js +67 -50
- package/dist/compiler/tir/expressions/binary/TirBinaryExpr.d.ts +40 -0
- package/dist/compiler/tir/expressions/binary/TirBinaryExpr.js +174 -3
- 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 +1 -0
- package/dist/compiler/tir/program/TypedProgram.js +9 -0
- package/dist/compiler/tir/program/stdScope/stdScope.js +126 -126
- 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 +3 -0
- package/dist/compiler/tir/statements/TirIfStmt.js +19 -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 +162 -30
- 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/package.json +2 -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
|
@@ -3,20 +3,20 @@ import { VarDecl } from "../statements/declarations/VarDecl/VarDecl.js";
|
|
|
3
3
|
import { HasSourceRange } from "../HasSourceRange.js";
|
|
4
4
|
import { PebbleExpr } from "./PebbleExpr.js";
|
|
5
5
|
export declare class CaseExpr implements HasSourceRange {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
matchExpr: PebbleExpr;
|
|
7
|
+
cases: CaseExprMatcher[];
|
|
8
|
+
wildcardCase: CaseWildcardMatcher | undefined;
|
|
9
9
|
readonly range: SourceRange;
|
|
10
10
|
constructor(matchExpr: PebbleExpr, cases: CaseExprMatcher[], wildcardCase: CaseWildcardMatcher | undefined, range: SourceRange);
|
|
11
11
|
}
|
|
12
12
|
export declare class CaseExprMatcher implements HasSourceRange {
|
|
13
13
|
readonly pattern: VarDecl;
|
|
14
|
-
|
|
14
|
+
body: PebbleExpr;
|
|
15
15
|
readonly range: SourceRange;
|
|
16
16
|
constructor(pattern: VarDecl, body: PebbleExpr, range: SourceRange);
|
|
17
17
|
}
|
|
18
18
|
export declare class CaseWildcardMatcher implements HasSourceRange {
|
|
19
|
-
|
|
19
|
+
body: PebbleExpr;
|
|
20
20
|
readonly range: SourceRange;
|
|
21
21
|
constructor(body: PebbleExpr, range: SourceRange);
|
|
22
22
|
}
|
|
@@ -5,8 +5,8 @@ import { PebbleExpr } from "./PebbleExpr.js";
|
|
|
5
5
|
* `arrLikeExpr[ indexExpr ]`
|
|
6
6
|
*/
|
|
7
7
|
export declare class ElemAccessExpr implements HasSourceRange {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
arrLikeExpr: PebbleExpr;
|
|
9
|
+
indexExpr: PebbleExpr;
|
|
10
10
|
readonly range: SourceRange;
|
|
11
11
|
constructor(arrLikeExpr: PebbleExpr, indexExpr: PebbleExpr, range: SourceRange);
|
|
12
12
|
}
|
|
@@ -2,7 +2,7 @@ import { SourceRange } from "../../Source/SourceRange.js";
|
|
|
2
2
|
import { HasSourceRange } from "../HasSourceRange.js";
|
|
3
3
|
import { PebbleExpr } from "./PebbleExpr.js";
|
|
4
4
|
export declare class ParentesizedExpr implements HasSourceRange {
|
|
5
|
-
|
|
5
|
+
expr: PebbleExpr;
|
|
6
6
|
readonly range: SourceRange;
|
|
7
7
|
constructor(expr: PebbleExpr, range: SourceRange);
|
|
8
8
|
}
|
|
@@ -5,6 +5,7 @@ import { FuncExpr } from "./functions/FuncExpr.js";
|
|
|
5
5
|
import { LitteralExpr } from "./litteral/LitteralExpr.js";
|
|
6
6
|
import { NonNullExpr } from "./unary/NonNullExpr.js";
|
|
7
7
|
import { ParentesizedExpr } from "./ParentesizedExpr.js";
|
|
8
|
+
import { PropAccessExpr } from "./PropAccessExpr.js";
|
|
8
9
|
import { TernaryExpr } from "./TernaryExpr.js";
|
|
9
10
|
import { TypeConversionExpr } from "./TypeConversionExpr.js";
|
|
10
11
|
import { UnaryPrefixExpr } from "./unary/UnaryPrefixExpr.js";
|
|
@@ -14,5 +15,5 @@ import { BinaryExpr } from "./binary/BinaryExpr.js";
|
|
|
14
15
|
* an expression is anything that can be evaluated to a value
|
|
15
16
|
* it must therefore have a type
|
|
16
17
|
*/
|
|
17
|
-
export type PebbleExpr = UnaryPrefixExpr | NonNullExpr | LitteralExpr | ParentesizedExpr | FuncExpr | CallExpr | CaseExpr | TypeConversionExpr | NonNullExpr | ElemAccessExpr | TernaryExpr | Identifier | BinaryExpr;
|
|
18
|
+
export type PebbleExpr = UnaryPrefixExpr | NonNullExpr | LitteralExpr | ParentesizedExpr | FuncExpr | CallExpr | CaseExpr | TypeConversionExpr | NonNullExpr | ElemAccessExpr | TernaryExpr | Identifier | BinaryExpr | PropAccessExpr;
|
|
18
19
|
export declare function isPebbleExpr(thing: any): thing is PebbleExpr;
|
|
@@ -9,19 +9,19 @@ export type PropAccessTokenToExpr<T extends PropAccessToken> = T extends Token.Q
|
|
|
9
9
|
export declare function makePropAccessExpr<T extends PropAccessToken>(token: T, object: PebbleExpr, prop: Identifier, range: SourceRange): PropAccessTokenToExpr<T>;
|
|
10
10
|
export declare function isPropAccessExpr(thing: any): thing is PropAccessExpr;
|
|
11
11
|
export declare class OptionalPropAccessExpr implements HasSourceRange {
|
|
12
|
-
|
|
12
|
+
object: PebbleExpr;
|
|
13
13
|
readonly prop: Identifier;
|
|
14
14
|
readonly range: SourceRange;
|
|
15
15
|
constructor(object: PebbleExpr, prop: Identifier, range: SourceRange);
|
|
16
16
|
}
|
|
17
17
|
export declare class NonNullPropAccessExpr implements HasSourceRange {
|
|
18
|
-
|
|
18
|
+
object: PebbleExpr;
|
|
19
19
|
readonly prop: Identifier;
|
|
20
20
|
readonly range: SourceRange;
|
|
21
21
|
constructor(object: PebbleExpr, prop: Identifier, range: SourceRange);
|
|
22
22
|
}
|
|
23
23
|
export declare class DotPropAccessExpr implements HasSourceRange {
|
|
24
|
-
|
|
24
|
+
object: PebbleExpr;
|
|
25
25
|
readonly prop: Identifier;
|
|
26
26
|
readonly range: SourceRange;
|
|
27
27
|
constructor(object: PebbleExpr, prop: Identifier, range: SourceRange);
|
|
@@ -2,9 +2,9 @@ import { SourceRange } from "../../Source/SourceRange.js";
|
|
|
2
2
|
import { HasSourceRange } from "../HasSourceRange.js";
|
|
3
3
|
import { PebbleExpr } from "./PebbleExpr.js";
|
|
4
4
|
export declare class TernaryExpr implements HasSourceRange {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
condition: PebbleExpr;
|
|
6
|
+
ifTrue: PebbleExpr;
|
|
7
|
+
ifFalse: PebbleExpr;
|
|
8
8
|
readonly range: SourceRange;
|
|
9
9
|
constructor(condition: PebbleExpr, ifTrue: PebbleExpr, ifFalse: PebbleExpr, range: SourceRange);
|
|
10
10
|
}
|
|
@@ -3,8 +3,9 @@ import { HasSourceRange } from "../HasSourceRange.js";
|
|
|
3
3
|
import { AstTypeExpr } from "../types/AstTypeExpr.js";
|
|
4
4
|
import { PebbleExpr } from "./PebbleExpr.js";
|
|
5
5
|
export declare class TypeConversionExpr implements HasSourceRange {
|
|
6
|
-
|
|
6
|
+
expr: PebbleExpr;
|
|
7
7
|
readonly asType: AstTypeExpr;
|
|
8
8
|
readonly range: SourceRange;
|
|
9
|
+
private _creationStack;
|
|
9
10
|
constructor(expr: PebbleExpr, asType: AstTypeExpr, range?: SourceRange);
|
|
10
11
|
}
|
|
@@ -3,9 +3,11 @@ export class TypeConversionExpr {
|
|
|
3
3
|
expr;
|
|
4
4
|
asType;
|
|
5
5
|
range;
|
|
6
|
+
_creationStack;
|
|
6
7
|
constructor(expr, asType, range = SourceRange.join(expr.range, asType.range)) {
|
|
7
8
|
this.expr = expr;
|
|
8
9
|
this.asType = asType;
|
|
9
10
|
this.range = range;
|
|
11
|
+
this._creationStack = new Error().stack;
|
|
10
12
|
}
|
|
11
13
|
}
|
|
@@ -8,126 +8,126 @@ export type BinaryTokenToExpr<T extends BinaryExprToken> = T extends Token.Aster
|
|
|
8
8
|
export declare function makeBinaryExpr<T extends BinaryExprToken>(token: T, left: PebbleExpr, right: PebbleExpr, range: SourceRange): BinaryTokenToExpr<T>;
|
|
9
9
|
export declare function isBinaryExpr(thing: any): thing is BinaryExpr;
|
|
10
10
|
export interface IBinaryExpr extends HasSourceRange {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
left: PebbleExpr;
|
|
12
|
+
right: PebbleExpr;
|
|
13
13
|
}
|
|
14
14
|
export declare class ExponentiationExpr implements IBinaryExpr {
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
left: PebbleExpr;
|
|
16
|
+
right: PebbleExpr;
|
|
17
17
|
readonly range: SourceRange;
|
|
18
18
|
constructor(left: PebbleExpr, right: PebbleExpr, range: SourceRange);
|
|
19
19
|
}
|
|
20
20
|
export declare class LessThanExpr implements IBinaryExpr {
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
left: PebbleExpr;
|
|
22
|
+
right: PebbleExpr;
|
|
23
23
|
readonly range: SourceRange;
|
|
24
24
|
constructor(left: PebbleExpr, right: PebbleExpr, range: SourceRange);
|
|
25
25
|
}
|
|
26
26
|
export declare class GreaterThanExpr implements IBinaryExpr {
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
left: PebbleExpr;
|
|
28
|
+
right: PebbleExpr;
|
|
29
29
|
readonly range: SourceRange;
|
|
30
30
|
constructor(left: PebbleExpr, right: PebbleExpr, range: SourceRange);
|
|
31
31
|
}
|
|
32
32
|
export declare class LessThanEqualExpr implements IBinaryExpr {
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
left: PebbleExpr;
|
|
34
|
+
right: PebbleExpr;
|
|
35
35
|
readonly range: SourceRange;
|
|
36
36
|
constructor(left: PebbleExpr, right: PebbleExpr, range: SourceRange);
|
|
37
37
|
}
|
|
38
38
|
export declare class GreaterThanEqualExpr implements IBinaryExpr {
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
left: PebbleExpr;
|
|
40
|
+
right: PebbleExpr;
|
|
41
41
|
readonly range: SourceRange;
|
|
42
42
|
constructor(left: PebbleExpr, right: PebbleExpr, range: SourceRange);
|
|
43
43
|
}
|
|
44
44
|
export declare class EqualExpr implements IBinaryExpr {
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
left: PebbleExpr;
|
|
46
|
+
right: PebbleExpr;
|
|
47
47
|
readonly range: SourceRange;
|
|
48
48
|
constructor(left: PebbleExpr, right: PebbleExpr, range: SourceRange);
|
|
49
49
|
}
|
|
50
50
|
export declare class NotEqualExpr implements IBinaryExpr {
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
left: PebbleExpr;
|
|
52
|
+
right: PebbleExpr;
|
|
53
53
|
readonly range: SourceRange;
|
|
54
54
|
constructor(left: PebbleExpr, right: PebbleExpr, range: SourceRange);
|
|
55
55
|
}
|
|
56
56
|
export declare class AddExpr implements IBinaryExpr {
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
left: PebbleExpr;
|
|
58
|
+
right: PebbleExpr;
|
|
59
59
|
readonly range: SourceRange;
|
|
60
60
|
constructor(left: PebbleExpr, right: PebbleExpr, range: SourceRange);
|
|
61
61
|
}
|
|
62
62
|
export declare class SubExpr implements IBinaryExpr {
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
left: PebbleExpr;
|
|
64
|
+
right: PebbleExpr;
|
|
65
65
|
readonly range: SourceRange;
|
|
66
66
|
constructor(left: PebbleExpr, right: PebbleExpr, range: SourceRange);
|
|
67
67
|
}
|
|
68
68
|
export declare class MultExpr implements IBinaryExpr {
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
left: PebbleExpr;
|
|
70
|
+
right: PebbleExpr;
|
|
71
71
|
readonly range: SourceRange;
|
|
72
72
|
constructor(left: PebbleExpr, right: PebbleExpr, range: SourceRange);
|
|
73
73
|
}
|
|
74
74
|
export declare class DivExpr implements IBinaryExpr {
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
left: PebbleExpr;
|
|
76
|
+
right: PebbleExpr;
|
|
77
77
|
readonly range: SourceRange;
|
|
78
78
|
constructor(left: PebbleExpr, right: PebbleExpr, range: SourceRange);
|
|
79
79
|
}
|
|
80
80
|
export declare class ModuloExpr implements IBinaryExpr {
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
left: PebbleExpr;
|
|
82
|
+
right: PebbleExpr;
|
|
83
83
|
readonly range: SourceRange;
|
|
84
84
|
constructor(left: PebbleExpr, right: PebbleExpr, range: SourceRange);
|
|
85
85
|
}
|
|
86
86
|
export declare class ShiftLeftExpr implements IBinaryExpr {
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
left: PebbleExpr;
|
|
88
|
+
right: PebbleExpr;
|
|
89
89
|
readonly range: SourceRange;
|
|
90
90
|
constructor(left: PebbleExpr, right: PebbleExpr, range: SourceRange);
|
|
91
91
|
}
|
|
92
92
|
export declare class ShiftRightExpr implements IBinaryExpr {
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
left: PebbleExpr;
|
|
94
|
+
right: PebbleExpr;
|
|
95
95
|
readonly range: SourceRange;
|
|
96
96
|
constructor(left: PebbleExpr, right: PebbleExpr, range: SourceRange);
|
|
97
97
|
}
|
|
98
98
|
export declare class BitwiseAndExpr implements IBinaryExpr {
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
left: PebbleExpr;
|
|
100
|
+
right: PebbleExpr;
|
|
101
101
|
readonly range: SourceRange;
|
|
102
102
|
constructor(left: PebbleExpr, right: PebbleExpr, range: SourceRange);
|
|
103
103
|
}
|
|
104
104
|
export declare class BitwiseXorExpr implements IBinaryExpr {
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
left: PebbleExpr;
|
|
106
|
+
right: PebbleExpr;
|
|
107
107
|
readonly range: SourceRange;
|
|
108
108
|
constructor(left: PebbleExpr, right: PebbleExpr, range: SourceRange);
|
|
109
109
|
}
|
|
110
110
|
export declare class BitwiseOrExpr implements IBinaryExpr {
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
left: PebbleExpr;
|
|
112
|
+
right: PebbleExpr;
|
|
113
113
|
readonly range: SourceRange;
|
|
114
114
|
constructor(left: PebbleExpr, right: PebbleExpr, range: SourceRange);
|
|
115
115
|
}
|
|
116
116
|
export declare class LogicalAndExpr implements IBinaryExpr {
|
|
117
|
-
|
|
118
|
-
|
|
117
|
+
left: PebbleExpr;
|
|
118
|
+
right: PebbleExpr;
|
|
119
119
|
readonly range: SourceRange;
|
|
120
120
|
constructor(left: PebbleExpr, right: PebbleExpr, range: SourceRange);
|
|
121
121
|
}
|
|
122
122
|
export declare class LogicalOrExpr implements IBinaryExpr {
|
|
123
|
-
|
|
124
|
-
|
|
123
|
+
left: PebbleExpr;
|
|
124
|
+
right: PebbleExpr;
|
|
125
125
|
readonly range: SourceRange;
|
|
126
126
|
constructor(left: PebbleExpr, right: PebbleExpr, range: SourceRange);
|
|
127
127
|
}
|
|
128
128
|
export declare class OptionalDefaultExpr implements IBinaryExpr {
|
|
129
|
-
|
|
130
|
-
|
|
129
|
+
left: PebbleExpr;
|
|
130
|
+
right: PebbleExpr;
|
|
131
131
|
readonly range: SourceRange;
|
|
132
132
|
constructor(left: PebbleExpr, right: PebbleExpr, range: SourceRange);
|
|
133
133
|
}
|
|
@@ -4,7 +4,7 @@ import { AstTypeExpr } from "../../types/AstTypeExpr.js";
|
|
|
4
4
|
import { PebbleExpr } from "../PebbleExpr.js";
|
|
5
5
|
export declare class CallExpr implements HasSourceRange {
|
|
6
6
|
/** any expression that yeidls a function */
|
|
7
|
-
|
|
7
|
+
funcExpr: PebbleExpr;
|
|
8
8
|
/** if the function is generic */
|
|
9
9
|
readonly genericTypeArgs: AstTypeExpr[] | undefined;
|
|
10
10
|
readonly args: PebbleExpr[];
|
|
@@ -14,8 +14,9 @@ export declare class FuncExpr implements HasSourceRange {
|
|
|
14
14
|
readonly flags: CommonFlags;
|
|
15
15
|
readonly typeParams: Identifier[];
|
|
16
16
|
readonly signature: AstFuncType;
|
|
17
|
-
|
|
17
|
+
body: BlockStmt | PebbleExpr;
|
|
18
18
|
readonly arrowKind: ArrowKind;
|
|
19
19
|
readonly range: SourceRange;
|
|
20
20
|
constructor(name: Identifier, flags: CommonFlags, typeParams: Identifier[], signature: AstFuncType, body: BlockStmt | PebbleExpr, arrowKind: ArrowKind, range: SourceRange);
|
|
21
|
+
bodyBlockStmt(): BlockStmt;
|
|
21
22
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { BlockStmt } from "../../statements/BlockStmt.js";
|
|
2
|
+
import { ReturnStmt } from "../../statements/ReturnStmt.js";
|
|
1
3
|
/**
|
|
2
4
|
* a litteral function value
|
|
3
5
|
**/
|
|
@@ -18,4 +20,8 @@ export class FuncExpr {
|
|
|
18
20
|
this.arrowKind = arrowKind;
|
|
19
21
|
this.range = range;
|
|
20
22
|
}
|
|
23
|
+
bodyBlockStmt() {
|
|
24
|
+
return (this.body instanceof BlockStmt ? this.body :
|
|
25
|
+
new BlockStmt([new ReturnStmt(this.body, this.body.range)], this.body.range));
|
|
26
|
+
}
|
|
21
27
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { LitArrExpr } from "./LitArrExpr.js";
|
|
2
|
+
import { LitContextExpr } from "./LitContextExpr.js";
|
|
3
|
+
import { LitFailExpr } from "./LitFailExpr.js";
|
|
2
4
|
import { LitFalseExpr } from "./LitFalseExpr.js";
|
|
3
5
|
import { LitHexBytesExpr } from "./LitHexBytesExpr.js";
|
|
4
6
|
import { LitIntExpr } from "./LitIntExpr.js";
|
|
@@ -9,5 +11,5 @@ import { LitThisExpr } from "./LitThisExpr.js";
|
|
|
9
11
|
import { LitTrueExpr } from "./LitTrueExpr.js";
|
|
10
12
|
import { LitUndefExpr } from "./LitUndefExpr.js";
|
|
11
13
|
import { LitVoidExpr } from "./LitVoidExpr.js";
|
|
12
|
-
export type LitteralExpr = LitVoidExpr | LitUndefExpr | LitTrueExpr | LitFalseExpr | LitThisExpr | LitArrExpr | LitObjExpr | LitNamedObjExpr | LitStrExpr | LitIntExpr | LitHexBytesExpr;
|
|
14
|
+
export type LitteralExpr = LitVoidExpr | LitUndefExpr | LitTrueExpr | LitFalseExpr | LitThisExpr | LitContextExpr | LitArrExpr | LitObjExpr | LitNamedObjExpr | LitStrExpr | LitIntExpr | LitHexBytesExpr | LitFailExpr;
|
|
13
15
|
export declare function isLitteralExpr(thing: any): thing is LitteralExpr;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { LitArrExpr } from "./LitArrExpr.js";
|
|
2
|
+
import { LitContextExpr } from "./LitContextExpr.js";
|
|
3
|
+
import { LitFailExpr } from "./LitFailExpr.js";
|
|
2
4
|
import { LitFalseExpr } from "./LitFalseExpr.js";
|
|
3
5
|
import { LitHexBytesExpr } from "./LitHexBytesExpr.js";
|
|
4
6
|
import { LitIntExpr } from "./LitIntExpr.js";
|
|
@@ -15,10 +17,12 @@ export function isLitteralExpr(thing) {
|
|
|
15
17
|
|| thing instanceof LitTrueExpr
|
|
16
18
|
|| thing instanceof LitFalseExpr
|
|
17
19
|
|| thing instanceof LitThisExpr
|
|
20
|
+
|| thing instanceof LitContextExpr
|
|
18
21
|
|| thing instanceof LitArrExpr
|
|
19
22
|
|| thing instanceof LitObjExpr
|
|
20
23
|
|| thing instanceof LitNamedObjExpr
|
|
21
24
|
|| thing instanceof LitStrExpr
|
|
22
25
|
|| thing instanceof LitIntExpr
|
|
23
|
-
|| thing instanceof LitHexBytesExpr
|
|
26
|
+
|| thing instanceof LitHexBytesExpr
|
|
27
|
+
|| thing instanceof LitFailExpr);
|
|
24
28
|
}
|
|
@@ -3,9 +3,9 @@ import { PebbleExpr } from "../expr/PebbleExpr.js";
|
|
|
3
3
|
import { HasSourceRange } from "../HasSourceRange.js";
|
|
4
4
|
export declare class AssertStmt implements HasSourceRange {
|
|
5
5
|
/** must be boolean or Optional */
|
|
6
|
-
|
|
6
|
+
condition: PebbleExpr;
|
|
7
7
|
/** must be string */
|
|
8
|
-
|
|
8
|
+
elseExpr: PebbleExpr | undefined;
|
|
9
9
|
readonly range: SourceRange;
|
|
10
10
|
constructor(
|
|
11
11
|
/** must be boolean or Optional */
|
|
@@ -39,7 +39,7 @@ export declare class SubAssignmentStmt implements IAssignmentStmt {
|
|
|
39
39
|
}
|
|
40
40
|
export declare class ExpAssignmentStmt implements IAssignmentStmt {
|
|
41
41
|
readonly varIdentifier: Identifier;
|
|
42
|
-
|
|
42
|
+
assignedExpr: PebbleExpr;
|
|
43
43
|
readonly range: SourceRange;
|
|
44
44
|
constructor(varIdentifier: Identifier, assignedExpr: PebbleExpr, range: SourceRange);
|
|
45
45
|
}
|
|
@@ -2,7 +2,7 @@ import { SourceRange } from "../../Source/SourceRange.js";
|
|
|
2
2
|
import { HasSourceRange } from "../HasSourceRange.js";
|
|
3
3
|
import { BodyStmt } from "./PebbleStmt.js";
|
|
4
4
|
export declare class BlockStmt implements HasSourceRange {
|
|
5
|
-
|
|
5
|
+
stmts: BodyStmt[];
|
|
6
6
|
readonly range: SourceRange;
|
|
7
7
|
constructor(stmts: BodyStmt[], range: SourceRange);
|
|
8
8
|
}
|
|
@@ -3,7 +3,7 @@ import { PebbleExpr } from "../expr/PebbleExpr.js";
|
|
|
3
3
|
import { HasSourceRange } from "../HasSourceRange.js";
|
|
4
4
|
export declare class FailStmt implements HasSourceRange {
|
|
5
5
|
/** must be string (or utf8 bytes) */
|
|
6
|
-
|
|
6
|
+
value: PebbleExpr | undefined;
|
|
7
7
|
readonly range: SourceRange;
|
|
8
8
|
constructor(
|
|
9
9
|
/** must be string (or utf8 bytes) */
|
|
@@ -2,6 +2,7 @@ import { PebbleAst } from "../../PebbleAst.js";
|
|
|
2
2
|
import { SourceRange } from "../../Source/SourceRange.js";
|
|
3
3
|
import { PebbleExpr } from "../expr/PebbleExpr.js";
|
|
4
4
|
import { HasSourceRange } from "../HasSourceRange.js";
|
|
5
|
+
import { BlockStmt } from "./BlockStmt.js";
|
|
5
6
|
import { VarDecl } from "./declarations/VarDecl/VarDecl.js";
|
|
6
7
|
import { VarStmt } from "./VarStmt.js";
|
|
7
8
|
/**
|
|
@@ -9,8 +10,9 @@ import { VarStmt } from "./VarStmt.js";
|
|
|
9
10
|
*/
|
|
10
11
|
export declare class ForOfStmt implements HasSourceRange {
|
|
11
12
|
readonly elemDeclaration: VarStmt<[VarDecl]>;
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
iterable: PebbleExpr;
|
|
14
|
+
body: PebbleAst;
|
|
14
15
|
readonly range: SourceRange;
|
|
15
16
|
constructor(elemDeclaration: VarStmt<[VarDecl]>, iterable: PebbleExpr, body: PebbleAst, range: SourceRange);
|
|
17
|
+
bodyBlock(): BlockStmt;
|
|
16
18
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BlockStmt } from "./BlockStmt.js";
|
|
1
2
|
/**
|
|
2
3
|
* for( `elemDeclaration` of iterable ) body
|
|
3
4
|
*/
|
|
@@ -12,4 +13,9 @@ export class ForOfStmt {
|
|
|
12
13
|
this.body = body;
|
|
13
14
|
this.range = range;
|
|
14
15
|
}
|
|
16
|
+
bodyBlock() {
|
|
17
|
+
if (this.body instanceof BlockStmt)
|
|
18
|
+
return this.body;
|
|
19
|
+
return new BlockStmt([this.body], this.body.range);
|
|
20
|
+
}
|
|
15
21
|
}
|
|
@@ -2,6 +2,7 @@ import { SourceRange } from "../../Source/SourceRange.js";
|
|
|
2
2
|
import { PebbleExpr } from "../expr/PebbleExpr.js";
|
|
3
3
|
import { HasSourceRange } from "../HasSourceRange.js";
|
|
4
4
|
import { AssignmentStmt } from "./AssignmentStmt.js";
|
|
5
|
+
import { BlockStmt } from "./BlockStmt.js";
|
|
5
6
|
import { BodyStmt } from "./PebbleStmt.js";
|
|
6
7
|
import { VarStmt } from "./VarStmt.js";
|
|
7
8
|
/**
|
|
@@ -10,10 +11,11 @@ import { VarStmt } from "./VarStmt.js";
|
|
|
10
11
|
* for( init; condition; update ) body
|
|
11
12
|
*/
|
|
12
13
|
export declare class ForStmt implements HasSourceRange {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
init: VarStmt | undefined;
|
|
15
|
+
condition: PebbleExpr | undefined;
|
|
16
|
+
updates: AssignmentStmt[];
|
|
17
|
+
body: BodyStmt;
|
|
17
18
|
readonly range: SourceRange;
|
|
18
19
|
constructor(init: VarStmt | undefined, condition: PebbleExpr | undefined, updates: AssignmentStmt[], body: BodyStmt, range: SourceRange);
|
|
20
|
+
bodyBlock(): BlockStmt;
|
|
19
21
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BlockStmt } from "./BlockStmt.js";
|
|
1
2
|
/**
|
|
2
3
|
* ***NOT*** for...of loop
|
|
3
4
|
*
|
|
@@ -16,4 +17,9 @@ export class ForStmt {
|
|
|
16
17
|
this.body = body;
|
|
17
18
|
this.range = range;
|
|
18
19
|
}
|
|
20
|
+
bodyBlock() {
|
|
21
|
+
if (this.body instanceof BlockStmt)
|
|
22
|
+
return this.body;
|
|
23
|
+
return new BlockStmt([this.body], this.body.range);
|
|
24
|
+
}
|
|
19
25
|
}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { PebbleAst } from "../../PebbleAst.js";
|
|
2
1
|
import { SourceRange } from "../../Source/SourceRange.js";
|
|
3
2
|
import { PebbleExpr } from "../expr/PebbleExpr.js";
|
|
4
3
|
import { HasSourceRange } from "../HasSourceRange.js";
|
|
4
|
+
import { BlockStmt } from "./BlockStmt.js";
|
|
5
|
+
import { BodyStmt } from "./PebbleStmt.js";
|
|
5
6
|
export declare class IfStmt implements HasSourceRange {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
condition: PebbleExpr;
|
|
8
|
+
thenBranch: BodyStmt;
|
|
9
|
+
elseBranch: BodyStmt | undefined;
|
|
9
10
|
readonly range: SourceRange;
|
|
10
|
-
constructor(condition: PebbleExpr, thenBranch:
|
|
11
|
+
constructor(condition: PebbleExpr, thenBranch: BodyStmt, elseBranch: BodyStmt | undefined, range: SourceRange);
|
|
12
|
+
thenBranchBlock(): BlockStmt;
|
|
13
|
+
elseBranchBlock(): BlockStmt | undefined;
|
|
11
14
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BlockStmt } from "./BlockStmt.js";
|
|
1
2
|
export class IfStmt {
|
|
2
3
|
condition;
|
|
3
4
|
thenBranch;
|
|
@@ -9,4 +10,16 @@ export class IfStmt {
|
|
|
9
10
|
this.elseBranch = elseBranch;
|
|
10
11
|
this.range = range;
|
|
11
12
|
}
|
|
13
|
+
thenBranchBlock() {
|
|
14
|
+
if (this.thenBranch instanceof BlockStmt)
|
|
15
|
+
return this.thenBranch;
|
|
16
|
+
return new BlockStmt([this.thenBranch], this.thenBranch.range);
|
|
17
|
+
}
|
|
18
|
+
elseBranchBlock() {
|
|
19
|
+
if (!this.elseBranch)
|
|
20
|
+
return undefined;
|
|
21
|
+
if (this.elseBranch instanceof BlockStmt)
|
|
22
|
+
return this.elseBranch;
|
|
23
|
+
return new BlockStmt([this.elseBranch], this.elseBranch.range);
|
|
24
|
+
}
|
|
12
25
|
}
|
|
@@ -3,15 +3,24 @@ import { VarDecl } from "./declarations/VarDecl/VarDecl.js";
|
|
|
3
3
|
import { PebbleExpr } from "../expr/PebbleExpr.js";
|
|
4
4
|
import { HasSourceRange } from "../HasSourceRange.js";
|
|
5
5
|
import { BodyStmt } from "./PebbleStmt.js";
|
|
6
|
+
import { BlockStmt } from "./BlockStmt.js";
|
|
6
7
|
export declare class MatchStmt implements HasSourceRange {
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
matchExpr: PebbleExpr;
|
|
9
|
+
cases: MatchStmtCase[];
|
|
10
|
+
elseCase: MatchStmtElseCase | undefined;
|
|
9
11
|
readonly range: SourceRange;
|
|
10
|
-
constructor(matchExpr: PebbleExpr, cases: MatchStmtCase[], range: SourceRange);
|
|
12
|
+
constructor(matchExpr: PebbleExpr, cases: MatchStmtCase[], elseCase: MatchStmtElseCase | undefined, range: SourceRange);
|
|
11
13
|
}
|
|
12
14
|
export declare class MatchStmtCase implements HasSourceRange {
|
|
13
15
|
readonly pattern: VarDecl;
|
|
14
|
-
|
|
16
|
+
body: BodyStmt;
|
|
15
17
|
readonly range: SourceRange;
|
|
16
18
|
constructor(pattern: VarDecl, body: BodyStmt, range: SourceRange);
|
|
19
|
+
bodyBlockStmt(): BlockStmt;
|
|
20
|
+
}
|
|
21
|
+
export declare class MatchStmtElseCase implements HasSourceRange {
|
|
22
|
+
body: BodyStmt;
|
|
23
|
+
readonly range: SourceRange;
|
|
24
|
+
constructor(body: BodyStmt, range: SourceRange);
|
|
25
|
+
bodyBlockStmt(): BlockStmt;
|
|
17
26
|
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import { BlockStmt } from "./BlockStmt.js";
|
|
1
2
|
export class MatchStmt {
|
|
2
3
|
matchExpr;
|
|
3
4
|
cases;
|
|
5
|
+
elseCase;
|
|
4
6
|
range;
|
|
5
|
-
constructor(matchExpr, cases, range) {
|
|
7
|
+
constructor(matchExpr, cases, elseCase, range) {
|
|
6
8
|
this.matchExpr = matchExpr;
|
|
7
9
|
this.cases = cases;
|
|
10
|
+
this.elseCase = elseCase;
|
|
8
11
|
this.range = range;
|
|
9
12
|
}
|
|
10
13
|
}
|
|
@@ -17,4 +20,22 @@ export class MatchStmtCase {
|
|
|
17
20
|
this.body = body;
|
|
18
21
|
this.range = range;
|
|
19
22
|
}
|
|
23
|
+
bodyBlockStmt() {
|
|
24
|
+
if (this.body instanceof BlockStmt)
|
|
25
|
+
return this.body;
|
|
26
|
+
return new BlockStmt([this.body], this.body.range);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export class MatchStmtElseCase {
|
|
30
|
+
body;
|
|
31
|
+
range;
|
|
32
|
+
constructor(body, range) {
|
|
33
|
+
this.body = body;
|
|
34
|
+
this.range = range;
|
|
35
|
+
}
|
|
36
|
+
bodyBlockStmt() {
|
|
37
|
+
if (this.body instanceof BlockStmt)
|
|
38
|
+
return this.body;
|
|
39
|
+
return new BlockStmt([this.body], this.body.range);
|
|
40
|
+
}
|
|
20
41
|
}
|
|
@@ -23,7 +23,8 @@ import { UsingStmt } from "./UsingStmt.js";
|
|
|
23
23
|
import { FuncDecl } from "./declarations/FuncDecl.js";
|
|
24
24
|
import { ExportStmt } from "./ExportStmt.js";
|
|
25
25
|
import { InterfaceDecl } from "./declarations/InterfaceDecl.js";
|
|
26
|
-
|
|
26
|
+
import { ContractDecl } from "./declarations/ContractDecl.js";
|
|
27
|
+
export type TopLevelStmt = EmptyStmt | VarStmt | PebbleTypeDecl | InterfaceDecl | FuncDecl | TestStmt | ExportStmt | ExportStarStmt | ExportImportStmt | ImportStmt | ImportStarStmt | TypeImplementsStmt | UsingStmt | ContractDecl;
|
|
27
28
|
export declare function isTopLevelStmt(stmt: any): stmt is TopLevelStmt;
|
|
28
29
|
export type BodyStmt = IfStmt | VarStmt | ForStmt | ForOfStmt | WhileStmt | ReturnStmt | BlockStmt | BreakStmt | ContinueStmt | EmptyStmt | FailStmt | AssertStmt | MatchStmt | AssignmentStmt | UsingStmt;
|
|
29
30
|
export declare function isBodyStmt(stmt: any): stmt is BodyStmt;
|