@harmoniclabs/pebble 0.1.0-dev4 → 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.d.ts +1 -0
- package/dist/compiler/path/getAbsolutePath.js +8 -5
- 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
|
@@ -34,6 +34,7 @@ export function determineReassignedVariablesAndReturn(stmt) {
|
|
|
34
34
|
returns = true;
|
|
35
35
|
continue;
|
|
36
36
|
}
|
|
37
|
+
// TODO: can optimize list iterations
|
|
37
38
|
if (stmt instanceof TirAssignmentStmt) {
|
|
38
39
|
reassignedSet.add(stmt.varIdentifier.varName);
|
|
39
40
|
continue;
|
|
@@ -235,8 +236,16 @@ export function getBodyStateType({ sop, initState }, stmt) {
|
|
|
235
236
|
for (const { name, type, range, initExpr, isConst } of stmt.init) {
|
|
236
237
|
if (!initExpr)
|
|
237
238
|
throw new Error("loop init variable requires initialization expression");
|
|
238
|
-
//
|
|
239
|
-
|
|
239
|
+
// using `getUniqueInternalName` here messes up variable access later
|
|
240
|
+
// due to how for statements are expressified (see piece of code from expressifyForStmt)
|
|
241
|
+
// ```
|
|
242
|
+
// // define loop function parameters
|
|
243
|
+
// for( const { name, type } of bodyStateType.constructors[0].fields ) {
|
|
244
|
+
// loopCompilationCtx.setFuncParam( name, type );
|
|
245
|
+
// }
|
|
246
|
+
// ```
|
|
247
|
+
// the introduced vars are taken from the bodyStateType that we derive here
|
|
248
|
+
const uniqueFieldName = name; // getUniqueInternalName( name );
|
|
240
249
|
bodyStateConstr.fields.push(new TirStructField(uniqueFieldName, type));
|
|
241
250
|
initState.fieldNames.push(new Identifier(uniqueFieldName, range));
|
|
242
251
|
initState.values.push(initExpr);
|
|
@@ -6,7 +6,8 @@ import { TirContinueStmt } from "../../tir/statements/TirContinueStmt.js";
|
|
|
6
6
|
import { TirReturnStmt } from "../../tir/statements/TirReturnStmt.js";
|
|
7
7
|
import { TirStmt } from "../../tir/statements/TirStmt.js";
|
|
8
8
|
import { ExpressifyCtx } from "./ExpressifyCtx.js";
|
|
9
|
-
|
|
9
|
+
import { TypedProgram } from "../../tir/program/TypedProgram.js";
|
|
10
|
+
export declare function expressify(func: TirFuncExpr, loopReplacements: LoopReplacements | undefined, program: TypedProgram, parentCtx?: ExpressifyCtx | undefined): void;
|
|
10
11
|
export interface LoopReplacements {
|
|
11
12
|
readonly replaceReturnValue: (ctx: ExpressifyCtx, stmt: TirReturnStmt) => TirExpr;
|
|
12
13
|
readonly compileBreak: (ctx: ExpressifyCtx, stmt: TirBreakStmt) => TirExpr;
|
|
@@ -33,14 +33,14 @@ import { expressifyTerminatingIfStmt } from "./expressifyTerminatingIfStmt.js";
|
|
|
33
33
|
import { determineReassignedVariablesAndFlowInfos, determineReassignedVariablesAndReturn, getBodyStateType, getBranchStmtReturnType } from "./determineReassignedVariablesAndReturn.js";
|
|
34
34
|
import { TirTernaryExpr } from "../../tir/expressions/TirTernaryExpr.js";
|
|
35
35
|
import { expressifyIfBranch } from "./expressifyIfBranch.js";
|
|
36
|
-
import { expressifyForStmt,
|
|
36
|
+
import { expressifyForStmt, loopToForStmt } from "./expressifyForStmt.js";
|
|
37
37
|
import { getListTypeArg } from "../../tir/types/utils/getListTypeArg.js";
|
|
38
38
|
import { TirElemAccessExpr } from "../../tir/expressions/TirElemAccessExpr.js";
|
|
39
39
|
import { TirLitIntExpr } from "../../tir/expressions/litteral/TirLitIntExpr.js";
|
|
40
40
|
import { TirCallExpr } from "../../tir/expressions/TirCallExpr.js";
|
|
41
41
|
import { TirNativeFunc } from "../../tir/expressions/TirNativeFunc.js";
|
|
42
|
-
export function expressify(func, loopReplacements, parentCtx = undefined) {
|
|
43
|
-
const ctx = new ExpressifyCtx(parentCtx, func.returnType);
|
|
42
|
+
export function expressify(func, loopReplacements, program, parentCtx = undefined) {
|
|
43
|
+
const ctx = new ExpressifyCtx(parentCtx, func.returnType, program);
|
|
44
44
|
ctx.introduceFuncParams(func.params);
|
|
45
45
|
func.body.stmts = [
|
|
46
46
|
new TirReturnStmt(expressifyFuncBody(ctx, func.body.stmts, loopReplacements), func.body.range)
|
|
@@ -52,6 +52,8 @@ loopReplacements, assertions = []) {
|
|
|
52
52
|
bodyStmts = bodyStmts.slice();
|
|
53
53
|
let stmt;
|
|
54
54
|
while (stmt = bodyStmts.shift()) {
|
|
55
|
+
// console.log([stmt, ...bodyStmts].map(s => s.toString()));
|
|
56
|
+
// console.log( stmt );
|
|
55
57
|
if (stmt instanceof TirBreakStmt) {
|
|
56
58
|
if (typeof loopReplacements?.compileBreak !== "function")
|
|
57
59
|
throw new Error("break statement in function body.");
|
|
@@ -71,8 +73,9 @@ loopReplacements, assertions = []) {
|
|
|
71
73
|
stmt.value = modifiedExpr;
|
|
72
74
|
return TirAssertAndContinueExpr.fromStmtsAndContinuation(assertions, modifiedExpr);
|
|
73
75
|
}
|
|
74
|
-
else
|
|
76
|
+
else {
|
|
75
77
|
return TirAssertAndContinueExpr.fromStmtsAndContinuation(assertions, new TirLitVoidExpr(stmt.range));
|
|
78
|
+
}
|
|
76
79
|
}
|
|
77
80
|
// if( isTirVarDecl( stmt ) ) expressifyVarDecl( ctx, stmt );
|
|
78
81
|
else if (stmt instanceof TirSimpleVarDecl) {
|
|
@@ -81,6 +84,10 @@ loopReplacements, assertions = []) {
|
|
|
81
84
|
const initExpr = expressifyVars(ctx, stmt.initExpr);
|
|
82
85
|
stmt.initExpr = initExpr;
|
|
83
86
|
const lettedExpr = ctx.introduceLettedConstant(stmt.name, initExpr, stmt.range);
|
|
87
|
+
if (!stmt.isConst) {
|
|
88
|
+
// console.log("setting variable")
|
|
89
|
+
ctx.setNewVariableName(stmt.name, lettedExpr.varName);
|
|
90
|
+
}
|
|
84
91
|
if (!isSingleConstrStruct(stmt.type))
|
|
85
92
|
continue;
|
|
86
93
|
if ((initExpr instanceof TirVariableAccessExpr || initExpr instanceof TirLettedExpr)
|
|
@@ -128,9 +135,12 @@ loopReplacements, assertions = []) {
|
|
|
128
135
|
.concat(bodyStmts), loopReplacements), stmt.range)], new TirWildcardCaseMatcher(new TirFailExpr(undefined, ctx.returnType, stmt.range), stmt.range), ctx.returnType, stmt.range));
|
|
129
136
|
}
|
|
130
137
|
else if (stmt.type instanceof TirDataStructType) {
|
|
131
|
-
|
|
138
|
+
const { implicitAssertions, nestedDeconstructs } = ctx.introduceDeconstrDataLettedFields(stmt, lettedExpr);
|
|
139
|
+
assertions.push(...implicitAssertions);
|
|
140
|
+
bodyStmts.unshift(...nestedDeconstructs);
|
|
132
141
|
continue;
|
|
133
142
|
}
|
|
143
|
+
throw new Error("deconstruction of non-struct type" + stmt.type.toString());
|
|
134
144
|
}
|
|
135
145
|
else if (stmt instanceof TirArrayLikeDeconstr) {
|
|
136
146
|
if (!stmt.initExpr)
|
|
@@ -175,8 +185,10 @@ loopReplacements, assertions = []) {
|
|
|
175
185
|
bodyStmts.push(...nextDeclarations);
|
|
176
186
|
continue;
|
|
177
187
|
}
|
|
178
|
-
else if (stmt instanceof TirAssignmentStmt)
|
|
188
|
+
else if (stmt instanceof TirAssignmentStmt) {
|
|
179
189
|
bodyStmts.unshift(expressifyVarAssignmentStmt(ctx, stmt));
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
180
192
|
else if (stmt instanceof TirBlockStmt) {
|
|
181
193
|
// inline the block
|
|
182
194
|
bodyStmts = stmt.stmts.concat(bodyStmts);
|
|
@@ -188,8 +200,9 @@ loopReplacements, assertions = []) {
|
|
|
188
200
|
stmt.failMsgExpr = modifiedExpr;
|
|
189
201
|
return TirAssertAndContinueExpr.fromStmtsAndContinuation(assertions, new TirFailExpr(modifiedExpr, ctx.returnType, stmt.range));
|
|
190
202
|
}
|
|
191
|
-
else
|
|
203
|
+
else {
|
|
192
204
|
return TirAssertAndContinueExpr.fromStmtsAndContinuation(assertions, new TirFailExpr(undefined, ctx.returnType, stmt.range));
|
|
205
|
+
}
|
|
193
206
|
}
|
|
194
207
|
else if (stmt instanceof TirAssertStmt) {
|
|
195
208
|
const condition = expressifyVars(ctx, stmt.condition);
|
|
@@ -239,7 +252,7 @@ loopReplacements, assertions = []) {
|
|
|
239
252
|
const stmtExpr = new TirTernaryExpr(condition, expressifyIfBranch(ctx.newChild(), stmt.thenBranch, reassignsAndReturns.reassigned, sop, loopReplacements), stmt.elseBranch ? expressifyIfBranch(ctx.newChild(), stmt.elseBranch, reassignsAndReturns.reassigned, sop, loopReplacements) : initState, // no else branch means the variables stay unchanged
|
|
240
253
|
sop, stmt.range);
|
|
241
254
|
// expressify as ternary that returns the SoP type
|
|
242
|
-
return TirAssertAndContinueExpr.fromStmtsAndContinuation(assertions,
|
|
255
|
+
return TirAssertAndContinueExpr.fromStmtsAndContinuation(assertions, wrapNonTerminatingFinalStmtAsCaseExpr(stmtExpr, sop, ctx, stmt.range, reassignsAndReturns, bodyStmts, loopReplacements));
|
|
243
256
|
}
|
|
244
257
|
else if (stmt instanceof TirMatchStmt) {
|
|
245
258
|
/**
|
|
@@ -272,9 +285,8 @@ loopReplacements, assertions = []) {
|
|
|
272
285
|
const reassignsAndReturns = determineReassignedVariablesAndReturn(stmt);
|
|
273
286
|
if (isDirectReturn) {
|
|
274
287
|
// build a SoP type to return
|
|
275
|
-
const { sop, initState } = getBranchStmtReturnType(reassignsAndReturns, ctx, stmt.range);
|
|
276
|
-
|
|
277
|
-
return TirAssertAndContinueExpr.fromStmtsAndContinuation(assertions, getFinalStmtCaseExpr(new TirCaseExpr(expressifyVars(ctx, stmt.matchExpr), stmt.cases.map(_case => {
|
|
288
|
+
// const { sop, initState } = getBranchStmtReturnType( reassignsAndReturns, ctx, stmt.range );
|
|
289
|
+
const finalExpression = new TirCaseExpr(expressifyVars(ctx, stmt.matchExpr), stmt.cases.map(_case => {
|
|
278
290
|
if (_case.pattern instanceof TirArrayLikeDeconstr)
|
|
279
291
|
throw new Error("array-like deconstruction in match statement is not supported");
|
|
280
292
|
_case.pattern = toNamedDeconstructVarDecl(_case.pattern);
|
|
@@ -282,43 +294,77 @@ loopReplacements, assertions = []) {
|
|
|
282
294
|
flattenSopNamedDeconstructInplace_addTopDestructToCtx_getNestedDeconstruct(_case.pattern, caseCtx);
|
|
283
295
|
const caseBody = expressifyFuncBody(caseCtx, _case.body instanceof TirBlockStmt
|
|
284
296
|
? _case.body.stmts
|
|
285
|
-
: [_case.body], loopReplacements,
|
|
297
|
+
: [_case.body], loopReplacements, []);
|
|
286
298
|
return new TirCaseMatcher(_case.pattern, caseBody, _case.range);
|
|
287
299
|
}), stmt.wildcardCase ? new TirWildcardCaseMatcher(expressifyFuncBody(ctx.newChild(), stmt.wildcardCase.body instanceof TirBlockStmt
|
|
288
300
|
? stmt.wildcardCase.body.stmts
|
|
289
|
-
: [stmt.wildcardCase.body], loopReplacements, []), stmt.wildcardCase.range) : undefined, ctx.returnType, stmt.range)
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
// continue is ok, because we only need to pass the state up to that point
|
|
301
|
+
: [stmt.wildcardCase.body], loopReplacements, []), stmt.wildcardCase.range) : undefined, ctx.returnType, stmt.range);
|
|
302
|
+
// expressify as ternary that returns the SoP type
|
|
303
|
+
return TirAssertAndContinueExpr.fromStmtsAndContinuation(assertions,
|
|
304
|
+
// isDirectReturn === true, so we don't need to wrap
|
|
305
|
+
finalExpression
|
|
306
|
+
/*
|
|
307
|
+
true ? finalExpression : wrapNonTerminatingFinalStmtAsCaseExpr(
|
|
308
|
+
finalExpression,
|
|
309
|
+
sop,
|
|
310
|
+
ctx,
|
|
311
|
+
stmt.range,
|
|
312
|
+
reassignsAndReturns,
|
|
313
|
+
bodyStmts,
|
|
314
|
+
loopReplacements
|
|
315
|
+
)
|
|
316
|
+
//*/
|
|
317
|
+
);
|
|
307
318
|
}
|
|
319
|
+
throw new Error("match statement with multiple non-terminating cases is not implemented yet (sorry)");
|
|
308
320
|
}
|
|
321
|
+
// else if( stmt instanceof TirForOfStmt ) {
|
|
322
|
+
//
|
|
323
|
+
// const definitelyTerminates = stmt.definitelyTerminates();
|
|
324
|
+
//
|
|
325
|
+
// // determine affected variables
|
|
326
|
+
// // determine if we may have an early return
|
|
327
|
+
// // determine if we can break or continue
|
|
328
|
+
// const reassignedAndFlow = determineReassignedVariablesAndFlowInfos( stmt );
|
|
329
|
+
// const {
|
|
330
|
+
// reassigned,
|
|
331
|
+
// returns,
|
|
332
|
+
// canBreak,
|
|
333
|
+
// canContinue
|
|
334
|
+
// } = reassignedAndFlow;
|
|
335
|
+
// const { sop, initState } = getBranchStmtReturnType( reassignedAndFlow, ctx, stmt.range );
|
|
336
|
+
//
|
|
337
|
+
// if(
|
|
338
|
+
// !returns
|
|
339
|
+
// && !canBreak
|
|
340
|
+
// // && !canContinue
|
|
341
|
+
// ) {
|
|
342
|
+
// // **only for...of** can be optimized as a simple `.reduce`
|
|
343
|
+
// // producing the new state in this case
|
|
344
|
+
// // (`.reduce` has no way to break or early return (efficiently))
|
|
345
|
+
// // continue is ok, because we only need to pass the state up to that point
|
|
346
|
+
// }
|
|
347
|
+
//
|
|
348
|
+
// }
|
|
309
349
|
else if (stmt instanceof TirForStmt
|
|
310
|
-
|| stmt instanceof TirWhileStmt
|
|
350
|
+
|| stmt instanceof TirWhileStmt
|
|
351
|
+
|| stmt instanceof TirForOfStmt) {
|
|
352
|
+
const definitelyTerminates = stmt.definitelyTerminates();
|
|
311
353
|
const reassignedAndFlow = determineReassignedVariablesAndFlowInfos(stmt);
|
|
312
354
|
const returnTypeAndInvalidInit = getBranchStmtReturnType(reassignedAndFlow, ctx, stmt.range);
|
|
313
|
-
const forStmt =
|
|
355
|
+
const forStmt = loopToForStmt(stmt);
|
|
314
356
|
const { bodyStateType, initState } = getBodyStateType(returnTypeAndInvalidInit, forStmt);
|
|
315
357
|
const loopExpr = expressifyForStmt(ctx.newChild(), forStmt, returnTypeAndInvalidInit.sop, bodyStateType, initState);
|
|
358
|
+
return TirAssertAndContinueExpr.fromStmtsAndContinuation(assertions, definitelyTerminates ? loopExpr : wrapNonTerminatingFinalStmtAsCaseExpr(loopExpr, returnTypeAndInvalidInit.sop, ctx, stmt.range, reassignedAndFlow, bodyStmts, loopReplacements));
|
|
316
359
|
}
|
|
317
360
|
else {
|
|
318
|
-
const
|
|
319
|
-
console.error(stmt);
|
|
320
|
-
throw new Error("unreachable::expressify::stmt");
|
|
361
|
+
// const tsEnsureExhautstiveCheck: never = stmt;
|
|
362
|
+
// console.error( stmt );
|
|
363
|
+
// throw new Error("unreachable::expressify::stmt");
|
|
321
364
|
}
|
|
365
|
+
const tsEnsureExhautstiveCheck = stmt;
|
|
366
|
+
console.error(stmt);
|
|
367
|
+
throw new Error("unreachable::expressify::stmt");
|
|
322
368
|
}
|
|
323
369
|
return TirAssertAndContinueExpr.fromStmtsAndContinuation(assertions, new TirLitVoidExpr(SourceRange.mock));
|
|
324
370
|
}
|
|
@@ -355,7 +401,7 @@ function getNestedDestructsInSingleSopDestructPattern(pattern) {
|
|
|
355
401
|
}
|
|
356
402
|
return result;
|
|
357
403
|
}
|
|
358
|
-
function
|
|
404
|
+
function wrapNonTerminatingFinalStmtAsCaseExpr(finalStmtExpr, sop, ctx, stmtRange, reassignsAndReturns, nextBodyStmts, loopReplacements) {
|
|
359
405
|
const continuations = [];
|
|
360
406
|
const contBranchCtx = ctx.newChild();
|
|
361
407
|
const contConstr = sop.constructors[0];
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { TirLitNamedObjExpr } from "../../tir/expressions/litteral/TirLitNamedObjExpr.js";
|
|
2
2
|
import { TirCallExpr } from "../../tir/expressions/TirCallExpr.js";
|
|
3
|
+
import { TirForOfStmt } from "../../tir/statements/TirForOfStmt.js";
|
|
3
4
|
import { TirForStmt } from "../../tir/statements/TirForStmt.js";
|
|
4
5
|
import { TirWhileStmt } from "../../tir/statements/TirWhileStmt.js";
|
|
5
6
|
import { TirSoPStructType } from "../../tir/types/TirStructType.js";
|
|
6
7
|
import { ExpressifyCtx } from "./ExpressifyCtx.js";
|
|
7
|
-
export declare function
|
|
8
|
+
export declare function loopToForStmt(stmt: TirWhileStmt | TirForOfStmt | TirForStmt): TirForStmt;
|
|
8
9
|
export declare function expressifyForStmt(ctx: ExpressifyCtx, stmt: TirForStmt, returnType: TirSoPStructType, bodyStateType: TirSoPStructType, initState: TirLitNamedObjExpr): TirCallExpr;
|
|
@@ -3,20 +3,63 @@ import { getUniqueInternalName } from "../../internalVar.js";
|
|
|
3
3
|
import { TirLitNamedObjExpr } from "../../tir/expressions/litteral/TirLitNamedObjExpr.js";
|
|
4
4
|
import { TirCallExpr } from "../../tir/expressions/TirCallExpr.js";
|
|
5
5
|
import { TirFuncExpr } from "../../tir/expressions/TirFuncExpr.js";
|
|
6
|
+
import { TirPropAccessExpr } from "../../tir/expressions/TirPropAccessExpr.js";
|
|
6
7
|
import { TirVariableAccessExpr } from "../../tir/expressions/TirVariableAccessExpr.js";
|
|
8
|
+
import { TirUnaryExclamation } from "../../tir/expressions/unary/TirUnaryExclamation.js";
|
|
9
|
+
import { TirAssignmentStmt } from "../../tir/statements/TirAssignmentStmt.js";
|
|
7
10
|
import { TirBlockStmt } from "../../tir/statements/TirBlockStmt.js";
|
|
8
11
|
import { TirBreakStmt } from "../../tir/statements/TirBreakStmt.js";
|
|
9
12
|
import { TirContinueStmt } from "../../tir/statements/TirContinueStmt.js";
|
|
13
|
+
import { TirForOfStmt } from "../../tir/statements/TirForOfStmt.js";
|
|
10
14
|
import { TirForStmt } from "../../tir/statements/TirForStmt.js";
|
|
11
15
|
import { TirIfStmt } from "../../tir/statements/TirIfStmt.js";
|
|
12
16
|
import { TirReturnStmt } from "../../tir/statements/TirReturnStmt.js";
|
|
13
17
|
import { TirSimpleVarDecl } from "../../tir/statements/TirVarDecl/TirSimpleVarDecl.js";
|
|
18
|
+
import { TirBoolT } from "../../tir/types/TirNativeType/index.js";
|
|
14
19
|
import { TirFuncT } from "../../tir/types/TirNativeType/native/function.js";
|
|
20
|
+
import { getListTypeArg } from "../../tir/types/utils/getListTypeArg.js";
|
|
15
21
|
import { expressifyFuncBody } from "./expressify.js";
|
|
16
22
|
import { isExpressifyFuncParam } from "./ExpressifyCtx.js";
|
|
17
|
-
export function
|
|
23
|
+
export function loopToForStmt(stmt) {
|
|
18
24
|
if (stmt instanceof TirForStmt)
|
|
19
25
|
return stmt;
|
|
26
|
+
if (stmt instanceof TirForOfStmt) {
|
|
27
|
+
// convert for of to for
|
|
28
|
+
const partialListName = getUniqueInternalName("for_of_partial_list");
|
|
29
|
+
const iterElemType = getListTypeArg(stmt.iterable.type);
|
|
30
|
+
if (!iterElemType)
|
|
31
|
+
throw new Error("Iterable type is not a list");
|
|
32
|
+
const varRange = stmt.elemDeclaration.range;
|
|
33
|
+
const partialListVar = new TirSimpleVarDecl(partialListName, // name
|
|
34
|
+
stmt.iterable.type, // type
|
|
35
|
+
stmt.iterable, // initial value
|
|
36
|
+
false, // is constant
|
|
37
|
+
varRange // range
|
|
38
|
+
);
|
|
39
|
+
const partialListVarAccess = new TirVariableAccessExpr({
|
|
40
|
+
isDefinedOutsideFuncScope: false,
|
|
41
|
+
variableInfos: {
|
|
42
|
+
name: partialListVar.name,
|
|
43
|
+
type: partialListVar.type,
|
|
44
|
+
isConstant: false,
|
|
45
|
+
},
|
|
46
|
+
}, varRange);
|
|
47
|
+
// `!partialList.isEmpty()`
|
|
48
|
+
const runCondition = new TirUnaryExclamation(new TirCallExpr(new TirPropAccessExpr(partialListVarAccess.clone(), new Identifier("isEmpty", varRange), new TirFuncT([], new TirBoolT()), varRange), [], // args
|
|
49
|
+
new TirBoolT(), varRange), new TirBoolT(), varRange);
|
|
50
|
+
const updatePartialList = new TirAssignmentStmt(partialListVarAccess.clone(), new TirCallExpr(new TirPropAccessExpr(partialListVarAccess.clone(), new Identifier("tail", varRange), new TirFuncT([], stmt.iterable.type), varRange), [], // args
|
|
51
|
+
stmt.iterable.type, varRange), varRange);
|
|
52
|
+
let body = stmt.body instanceof TirBlockStmt ? stmt.body : new TirBlockStmt([stmt.body], stmt.range);
|
|
53
|
+
const elemDecl = stmt.elemDeclaration;
|
|
54
|
+
elemDecl.initExpr = new TirCallExpr(new TirPropAccessExpr(partialListVarAccess.clone(), new Identifier("head", varRange), new TirFuncT([], iterElemType), varRange), [], // args
|
|
55
|
+
iterElemType, varRange);
|
|
56
|
+
body.stmts.unshift(elemDecl);
|
|
57
|
+
return new TirForStmt([partialListVar], // init
|
|
58
|
+
runCondition, // condition
|
|
59
|
+
[updatePartialList], // update
|
|
60
|
+
body, // loopBody
|
|
61
|
+
stmt.range);
|
|
62
|
+
}
|
|
20
63
|
// convert while to for
|
|
21
64
|
return new TirForStmt([], // no init
|
|
22
65
|
stmt.condition, // condition
|
|
@@ -25,13 +68,19 @@ export function whileToFor(stmt) {
|
|
|
25
68
|
stmt.range);
|
|
26
69
|
}
|
|
27
70
|
export function expressifyForStmt(ctx, stmt, returnType, bodyStateType, initState) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
loopBody
|
|
33
|
-
|
|
34
|
-
|
|
71
|
+
let loopBody = stmt.body instanceof TirBlockStmt ? stmt.body : new TirBlockStmt([stmt.body], stmt.range);
|
|
72
|
+
loopBody = new TirBlockStmt(loopBody.stmts.slice(), loopBody.range);
|
|
73
|
+
if (stmt.condition) {
|
|
74
|
+
loopBody.stmts.push(new TirContinueStmt(loopBody.range.atEnd()));
|
|
75
|
+
loopBody = new TirBlockStmt([
|
|
76
|
+
new TirIfStmt(stmt.condition,
|
|
77
|
+
// then
|
|
78
|
+
loopBody,
|
|
79
|
+
// else
|
|
80
|
+
new TirBlockStmt([new TirBreakStmt(stmt.condition.range)], stmt.condition.range), stmt.condition.range)
|
|
81
|
+
], loopBody.range);
|
|
82
|
+
}
|
|
83
|
+
// ALWAYS add a final `continue;` to the end of the loop body
|
|
35
84
|
loopBody.stmts.push(new TirContinueStmt(loopBody.range.atEnd()));
|
|
36
85
|
const loopFuncName = getUniqueInternalName("loop");
|
|
37
86
|
const loopFuncType = new TirFuncT(bodyStateType.constructors[0].fields.map(f => f.type), returnType);
|
|
@@ -7,7 +7,7 @@ export function expressifyVarAssignmentStmt(ctx, stmt) {
|
|
|
7
7
|
const originalName = stmt.varIdentifier.resolvedValue.variableInfos.name;
|
|
8
8
|
const latestVarNameSSA = ctx.variables.get(originalName);
|
|
9
9
|
if (!latestVarNameSSA) {
|
|
10
|
-
throw new Error("re-assigning constant variable");
|
|
10
|
+
throw new Error("re-assigning constant variable '" + originalName + "'");
|
|
11
11
|
}
|
|
12
12
|
const newUniqueName = getUniqueInternalName(originalName);
|
|
13
13
|
latestVarNameSSA.latestName = newUniqueName;
|
|
@@ -6,6 +6,7 @@ import { TirSingleDeconstructVarDecl } from "../../tir/statements/TirVarDecl/Tir
|
|
|
6
6
|
import { expressifyVars } from "./expressifyVars.js";
|
|
7
7
|
export function expressifyVarDecl(ctx, stmt) {
|
|
8
8
|
const isConst = stmt.isConst;
|
|
9
|
+
console.log("expressifyVarDecl", stmt);
|
|
9
10
|
if (stmt.initExpr)
|
|
10
11
|
expressifyVars(ctx, stmt.initExpr);
|
|
11
12
|
if (stmt instanceof TirSimpleVarDecl) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SourceRange } from "../../../ast/Source/SourceRange.js";
|
|
2
2
|
import { isTirBinaryExpr } from "../../tir/expressions/binary/TirBinaryExpr.js";
|
|
3
3
|
import { TirLitArrExpr } from "../../tir/expressions/litteral/TirLitArrExpr.js";
|
|
4
|
+
import { TirLitFailExpr } from "../../tir/expressions/litteral/TirLitFailExpr.js";
|
|
4
5
|
import { TirLitFalseExpr } from "../../tir/expressions/litteral/TirLitFalseExpr.js";
|
|
5
6
|
import { TirLitHexBytesExpr } from "../../tir/expressions/litteral/TirLitHexBytesExpr.js";
|
|
6
7
|
import { TirLitIntExpr } from "../../tir/expressions/litteral/TirLitIntExpr.js";
|
|
@@ -32,11 +33,17 @@ import { TirVariableAccessExpr } from "../../tir/expressions/TirVariableAccessEx
|
|
|
32
33
|
import { TirUnaryExclamation } from "../../tir/expressions/unary/TirUnaryExclamation.js";
|
|
33
34
|
import { TirUnaryMinus } from "../../tir/expressions/unary/TirUnaryMinus.js";
|
|
34
35
|
import { TirUnaryPlus } from "../../tir/expressions/unary/TirUnaryPlus.js";
|
|
36
|
+
import { isTirUnaryPrefixExpr } from "../../tir/expressions/unary/TirUnaryPrefixExpr.js";
|
|
35
37
|
import { TirUnaryTilde } from "../../tir/expressions/unary/TirUnaryTilde.js";
|
|
38
|
+
import { bool_t } from "../../tir/program/stdScope/stdScope.js";
|
|
36
39
|
import { TirReturnStmt } from "../../tir/statements/TirReturnStmt.js";
|
|
37
40
|
import { TirArrayLikeDeconstr } from "../../tir/statements/TirVarDecl/TirArrayLikeDeconstr.js";
|
|
38
41
|
import { TirNamedDeconstructVarDecl } from "../../tir/statements/TirVarDecl/TirNamedDeconstructVarDecl.js";
|
|
39
42
|
import { TirSimpleVarDecl } from "../../tir/statements/TirVarDecl/TirSimpleVarDecl.js";
|
|
43
|
+
import { TirAliasType } from "../../tir/types/TirAliasType.js";
|
|
44
|
+
import { TirFuncT, TirListT } from "../../tir/types/TirNativeType/index.js";
|
|
45
|
+
import { TirDataStructType, TirSoPStructType } from "../../tir/types/TirStructType.js";
|
|
46
|
+
import { getListTypeArg } from "../../tir/types/utils/getListTypeArg.js";
|
|
40
47
|
import { getUnaliased } from "../../tir/types/utils/getUnaliased.js";
|
|
41
48
|
import { expressify, expressifyFuncBody } from "./expressify.js";
|
|
42
49
|
import { isExpressifyFuncParam } from "./ExpressifyCtx.js";
|
|
@@ -54,6 +61,7 @@ export function expressifyVars(ctx, expr) {
|
|
|
54
61
|
if (
|
|
55
62
|
// isTirLitteralExpr( expr )
|
|
56
63
|
expr instanceof TirLitVoidExpr
|
|
64
|
+
|| expr instanceof TirLitFailExpr
|
|
57
65
|
|| expr instanceof TirLitUndefExpr
|
|
58
66
|
|| expr instanceof TirLitTrueExpr
|
|
59
67
|
|| expr instanceof TirLitFalseExpr
|
|
@@ -75,7 +83,7 @@ export function expressifyVars(ctx, expr) {
|
|
|
75
83
|
if (expr instanceof TirPropAccessExpr) {
|
|
76
84
|
const objectExpr = expressifyVars(ctx, expr.object);
|
|
77
85
|
expr.object = objectExpr;
|
|
78
|
-
return
|
|
86
|
+
return expressifyPropAccess(ctx, expr);
|
|
79
87
|
}
|
|
80
88
|
if (expr instanceof TirVariableAccessExpr) {
|
|
81
89
|
const originalVarName = expr.resolvedValue.variableInfos.name;
|
|
@@ -90,7 +98,7 @@ export function expressifyVars(ctx, expr) {
|
|
|
90
98
|
// resovledVariable instanceof TirVariableAccessExpr
|
|
91
99
|
return resolvedVariable;
|
|
92
100
|
}
|
|
93
|
-
if (
|
|
101
|
+
if (isTirUnaryPrefixExpr(expr)) {
|
|
94
102
|
const modifiedExpr = expressifyVars(ctx, expr.operand);
|
|
95
103
|
expr.operand = modifiedExpr;
|
|
96
104
|
return expr;
|
|
@@ -102,10 +110,19 @@ export function expressifyVars(ctx, expr) {
|
|
|
102
110
|
return expr;
|
|
103
111
|
}
|
|
104
112
|
if (expr instanceof TirFuncExpr) {
|
|
105
|
-
expressify(expr, undefined, ctx);
|
|
113
|
+
expressify(expr, undefined, ctx.program, ctx);
|
|
106
114
|
return expr;
|
|
107
115
|
}
|
|
108
116
|
if (expr instanceof TirCallExpr) {
|
|
117
|
+
while (expr.func instanceof TirParentesizedExpr)
|
|
118
|
+
expr.func = expr.func.expr;
|
|
119
|
+
if (expr.func instanceof TirPropAccessExpr) {
|
|
120
|
+
for (let i = 0; i < expr.args.length; i++) {
|
|
121
|
+
const arg = expressifyVars(ctx, expr.args[i]);
|
|
122
|
+
expr.args[i] = arg;
|
|
123
|
+
}
|
|
124
|
+
return expressifyMethodCall(ctx, expr);
|
|
125
|
+
}
|
|
109
126
|
const func = expressifyVars(ctx, expr.func);
|
|
110
127
|
expr.func = func;
|
|
111
128
|
for (let i = 0; i < expr.args.length; i++) {
|
|
@@ -193,17 +210,18 @@ export function expressifyVars(ctx, expr) {
|
|
|
193
210
|
}
|
|
194
211
|
if (expr instanceof TirInlineClosedIR)
|
|
195
212
|
return expr;
|
|
196
|
-
const
|
|
213
|
+
const tsEnsureExhautstiveCheck = expr;
|
|
197
214
|
console.error(expr);
|
|
198
215
|
throw new Error("unreachable::expressifyVars");
|
|
199
216
|
}
|
|
200
|
-
function
|
|
217
|
+
function expressifyPropAccess(ctx, propAccessExpr) {
|
|
201
218
|
let expr = propAccessExpr.object;
|
|
202
219
|
const prop = propAccessExpr.prop.text;
|
|
203
220
|
while (expr instanceof TirParentesizedExpr)
|
|
204
221
|
expr = expr.expr;
|
|
205
222
|
if (expr instanceof TirLitVoidExpr
|
|
206
223
|
|| expr instanceof TirLitUndefExpr
|
|
224
|
+
|| expr instanceof TirLitFailExpr
|
|
207
225
|
|| expr instanceof TirLitTrueExpr
|
|
208
226
|
|| expr instanceof TirLitFalseExpr
|
|
209
227
|
// methods on these should have already been converted to functions
|
|
@@ -244,6 +262,7 @@ function getVarAccessFromPropAccess(ctx, propAccessExpr) {
|
|
|
244
262
|
}
|
|
245
263
|
return expr;
|
|
246
264
|
}
|
|
265
|
+
// expressify as normal variable
|
|
247
266
|
if (expr instanceof TirLitObjExpr
|
|
248
267
|
|| expr instanceof TirLitNamedObjExpr) {
|
|
249
268
|
const valIdx = expr.fieldNames.findIndex(f => f.text === prop);
|
|
@@ -288,8 +307,10 @@ function getVarAccessFromPropAccess(ctx, propAccessExpr) {
|
|
|
288
307
|
}
|
|
289
308
|
const objType = getUnaliased(expr.type);
|
|
290
309
|
if (!isSingleConstrStruct(objType)) {
|
|
291
|
-
|
|
292
|
-
|
|
310
|
+
// IMPORTANT: we only care about fields here
|
|
311
|
+
// any methods should have already been converted to functions
|
|
312
|
+
console.error(objType, expr.toString());
|
|
313
|
+
throw new Error(`cannot access property '${prop}' on non-struct type`);
|
|
293
314
|
}
|
|
294
315
|
const ctor = objType.constructors[0];
|
|
295
316
|
const fIdx = ctor.fields.findIndex(f => f.name === prop);
|
|
@@ -315,6 +336,107 @@ function getVarAccessFromPropAccess(ctx, propAccessExpr) {
|
|
|
315
336
|
fType, propAccessExpr.range);
|
|
316
337
|
}
|
|
317
338
|
;
|
|
318
|
-
const
|
|
339
|
+
const tsEnsureExhautstiveCheck = expr;
|
|
319
340
|
throw new Error("Invalid property access expression");
|
|
320
341
|
}
|
|
342
|
+
function expressifyMethodCall(ctx, methodCall) {
|
|
343
|
+
const methodPropAccess = methodCall.func;
|
|
344
|
+
if (!(methodPropAccess instanceof TirPropAccessExpr))
|
|
345
|
+
throw new Error("Invalid method call expression");
|
|
346
|
+
const methodIdentifierProp = methodPropAccess.prop;
|
|
347
|
+
const methodName = methodIdentifierProp.text;
|
|
348
|
+
const objectExpr = expressifyVars(ctx, methodPropAccess.object);
|
|
349
|
+
let objectType = objectExpr.type;
|
|
350
|
+
while (objectType instanceof TirAliasType) {
|
|
351
|
+
const aliasMethds = objectType.methodsNamesPtr;
|
|
352
|
+
const tirMethodName = aliasMethds.get(methodName);
|
|
353
|
+
if (!tirMethodName) {
|
|
354
|
+
objectType = objectType.aliased;
|
|
355
|
+
continue;
|
|
356
|
+
}
|
|
357
|
+
const funcExpr = ctx.program.functions.get(tirMethodName);
|
|
358
|
+
if (!funcExpr)
|
|
359
|
+
throw new Error(`Definition of method '${methodName}' on type '${objectType.toString()}' is missing.`);
|
|
360
|
+
return new TirCallExpr(funcExpr, [objectExpr, ...methodCall.args], methodCall.type, SourceRange.join(methodIdentifierProp.range, methodCall.range.atEnd()));
|
|
361
|
+
}
|
|
362
|
+
if (objectType instanceof TirDataStructType
|
|
363
|
+
|| objectType instanceof TirSoPStructType) {
|
|
364
|
+
const structMethods = objectType.methodNamesPtr;
|
|
365
|
+
const tirMethodName = structMethods.get(methodName);
|
|
366
|
+
if (!tirMethodName)
|
|
367
|
+
throw new Error(`Method '${methodName}' does not exist on type '${objectType.toString()}'`);
|
|
368
|
+
const funcExpr = ctx.program.functions.get(tirMethodName);
|
|
369
|
+
if (!funcExpr)
|
|
370
|
+
throw new Error(`Definition of method '${methodName}' on type '${objectType.toString()}' is missing.`);
|
|
371
|
+
return new TirCallExpr(funcExpr, [objectExpr, ...methodCall.args], methodCall.type, SourceRange.join(methodIdentifierProp.range, methodCall.range.atEnd()));
|
|
372
|
+
}
|
|
373
|
+
if (objectType instanceof TirListT) {
|
|
374
|
+
const result = expressifyListMethodCall(ctx, objectExpr, methodCall, methodName, objectType, SourceRange.join(methodIdentifierProp.range, methodCall.range.atEnd()));
|
|
375
|
+
if (result)
|
|
376
|
+
return result;
|
|
377
|
+
}
|
|
378
|
+
throw new Error(`not implemented::expressifyMethodCall for type '${objectType.toString()}' (method name: '${methodName}')`);
|
|
379
|
+
// const tsEnsureExhautstiveCheck: never = objectType;
|
|
380
|
+
throw new Error(`Cannot call method '${methodName}' on non-struct type '${objectType.toString()}'`);
|
|
381
|
+
}
|
|
382
|
+
function expressifyListMethodCall(ctx, objectExpr, methodCall, methodName, listType, exprRange) {
|
|
383
|
+
const elemsType = getListTypeArg(listType);
|
|
384
|
+
if (!elemsType)
|
|
385
|
+
throw new Error("Invalid list type");
|
|
386
|
+
if (methodName === "length") {
|
|
387
|
+
if (methodCall.args.length !== 0)
|
|
388
|
+
throw new Error(`Method 'length' of type 'list' takes 0 arguments, ${methodCall.args.length} provided`);
|
|
389
|
+
return new TirCallExpr(TirNativeFunc._length(elemsType), [objectExpr], methodCall.type, exprRange);
|
|
390
|
+
}
|
|
391
|
+
if (methodName === "some") {
|
|
392
|
+
if (methodCall.args.length !== 1)
|
|
393
|
+
throw new Error(`Method 'includes' of type 'list' takes 1 argument, ${methodCall.args.length} provided`);
|
|
394
|
+
return new TirCallExpr(TirNativeFunc._some(elemsType), [methodCall.args[0], objectExpr], methodCall.type, exprRange);
|
|
395
|
+
}
|
|
396
|
+
if (methodName === "every") {
|
|
397
|
+
if (methodCall.args.length !== 1)
|
|
398
|
+
throw new Error(`Method 'every' of type 'list' takes 1 argument, ${methodCall.args.length} provided`);
|
|
399
|
+
return new TirCallExpr(TirNativeFunc._every(elemsType), [methodCall.args[0], objectExpr], methodCall.type, exprRange);
|
|
400
|
+
}
|
|
401
|
+
if (methodName === "includes") {
|
|
402
|
+
if (methodCall.args.length !== 1)
|
|
403
|
+
throw new Error(`Method 'includes' of type 'list' takes 1 argument, ${methodCall.args.length} provided`);
|
|
404
|
+
return new TirCallExpr(TirNativeFunc._some(elemsType), [
|
|
405
|
+
new TirCallExpr(TirNativeFunc._equals(elemsType), [methodCall.args[0]], new TirFuncT([elemsType], bool_t), methodCall.args[0].range),
|
|
406
|
+
objectExpr
|
|
407
|
+
], methodCall.type, exprRange);
|
|
408
|
+
}
|
|
409
|
+
if (methodName === "head") {
|
|
410
|
+
if (methodCall.args.length !== 0)
|
|
411
|
+
throw new Error(`Method 'head' of type 'list' takes 0 arguments, ${methodCall.args.length} provided`);
|
|
412
|
+
return new TirCallExpr(TirNativeFunc.headList(elemsType), [objectExpr], methodCall.type, exprRange);
|
|
413
|
+
}
|
|
414
|
+
if (methodName === "tail") {
|
|
415
|
+
if (methodCall.args.length !== 0)
|
|
416
|
+
throw new Error(`Method 'tail' of type 'list' takes 0 arguments, ${methodCall.args.length} provided`);
|
|
417
|
+
return new TirCallExpr(TirNativeFunc.tailList(elemsType), [objectExpr], methodCall.type, exprRange);
|
|
418
|
+
}
|
|
419
|
+
if (methodName === "isEmpty") {
|
|
420
|
+
if (methodCall.args.length !== 0)
|
|
421
|
+
throw new Error(`Method 'isEmpty' of type 'list' takes 0 arguments, ${methodCall.args.length} provided`);
|
|
422
|
+
return new TirCallExpr(TirNativeFunc.nullList(elemsType), [objectExpr], methodCall.type, exprRange);
|
|
423
|
+
}
|
|
424
|
+
// TODO
|
|
425
|
+
/*
|
|
426
|
+
{
|
|
427
|
+
isEmpty: new TirFuncT( [], bool_t ),
|
|
428
|
+
show: new TirFuncT( [], bytes_t ),
|
|
429
|
+
reverse: new TirFuncT( [], new TirListT( elemsType ) ),
|
|
430
|
+
find: new TirFuncT([
|
|
431
|
+
new TirFuncT( [elemsType], bool_t )
|
|
432
|
+
], new TirSopOptT( elemsType ) ),
|
|
433
|
+
filter: new TirFuncT([
|
|
434
|
+
new TirFuncT( [elemsType], bool_t )
|
|
435
|
+
], new TirListT( elemsType ) ),
|
|
436
|
+
prepend: new TirFuncT( [elemsType], new TirListT( elemsType ) ),
|
|
437
|
+
map: new TirFuncT([
|
|
438
|
+
new TirFuncT([ elemsType ], mapReturnT )
|
|
439
|
+
], new TirListT( mapReturnT ) ),
|
|
440
|
+
};
|
|
441
|
+
*/
|
|
442
|
+
}
|
|
@@ -13,9 +13,11 @@ export function _compileHoistedDeps(program, hoistedMap, deps, depsStack) {
|
|
|
13
13
|
const funcExpr = funcDecl instanceof TirInlineClosedIR ? funcDecl : expressify(
|
|
14
14
|
funcDecl,
|
|
15
15
|
undefined, // loopReplacements
|
|
16
|
+
program,
|
|
16
17
|
new ExpressifyCtx(
|
|
17
18
|
undefined,
|
|
18
19
|
funcDecl.returnType,
|
|
20
|
+
program,
|
|
19
21
|
hoistedMap
|
|
20
22
|
)
|
|
21
23
|
);
|
|
@@ -27,7 +29,7 @@ export function _compileHoistedDeps(program, hoistedMap, deps, depsStack) {
|
|
|
27
29
|
const constDecl = program.constants.get(depName);
|
|
28
30
|
if (constDecl) {
|
|
29
31
|
_compileHoistedDeps(program, hoistedMap, constDecl.deps(), depsStack.getNext(depName));
|
|
30
|
-
const expr = expressifyVars(new ExpressifyCtx(undefined, constDecl.type, hoistedMap), constDecl);
|
|
32
|
+
const expr = expressifyVars(new ExpressifyCtx(undefined, constDecl.type, program, hoistedMap), constDecl);
|
|
31
33
|
const hoistedExpr = new TirHoistedExpr(depName, expr);
|
|
32
34
|
hoistedMap.set(depName, hoistedExpr);
|
|
33
35
|
continue;
|
|
@@ -4,6 +4,7 @@ export interface IOutputStream {
|
|
|
4
4
|
write(chunk: Uint8Array | string): void;
|
|
5
5
|
}
|
|
6
6
|
export declare class ConsoleLogStream implements IOutputStream {
|
|
7
|
+
private _pending;
|
|
7
8
|
write(chunk: Uint8Array | string): void;
|
|
8
9
|
}
|
|
9
10
|
export declare class ConsoleErrorStream implements IOutputStream {
|