@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
|
@@ -14,6 +14,36 @@ export class TirArrayLikeDeconstr {
|
|
|
14
14
|
this.isConst = isConst;
|
|
15
15
|
this.range = range;
|
|
16
16
|
}
|
|
17
|
+
toString() {
|
|
18
|
+
return (`${this.isConst ? "const" : "let"} ` +
|
|
19
|
+
`[ ` +
|
|
20
|
+
this.elements
|
|
21
|
+
.map((decl) => decl.toString()).join(", ") +
|
|
22
|
+
(this.rest ? `, ...${this.rest}` : "") +
|
|
23
|
+
` }` +
|
|
24
|
+
(this.initExpr ? ` = ${this.initExpr.toString()}` : ""));
|
|
25
|
+
}
|
|
26
|
+
pretty(indent) {
|
|
27
|
+
const singleIndent = " ";
|
|
28
|
+
const indent_base = singleIndent.repeat(indent);
|
|
29
|
+
const indent_0 = "\n" + indent_base;
|
|
30
|
+
const indent_1 = indent_0 + singleIndent;
|
|
31
|
+
const elemEntries = this.elements.map((decl) => decl.pretty(indent + 1));
|
|
32
|
+
const elemsPart = elemEntries.length === 0
|
|
33
|
+
? ""
|
|
34
|
+
: indent_1 + elemEntries.join(`,${indent_1}`);
|
|
35
|
+
const restPart = this.rest
|
|
36
|
+
? (elemEntries.length === 0 ? indent_1 : `,${indent_1}`) + `...${this.rest}`
|
|
37
|
+
: "";
|
|
38
|
+
const closing = elemEntries.length === 0 && !this.rest
|
|
39
|
+
? " [ ]"
|
|
40
|
+
: `${indent_0}]`;
|
|
41
|
+
return (`${this.isConst ? "const" : "let"} [` +
|
|
42
|
+
elemsPart +
|
|
43
|
+
restPart +
|
|
44
|
+
closing +
|
|
45
|
+
(this.initExpr ? ` = ${this.initExpr.pretty(indent)}` : ""));
|
|
46
|
+
}
|
|
17
47
|
deps() {
|
|
18
48
|
return this.initExpr?.deps() ?? [];
|
|
19
49
|
}
|
|
@@ -8,13 +8,15 @@ export declare class TirNamedDeconstructVarDecl implements ITirStmt, ITirVarDecl
|
|
|
8
8
|
readonly constrName: string;
|
|
9
9
|
readonly fields: Map<string, TirVarDecl>;
|
|
10
10
|
readonly rest: string | undefined;
|
|
11
|
-
|
|
11
|
+
type: TirType;
|
|
12
12
|
initExpr: TirExpr | undefined;
|
|
13
13
|
isConst: boolean;
|
|
14
14
|
readonly range: SourceRange;
|
|
15
15
|
constructor(
|
|
16
16
|
/** only original (not aliased) constr name used in destructuring */
|
|
17
17
|
constrName: string, fields: Map<string, TirVarDecl>, rest: string | undefined, type: TirType, initExpr: TirExpr | undefined, isConst: boolean, range: SourceRange);
|
|
18
|
+
toString(): string;
|
|
19
|
+
pretty(indent: number): string;
|
|
18
20
|
deps(): string[];
|
|
19
21
|
definitelyTerminates(): boolean;
|
|
20
22
|
introducedVars(): string[];
|
|
@@ -18,6 +18,34 @@ export class TirNamedDeconstructVarDecl {
|
|
|
18
18
|
this.isConst = isConst;
|
|
19
19
|
this.range = range;
|
|
20
20
|
}
|
|
21
|
+
toString() {
|
|
22
|
+
return (`${this.isConst ? "const" : "let"} ` +
|
|
23
|
+
`${this.constrName}{ ` +
|
|
24
|
+
Array.from(this.fields.entries())
|
|
25
|
+
.map(([name, decl]) => `${name}: ${decl.toString()}`).join(", ") +
|
|
26
|
+
(this.rest ? `, ...${this.rest}` : "") +
|
|
27
|
+
` }` +
|
|
28
|
+
(this.initExpr ? ` = ${this.initExpr.toString()}` : ""));
|
|
29
|
+
}
|
|
30
|
+
pretty(indent) {
|
|
31
|
+
const singleIndent = " ";
|
|
32
|
+
const indent_base = singleIndent.repeat(indent);
|
|
33
|
+
const indent_0 = "\n" + indent_base;
|
|
34
|
+
const indent_1 = indent_0 + singleIndent;
|
|
35
|
+
const fieldEntries = Array.from(this.fields.entries()).map(([name, decl]) => `${name}: ${decl.pretty(indent + 1)}`);
|
|
36
|
+
const fieldsPart = fieldEntries.length === 0
|
|
37
|
+
? ""
|
|
38
|
+
: indent_1 + fieldEntries.join(`,${indent_1}`);
|
|
39
|
+
const restPart = this.rest
|
|
40
|
+
? (fieldEntries.length === 0 ? indent_1 : `,${indent_1}`) + `...${this.rest}`
|
|
41
|
+
: "";
|
|
42
|
+
const closing = fieldEntries.length === 0 && !this.rest ? " { }" : `${indent_0}}`;
|
|
43
|
+
return (`${this.isConst ? "const" : "let"} ${this.constrName}{` +
|
|
44
|
+
fieldsPart +
|
|
45
|
+
restPart +
|
|
46
|
+
closing +
|
|
47
|
+
(this.initExpr ? ` = ${this.initExpr.pretty(indent)}` : ""));
|
|
48
|
+
}
|
|
21
49
|
deps() {
|
|
22
50
|
return this.initExpr?.deps() ?? [];
|
|
23
51
|
}
|
|
@@ -11,6 +11,9 @@ export declare class TirSimpleVarDecl implements ITirStmt, ITirVarDecl {
|
|
|
11
11
|
readonly range: SourceRange;
|
|
12
12
|
constructor(name: string, type: TirType, initExpr: TirExpr | undefined, // deconstructed OR function param
|
|
13
13
|
isConst: boolean, range: SourceRange);
|
|
14
|
+
clone(): TirSimpleVarDecl;
|
|
15
|
+
toString(): string;
|
|
16
|
+
pretty(indent: number): string;
|
|
14
17
|
deps(): string[];
|
|
15
18
|
definitelyTerminates(): boolean;
|
|
16
19
|
introducedVars(): string[];
|
|
@@ -12,6 +12,19 @@ export class TirSimpleVarDecl {
|
|
|
12
12
|
this.isConst = isConst;
|
|
13
13
|
this.range = range;
|
|
14
14
|
}
|
|
15
|
+
clone() {
|
|
16
|
+
return new TirSimpleVarDecl(this.name, this.type, this.initExpr?.clone(), this.isConst, this.range);
|
|
17
|
+
}
|
|
18
|
+
toString() {
|
|
19
|
+
return (`${this.isConst ? "const" : "let"} ${this.name}: ${this.type.toString()}` +
|
|
20
|
+
(this.initExpr ? ` = ${this.initExpr.toString()}` : ""));
|
|
21
|
+
}
|
|
22
|
+
pretty(indent) {
|
|
23
|
+
const singleIndent = " ";
|
|
24
|
+
const indent_base = singleIndent.repeat(indent);
|
|
25
|
+
return (`${this.isConst ? "const" : "let"} ${this.name}: ${this.type.toString()}` +
|
|
26
|
+
(this.initExpr ? ` = ${this.initExpr.pretty(indent)}` : ""));
|
|
27
|
+
}
|
|
15
28
|
deps() {
|
|
16
29
|
return this.initExpr?.deps() ?? [];
|
|
17
30
|
}
|
|
@@ -6,11 +6,13 @@ import { TirVarDecl } from "./TirVarDecl.js";
|
|
|
6
6
|
export declare class TirSingleDeconstructVarDecl implements ITirStmt {
|
|
7
7
|
readonly fields: Map<string, TirVarDecl>;
|
|
8
8
|
readonly rest: string | undefined;
|
|
9
|
-
|
|
9
|
+
type: TirType;
|
|
10
10
|
initExpr: TirExpr | undefined;
|
|
11
11
|
isConst: boolean;
|
|
12
12
|
readonly range: SourceRange;
|
|
13
13
|
constructor(fields: Map<string, TirVarDecl>, rest: string | undefined, type: TirType, initExpr: TirExpr | undefined, isConst: boolean, range: SourceRange);
|
|
14
|
+
toString(): string;
|
|
15
|
+
pretty(indent: number): string;
|
|
14
16
|
deps(): string[];
|
|
15
17
|
definitelyTerminates(): boolean;
|
|
16
18
|
introducedVars(): string[];
|
|
@@ -14,6 +14,34 @@ export class TirSingleDeconstructVarDecl {
|
|
|
14
14
|
this.isConst = isConst;
|
|
15
15
|
this.range = range;
|
|
16
16
|
}
|
|
17
|
+
toString() {
|
|
18
|
+
return (`${this.isConst ? "const" : "let"} ` +
|
|
19
|
+
`{ ` +
|
|
20
|
+
Array.from(this.fields.entries())
|
|
21
|
+
.map(([name, decl]) => `${name}: ${decl.toString()}`).join(", ") +
|
|
22
|
+
(this.rest ? `, ...${this.rest}` : "") +
|
|
23
|
+
` }` +
|
|
24
|
+
(this.initExpr ? ` = ${this.initExpr.toString()}` : ""));
|
|
25
|
+
}
|
|
26
|
+
pretty(indent) {
|
|
27
|
+
const singleIndent = " ";
|
|
28
|
+
const indent_base = singleIndent.repeat(indent);
|
|
29
|
+
const indent_0 = "\n" + indent_base;
|
|
30
|
+
const indent_1 = indent_0 + singleIndent;
|
|
31
|
+
const fieldEntries = Array.from(this.fields.entries()).map(([name, decl]) => `${name}: ${decl.pretty(indent + 1)}`);
|
|
32
|
+
const fieldsPart = fieldEntries.length === 0
|
|
33
|
+
? ""
|
|
34
|
+
: indent_1 + fieldEntries.join(`,${indent_1}`);
|
|
35
|
+
const restPart = this.rest
|
|
36
|
+
? (fieldEntries.length === 0 ? indent_1 : `,${indent_1}`) + `...${this.rest}`
|
|
37
|
+
: "";
|
|
38
|
+
const closing = fieldEntries.length === 0 && !this.rest ? " { }" : `${indent_0}}`;
|
|
39
|
+
return (`${this.isConst ? "const" : "let"} {` +
|
|
40
|
+
fieldsPart +
|
|
41
|
+
restPart +
|
|
42
|
+
closing +
|
|
43
|
+
(this.initExpr ? ` = ${this.initExpr.pretty(indent)}` : ""));
|
|
44
|
+
}
|
|
17
45
|
deps() {
|
|
18
46
|
return this.initExpr?.deps() ?? [];
|
|
19
47
|
}
|
|
@@ -6,6 +6,8 @@ export declare class TirWhileStmt implements ITirStmt {
|
|
|
6
6
|
body: TirStmt;
|
|
7
7
|
readonly range: SourceRange;
|
|
8
8
|
constructor(condition: TirExpr, body: TirStmt, range: SourceRange);
|
|
9
|
+
toString(): string;
|
|
10
|
+
pretty(indent: number): string;
|
|
9
11
|
definitelyTerminates(): boolean;
|
|
10
12
|
deps(): string[];
|
|
11
13
|
}
|
|
@@ -7,6 +7,20 @@ export class TirWhileStmt {
|
|
|
7
7
|
this.body = body;
|
|
8
8
|
this.range = range;
|
|
9
9
|
}
|
|
10
|
+
toString() {
|
|
11
|
+
return (`while( ${this.condition.toString()} ) ` +
|
|
12
|
+
this.body.toString());
|
|
13
|
+
}
|
|
14
|
+
pretty(indent) {
|
|
15
|
+
const singleIndent = " ";
|
|
16
|
+
const indent_base = singleIndent.repeat(indent);
|
|
17
|
+
const indent_0 = "\n" + indent_base;
|
|
18
|
+
const indent_1 = indent_0 + singleIndent;
|
|
19
|
+
return (`while(` +
|
|
20
|
+
indent_1 + this.condition.pretty(indent + 1) +
|
|
21
|
+
`${indent_0}) ` +
|
|
22
|
+
this.body.pretty(indent));
|
|
23
|
+
}
|
|
10
24
|
definitelyTerminates() {
|
|
11
25
|
return this.body.definitelyTerminates();
|
|
12
26
|
}
|
|
@@ -19,7 +19,7 @@ export class DiagnosticEmitter {
|
|
|
19
19
|
/** Emits a diagnostic message of the specified category. */
|
|
20
20
|
emitDiagnostic(code, category, range, relatedRange, arg0 = undefined, arg1 = undefined, arg2 = undefined) {
|
|
21
21
|
const originalStackLimit = Error.stackTraceLimit;
|
|
22
|
-
Error.stackTraceLimit =
|
|
22
|
+
Error.stackTraceLimit = 10;
|
|
23
23
|
let emitStack = new Error().stack;
|
|
24
24
|
Error.stackTraceLimit = originalStackLimit;
|
|
25
25
|
emitStack = emitStack?.split("\n").slice(2).map(l => l.trim()).join("\n");
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/** Enum of available diagnostic codes. */
|
|
2
2
|
export declare enum DiagnosticCode {
|
|
3
3
|
Not_implemented_0 = 100,
|
|
4
|
-
|
|
4
|
+
Contract_is_missing = 101,
|
|
5
|
+
Contract_declarations_cannot_be_exported = 102,
|
|
5
6
|
Conversion_from_type_0_to_1_requires_an_explicit_cast = 200,
|
|
6
7
|
Conversion_from_type_0_to_1_will_require_an_explicit_cast_when_switching_between_32_64_bit = 201,
|
|
7
8
|
Type_0_cannot_be_changed_to_type_1 = 202,
|
|
@@ -92,6 +93,14 @@ export declare enum DiagnosticCode {
|
|
|
92
93
|
_case_expression_must_decontructed_the_inspected_value = 287,
|
|
93
94
|
for_loop_initialization_variables_cannot_be_destructured_Declare_it_as_a_simple_variable_and_move_the_destructuring_in_the_loop_body = 288,
|
|
94
95
|
Match_cases_are_not_exhaustive = 289,
|
|
96
|
+
Contract_methods_must_return_void_or_fail = 290,
|
|
97
|
+
Contract_parameters_cannot_have_an_initializer_expression = 291,
|
|
98
|
+
_context_can_only_be_destructured_in_a_constant_declaration = 292,
|
|
99
|
+
_context_can_only_be_accessed_in_a_contract_method = 293,
|
|
100
|
+
_this_in_a_contract_context_can_only_be_used_to_read_parameters_in_a_contract_method = 293,
|
|
101
|
+
_0_is_not_aviable_in_this_contract_method_context = 294,
|
|
102
|
+
_context_can_only_be_destructured_as_an_unnamed_object = 295,
|
|
103
|
+
_0_is_not_a_contract_parameter = 296,
|
|
95
104
|
Importing_the_table_disables_some_indirect_call_optimizations = 901,
|
|
96
105
|
Exporting_the_table_disables_some_indirect_call_optimizations = 902,
|
|
97
106
|
Expression_compiles_to_a_dynamic_check_at_runtime = 903,
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
export var DiagnosticCode;
|
|
4
4
|
(function (DiagnosticCode) {
|
|
5
5
|
DiagnosticCode[DiagnosticCode["Not_implemented_0"] = 100] = "Not_implemented_0";
|
|
6
|
-
DiagnosticCode[DiagnosticCode["
|
|
6
|
+
DiagnosticCode[DiagnosticCode["Contract_is_missing"] = 101] = "Contract_is_missing";
|
|
7
|
+
DiagnosticCode[DiagnosticCode["Contract_declarations_cannot_be_exported"] = 102] = "Contract_declarations_cannot_be_exported";
|
|
7
8
|
DiagnosticCode[DiagnosticCode["Conversion_from_type_0_to_1_requires_an_explicit_cast"] = 200] = "Conversion_from_type_0_to_1_requires_an_explicit_cast";
|
|
8
9
|
DiagnosticCode[DiagnosticCode["Conversion_from_type_0_to_1_will_require_an_explicit_cast_when_switching_between_32_64_bit"] = 201] = "Conversion_from_type_0_to_1_will_require_an_explicit_cast_when_switching_between_32_64_bit";
|
|
9
10
|
DiagnosticCode[DiagnosticCode["Type_0_cannot_be_changed_to_type_1"] = 202] = "Type_0_cannot_be_changed_to_type_1";
|
|
@@ -94,6 +95,14 @@ export var DiagnosticCode;
|
|
|
94
95
|
DiagnosticCode[DiagnosticCode["_case_expression_must_decontructed_the_inspected_value"] = 287] = "_case_expression_must_decontructed_the_inspected_value";
|
|
95
96
|
DiagnosticCode[DiagnosticCode["for_loop_initialization_variables_cannot_be_destructured_Declare_it_as_a_simple_variable_and_move_the_destructuring_in_the_loop_body"] = 288] = "for_loop_initialization_variables_cannot_be_destructured_Declare_it_as_a_simple_variable_and_move_the_destructuring_in_the_loop_body";
|
|
96
97
|
DiagnosticCode[DiagnosticCode["Match_cases_are_not_exhaustive"] = 289] = "Match_cases_are_not_exhaustive";
|
|
98
|
+
DiagnosticCode[DiagnosticCode["Contract_methods_must_return_void_or_fail"] = 290] = "Contract_methods_must_return_void_or_fail";
|
|
99
|
+
DiagnosticCode[DiagnosticCode["Contract_parameters_cannot_have_an_initializer_expression"] = 291] = "Contract_parameters_cannot_have_an_initializer_expression";
|
|
100
|
+
DiagnosticCode[DiagnosticCode["_context_can_only_be_destructured_in_a_constant_declaration"] = 292] = "_context_can_only_be_destructured_in_a_constant_declaration";
|
|
101
|
+
DiagnosticCode[DiagnosticCode["_context_can_only_be_accessed_in_a_contract_method"] = 293] = "_context_can_only_be_accessed_in_a_contract_method";
|
|
102
|
+
DiagnosticCode[DiagnosticCode["_this_in_a_contract_context_can_only_be_used_to_read_parameters_in_a_contract_method"] = 293] = "_this_in_a_contract_context_can_only_be_used_to_read_parameters_in_a_contract_method";
|
|
103
|
+
DiagnosticCode[DiagnosticCode["_0_is_not_aviable_in_this_contract_method_context"] = 294] = "_0_is_not_aviable_in_this_contract_method_context";
|
|
104
|
+
DiagnosticCode[DiagnosticCode["_context_can_only_be_destructured_as_an_unnamed_object"] = 295] = "_context_can_only_be_destructured_as_an_unnamed_object";
|
|
105
|
+
DiagnosticCode[DiagnosticCode["_0_is_not_a_contract_parameter"] = 296] = "_0_is_not_a_contract_parameter";
|
|
97
106
|
DiagnosticCode[DiagnosticCode["Importing_the_table_disables_some_indirect_call_optimizations"] = 901] = "Importing_the_table_disables_some_indirect_call_optimizations";
|
|
98
107
|
DiagnosticCode[DiagnosticCode["Exporting_the_table_disables_some_indirect_call_optimizations"] = 902] = "Exporting_the_table_disables_some_indirect_call_optimizations";
|
|
99
108
|
DiagnosticCode[DiagnosticCode["Expression_compiles_to_a_dynamic_check_at_runtime"] = 903] = "Expression_compiles_to_a_dynamic_check_at_runtime";
|
|
@@ -277,7 +286,8 @@ export var DiagnosticCode;
|
|
|
277
286
|
export function diagnosticCodeToString(code) {
|
|
278
287
|
switch (code) {
|
|
279
288
|
case 100: return "Not implemented: {0}";
|
|
280
|
-
case 101: return "
|
|
289
|
+
case 101: return "Contract is missing";
|
|
290
|
+
case 102: return "Contract declarations cannot be exported";
|
|
281
291
|
case 200: return "Conversion from type '{0}' to '{1}' requires an explicit cast.";
|
|
282
292
|
case 201: return "Conversion from type '{0}' to '{1}' will require an explicit cast when switching between 32/64-bit.";
|
|
283
293
|
case 202: return "Type '{0}' cannot be changed to type '{1}'.";
|
|
@@ -368,6 +378,14 @@ export function diagnosticCodeToString(code) {
|
|
|
368
378
|
case 287: return "'case' expression must decontructed the inspected value.";
|
|
369
379
|
case 288: return "for loop initialization variables cannot be destructured. Declare it as a simple variable and move the destructuring in the loop body";
|
|
370
380
|
case 289: return "Match cases are not exhaustive";
|
|
381
|
+
case 290: return "Contract methods must return void or fail";
|
|
382
|
+
case 291: return "Contract parameters cannot have an initializer expression";
|
|
383
|
+
case 292: return "`context` can only be destructured in a constant declaration.";
|
|
384
|
+
case 293: return "`context` can only be accessed in a contract method.";
|
|
385
|
+
case 293: return "`this`, in a contract context, can only be used to read parameters in a contract method.";
|
|
386
|
+
case 294: return "`{0}` is not aviable in this contract method `context`.";
|
|
387
|
+
case 295: return "`context` can only be destructured as an unnamed object.";
|
|
388
|
+
case 296: return "'{0}' is not a contract parameter.";
|
|
371
389
|
case 901: return "Importing the table disables some indirect call optimizations.";
|
|
372
390
|
case 902: return "Exporting the table disables some indirect call optimizations.";
|
|
373
391
|
case 903: return "Expression compiles to a dynamic check at runtime.";
|
package/dist/parser/Parser.d.ts
CHANGED
|
@@ -41,6 +41,7 @@ import { AstTypeExpr } from "../ast/nodes/types/AstTypeExpr.js";
|
|
|
41
41
|
import { UsingStmt } from "../ast/nodes/statements/UsingStmt.js";
|
|
42
42
|
import { BodyStmt, TopLevelStmt } from "../ast/nodes/statements/PebbleStmt.js";
|
|
43
43
|
import { Precedence } from "./Precedence.js";
|
|
44
|
+
import { ContractDecl } from "../ast/nodes/statements/declarations/ContractDecl.js";
|
|
44
45
|
interface ParseStmtOpts {
|
|
45
46
|
isExport?: boolean;
|
|
46
47
|
topLevel?: boolean;
|
|
@@ -52,6 +53,7 @@ export declare class Parser extends DiagnosticEmitter {
|
|
|
52
53
|
static parseSource(src: Source, diagnostics?: DiagnosticMessage[]): DiagnosticMessage[];
|
|
53
54
|
parseSource(): DiagnosticMessage[];
|
|
54
55
|
parseTopLevelStatement(): TopLevelStmt | undefined;
|
|
56
|
+
parseContractDecl(startPos: number): ContractDecl | undefined;
|
|
55
57
|
parseUsingDecl(): UsingStmt | undefined;
|
|
56
58
|
parseTypeParameters(): Identifier[] | undefined;
|
|
57
59
|
parseTypeArguments(): AstTypeExpr[] | undefined;
|
|
@@ -63,7 +65,7 @@ export declare class Parser extends DiagnosticEmitter {
|
|
|
63
65
|
parseStruct(structDeclFlags: StructDeclAstFlags, flags?: CommonFlags, startPos?: number): StructDecl | undefined;
|
|
64
66
|
parseStructConstrFields(flags: CommonFlags): SimpleVarDecl[] | undefined;
|
|
65
67
|
private parseNamedFuncSig;
|
|
66
|
-
parseFuncDecl(flags: CommonFlags, startPos?: number): FuncDecl | undefined;
|
|
68
|
+
parseFuncDecl(flags: CommonFlags, startPos?: number, defaultReturnType?: AstTypeExpr | undefined): FuncDecl | undefined;
|
|
67
69
|
parseEnum(flags: CommonFlags, startPos: number): EnumDecl | undefined;
|
|
68
70
|
parseEnumValue(parentFlags: CommonFlags): EnumValueDecl | undefined;
|
|
69
71
|
parseVarStmt(flags: CommonFlags, startPos: number, opts?: Partial<ParseVarOpts>): VarStmt | undefined;
|
|
@@ -78,10 +80,13 @@ export declare class Parser extends DiagnosticEmitter {
|
|
|
78
80
|
*
|
|
79
81
|
* on the contrary in case we are parsing a field of a deconstructed variable declaration
|
|
80
82
|
* an initializer MUST NOT be present NOR a type
|
|
83
|
+
*
|
|
84
|
+
* EDIT:
|
|
85
|
+
* This method is also used while parsing contract `param`s;
|
|
81
86
|
*/
|
|
82
87
|
private _parseVarDecl;
|
|
83
|
-
parseSingleDeconstructVarDecl(flags: CommonFlags): SingleDeconstructVarDecl | undefined;
|
|
84
|
-
parseArrayLikeDeconstr(flags: CommonFlags): ArrayLikeDeconstr | undefined;
|
|
88
|
+
parseSingleDeconstructVarDecl(flags: CommonFlags, skipTypeAndInitializer?: boolean): SingleDeconstructVarDecl | undefined;
|
|
89
|
+
parseArrayLikeDeconstr(flags: CommonFlags, skipTypeAndInitializer?: boolean): ArrayLikeDeconstr | undefined;
|
|
85
90
|
parseIdentifier(startRange?: SourceRange | undefined): Identifier | undefined;
|
|
86
91
|
/**
|
|
87
92
|
* parses `(: AstTypeExpr)? (= PebbleExpr)?` for parameters and variable declarations
|