@algorandfoundation/puya-ts 1.0.0-alpha.4
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/README.md +11 -0
- package/awst/index.d.ts +4 -0
- package/awst/intrinsic-factory.d.ts +35 -0
- package/awst/json-serialize-awst.d.ts +17 -0
- package/awst/models.d.ts +85 -0
- package/awst/node-factory.d.ts +90 -0
- package/awst/nodes.d.ts +841 -0
- package/awst/source-location.d.ts +21 -0
- package/awst/to-code-visitor.d.ts +87 -0
- package/awst/txn-fields.d.ts +84 -0
- package/awst/util.d.ts +2 -0
- package/awst/wtypes.d.ts +131 -0
- package/awst_build/base-visitor.d.ts +87 -0
- package/awst_build/constructor-visitor.d.ts +18 -0
- package/awst_build/context/awst-build-context.d.ts +72 -0
- package/awst_build/context/evaluation-context.d.ts +11 -0
- package/awst_build/context/switch-loop-context.d.ts +31 -0
- package/awst_build/context/unique-name-resolver.d.ts +14 -0
- package/awst_build/contract-data.d.ts +24 -0
- package/awst_build/contract-method-visitor.d.ts +20 -0
- package/awst_build/contract-visitor.d.ts +33 -0
- package/awst_build/decorator-visitor.d.ts +34 -0
- package/awst_build/eb/arc4/arrays.d.ts +31 -0
- package/awst_build/eb/arc4/uint-n-constructor-builder.d.ts +14 -0
- package/awst_build/eb/arc4-bare-method-decorator-builder.d.ts +19 -0
- package/awst_build/eb/assert-function-builder.d.ts +10 -0
- package/awst_build/eb/assert-match-function-builder.d.ts +8 -0
- package/awst_build/eb/biguint-expression-builder.d.ts +21 -0
- package/awst_build/eb/boolean-expression-builder.d.ts +15 -0
- package/awst_build/eb/bytes-expression-builder.d.ts +44 -0
- package/awst_build/eb/contract-builder.d.ts +19 -0
- package/awst_build/eb/ensure-budget.d.ts +8 -0
- package/awst_build/eb/folding.d.ts +5 -0
- package/awst_build/eb/free-subroutine-expression-builder.d.ts +22 -0
- package/awst_build/eb/index.d.ts +90 -0
- package/awst_build/eb/intrinsic-enum-builder.d.ts +9 -0
- package/awst_build/eb/iterable-iterator-expression-builder.d.ts +10 -0
- package/awst_build/eb/literal/array-literal-expression-builder.d.ts +19 -0
- package/awst_build/eb/literal/big-int-literal-expression-builder.d.ts +19 -0
- package/awst_build/eb/literal/conditional-expression-builder.d.ts +22 -0
- package/awst_build/eb/literal/object-expression-builder.d.ts +13 -0
- package/awst_build/eb/literal/object-literal-expression-builder.d.ts +28 -0
- package/awst_build/eb/literal-expression-builder.d.ts +27 -0
- package/awst_build/eb/log-function-builder.d.ts +7 -0
- package/awst_build/eb/namespace-builder.d.ts +9 -0
- package/awst_build/eb/native-array-expression-builder.d.ts +8 -0
- package/awst_build/eb/omitted-expression-builder.d.ts +9 -0
- package/awst_build/eb/op-module-builder.d.ts +25 -0
- package/awst_build/eb/reference/account.d.ts +15 -0
- package/awst_build/eb/reference/application.d.ts +12 -0
- package/awst_build/eb/reference/asset.d.ts +13 -0
- package/awst_build/eb/reference/base.d.ts +37 -0
- package/awst_build/eb/storage/box.d.ts +50 -0
- package/awst_build/eb/storage/global-state.d.ts +29 -0
- package/awst_build/eb/storage/local-state.d.ts +32 -0
- package/awst_build/eb/storage/util.d.ts +5 -0
- package/awst_build/eb/storage/value-proxy.d.ts +22 -0
- package/awst_build/eb/string-expression-builder.d.ts +27 -0
- package/awst_build/eb/transactions/group-transactions.d.ts +15 -0
- package/awst_build/eb/transactions/inner-transaction-params.d.ts +19 -0
- package/awst_build/eb/transactions/inner-transactions.d.ts +10 -0
- package/awst_build/eb/transactions/txn-fields.d.ts +1317 -0
- package/awst_build/eb/transactions/util.d.ts +5 -0
- package/awst_build/eb/tuple-expression-builder.d.ts +12 -0
- package/awst_build/eb/uint64-enum-type-builder.d.ts +13 -0
- package/awst_build/eb/uint64-expression-builder.d.ts +21 -0
- package/awst_build/eb/urange-function.d.ts +7 -0
- package/awst_build/eb/util/arg-parsing.d.ts +106 -0
- package/awst_build/eb/util/compare-bytes.d.ts +5 -0
- package/awst_build/eb/util/compare-uint64.d.ts +5 -0
- package/awst_build/eb/util/index.d.ts +19 -0
- package/awst_build/eb/util/require-constant-value.d.ts +4 -0
- package/awst_build/eb/void-expression-builder.d.ts +7 -0
- package/awst_build/function-visitor.d.ts +45 -0
- package/awst_build/index.d.ts +5 -0
- package/awst_build/lib/index.d.ts +2 -0
- package/awst_build/op-metadata.d.ts +27 -0
- package/awst_build/ptypes/arc4-types.d.ts +56 -0
- package/awst_build/ptypes/base.d.ts +31 -0
- package/awst_build/ptypes/index.d.ts +455 -0
- package/awst_build/ptypes/intrinsic-enum-type.d.ts +14 -0
- package/awst_build/ptypes/op-ptypes.d.ts +6 -0
- package/awst_build/ptypes/register.d.ts +2 -0
- package/awst_build/source-file-visitor.d.ts +21 -0
- package/awst_build/subroutine-visitor.d.ts +10 -0
- package/awst_build/symbol-name.d.ts +10 -0
- package/awst_build/text-visitor.d.ts +20 -0
- package/awst_build/type-registry.d.ts +61 -0
- package/awst_build/type-resolver.d.ts +18 -0
- package/bin/run-cli.d.ts +2 -0
- package/bin/run-cli.mjs +20 -0
- package/bin/run-cli.mjs.map +1 -0
- package/cli.d.ts +1 -0
- package/cli.mjs +146 -0
- package/cli.mjs.map +1 -0
- package/compile-options.d.ts +17 -0
- package/constants.d.ts +20 -0
- package/errors.d.ts +46 -0
- package/index-D6W2FUFQ.js +16297 -0
- package/index-D6W2FUFQ.js.map +1 -0
- package/index.d.ts +19 -0
- package/index.mjs +15 -0
- package/index.mjs.map +1 -0
- package/logger.d.ts +39 -0
- package/node_modules/typescript/LICENSE.txt +55 -0
- package/node_modules/typescript/README.md +50 -0
- package/node_modules/typescript/SECURITY.md +41 -0
- package/node_modules/typescript/ThirdPartyNoticeText.txt +193 -0
- package/node_modules/typescript/bin/tsc +2 -0
- package/node_modules/typescript/bin/tsserver +2 -0
- package/node_modules/typescript/lib/cancellationToken.js +90 -0
- package/node_modules/typescript/lib/cs/diagnosticMessages.generated.json +2087 -0
- package/node_modules/typescript/lib/de/diagnosticMessages.generated.json +2087 -0
- package/node_modules/typescript/lib/es/diagnosticMessages.generated.json +2087 -0
- package/node_modules/typescript/lib/fr/diagnosticMessages.generated.json +2087 -0
- package/node_modules/typescript/lib/it/diagnosticMessages.generated.json +2087 -0
- package/node_modules/typescript/lib/ja/diagnosticMessages.generated.json +2087 -0
- package/node_modules/typescript/lib/ko/diagnosticMessages.generated.json +2087 -0
- package/node_modules/typescript/lib/lib.d.ts +22 -0
- package/node_modules/typescript/lib/lib.decorators.d.ts +386 -0
- package/node_modules/typescript/lib/lib.decorators.legacy.d.ts +22 -0
- package/node_modules/typescript/lib/lib.dom.asynciterable.d.ts +41 -0
- package/node_modules/typescript/lib/lib.dom.d.ts +28087 -0
- package/node_modules/typescript/lib/lib.dom.iterable.d.ts +491 -0
- package/node_modules/typescript/lib/lib.es2015.collection.d.ts +147 -0
- package/node_modules/typescript/lib/lib.es2015.core.d.ts +597 -0
- package/node_modules/typescript/lib/lib.es2015.d.ts +28 -0
- package/node_modules/typescript/lib/lib.es2015.generator.d.ts +77 -0
- package/node_modules/typescript/lib/lib.es2015.iterable.d.ts +527 -0
- package/node_modules/typescript/lib/lib.es2015.promise.d.ts +81 -0
- package/node_modules/typescript/lib/lib.es2015.proxy.d.ts +128 -0
- package/node_modules/typescript/lib/lib.es2015.reflect.d.ts +144 -0
- package/node_modules/typescript/lib/lib.es2015.symbol.d.ts +46 -0
- package/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts +326 -0
- package/node_modules/typescript/lib/lib.es2016.array.include.d.ts +116 -0
- package/node_modules/typescript/lib/lib.es2016.d.ts +21 -0
- package/node_modules/typescript/lib/lib.es2016.full.d.ts +23 -0
- package/node_modules/typescript/lib/lib.es2016.intl.d.ts +31 -0
- package/node_modules/typescript/lib/lib.es2017.d.ts +25 -0
- package/node_modules/typescript/lib/lib.es2017.date.d.ts +31 -0
- package/node_modules/typescript/lib/lib.es2017.full.d.ts +23 -0
- package/node_modules/typescript/lib/lib.es2017.intl.d.ts +44 -0
- package/node_modules/typescript/lib/lib.es2017.object.d.ts +49 -0
- package/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts +135 -0
- package/node_modules/typescript/lib/lib.es2017.string.d.ts +45 -0
- package/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts +53 -0
- package/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts +77 -0
- package/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts +53 -0
- package/node_modules/typescript/lib/lib.es2018.d.ts +24 -0
- package/node_modules/typescript/lib/lib.es2018.full.d.ts +24 -0
- package/node_modules/typescript/lib/lib.es2018.intl.d.ts +83 -0
- package/node_modules/typescript/lib/lib.es2018.promise.d.ts +30 -0
- package/node_modules/typescript/lib/lib.es2018.regexp.d.ts +37 -0
- package/node_modules/typescript/lib/lib.es2019.array.d.ts +79 -0
- package/node_modules/typescript/lib/lib.es2019.d.ts +24 -0
- package/node_modules/typescript/lib/lib.es2019.full.d.ts +24 -0
- package/node_modules/typescript/lib/lib.es2019.intl.d.ts +23 -0
- package/node_modules/typescript/lib/lib.es2019.object.d.ts +33 -0
- package/node_modules/typescript/lib/lib.es2019.string.d.ts +37 -0
- package/node_modules/typescript/lib/lib.es2019.symbol.d.ts +24 -0
- package/node_modules/typescript/lib/lib.es2020.bigint.d.ts +727 -0
- package/node_modules/typescript/lib/lib.es2020.d.ts +27 -0
- package/node_modules/typescript/lib/lib.es2020.date.d.ts +42 -0
- package/node_modules/typescript/lib/lib.es2020.full.d.ts +24 -0
- package/node_modules/typescript/lib/lib.es2020.intl.d.ts +474 -0
- package/node_modules/typescript/lib/lib.es2020.number.d.ts +28 -0
- package/node_modules/typescript/lib/lib.es2020.promise.d.ts +47 -0
- package/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts +97 -0
- package/node_modules/typescript/lib/lib.es2020.string.d.ts +42 -0
- package/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts +41 -0
- package/node_modules/typescript/lib/lib.es2021.d.ts +23 -0
- package/node_modules/typescript/lib/lib.es2021.full.d.ts +24 -0
- package/node_modules/typescript/lib/lib.es2021.intl.d.ts +166 -0
- package/node_modules/typescript/lib/lib.es2021.promise.d.ts +48 -0
- package/node_modules/typescript/lib/lib.es2021.string.d.ts +33 -0
- package/node_modules/typescript/lib/lib.es2021.weakref.d.ts +76 -0
- package/node_modules/typescript/lib/lib.es2022.array.d.ts +121 -0
- package/node_modules/typescript/lib/lib.es2022.d.ts +26 -0
- package/node_modules/typescript/lib/lib.es2022.error.d.ts +73 -0
- package/node_modules/typescript/lib/lib.es2022.full.d.ts +24 -0
- package/node_modules/typescript/lib/lib.es2022.intl.d.ts +121 -0
- package/node_modules/typescript/lib/lib.es2022.object.d.ts +26 -0
- package/node_modules/typescript/lib/lib.es2022.regexp.d.ts +39 -0
- package/node_modules/typescript/lib/lib.es2022.sharedmemory.d.ts +39 -0
- package/node_modules/typescript/lib/lib.es2022.string.d.ts +25 -0
- package/node_modules/typescript/lib/lib.es2023.array.d.ts +924 -0
- package/node_modules/typescript/lib/lib.es2023.collection.d.ts +21 -0
- package/node_modules/typescript/lib/lib.es2023.d.ts +22 -0
- package/node_modules/typescript/lib/lib.es2023.full.d.ts +24 -0
- package/node_modules/typescript/lib/lib.es2023.intl.d.ts +56 -0
- package/node_modules/typescript/lib/lib.es5.d.ts +4585 -0
- package/node_modules/typescript/lib/lib.es6.d.ts +23 -0
- package/node_modules/typescript/lib/lib.esnext.array.d.ts +35 -0
- package/node_modules/typescript/lib/lib.esnext.collection.d.ts +106 -0
- package/node_modules/typescript/lib/lib.esnext.d.ts +29 -0
- package/node_modules/typescript/lib/lib.esnext.decorators.d.ts +28 -0
- package/node_modules/typescript/lib/lib.esnext.disposable.d.ts +193 -0
- package/node_modules/typescript/lib/lib.esnext.full.d.ts +24 -0
- package/node_modules/typescript/lib/lib.esnext.intl.d.ts +21 -0
- package/node_modules/typescript/lib/lib.esnext.iterator.d.ts +148 -0
- package/node_modules/typescript/lib/lib.esnext.object.d.ts +29 -0
- package/node_modules/typescript/lib/lib.esnext.promise.d.ts +35 -0
- package/node_modules/typescript/lib/lib.esnext.regexp.d.ts +25 -0
- package/node_modules/typescript/lib/lib.esnext.string.d.ts +29 -0
- package/node_modules/typescript/lib/lib.scripthost.d.ts +322 -0
- package/node_modules/typescript/lib/lib.webworker.asynciterable.d.ts +41 -0
- package/node_modules/typescript/lib/lib.webworker.d.ts +9410 -0
- package/node_modules/typescript/lib/lib.webworker.importscripts.d.ts +23 -0
- package/node_modules/typescript/lib/lib.webworker.iterable.d.ts +288 -0
- package/node_modules/typescript/lib/pl/diagnosticMessages.generated.json +2087 -0
- package/node_modules/typescript/lib/pt-br/diagnosticMessages.generated.json +2087 -0
- package/node_modules/typescript/lib/ru/diagnosticMessages.generated.json +2087 -0
- package/node_modules/typescript/lib/tr/diagnosticMessages.generated.json +2087 -0
- package/node_modules/typescript/lib/tsc.js +130771 -0
- package/node_modules/typescript/lib/tsserver.js +623 -0
- package/node_modules/typescript/lib/tsserverlibrary.d.ts +17 -0
- package/node_modules/typescript/lib/tsserverlibrary.js +21 -0
- package/node_modules/typescript/lib/typesMap.json +497 -0
- package/node_modules/typescript/lib/typescript.d.ts +11329 -0
- package/node_modules/typescript/lib/typescript.js +196077 -0
- package/node_modules/typescript/lib/typingsInstaller.js +236 -0
- package/node_modules/typescript/lib/watchGuard.js +53 -0
- package/node_modules/typescript/lib/zh-cn/diagnosticMessages.generated.json +2087 -0
- package/node_modules/typescript/lib/zh-tw/diagnosticMessages.generated.json +2087 -0
- package/node_modules/typescript/package.json +121 -0
- package/package.json +42 -0
- package/parser/index.d.ts +13 -0
- package/parser/json-serialize-source-files.d.ts +2 -0
- package/parser/resolve-module-name-literals.d.ts +2 -0
- package/puya/build-compilation-set-mapping.d.ts +10 -0
- package/puya/index.d.ts +13 -0
- package/puya/options.d.ts +29 -0
- package/puya/run-child-proc.d.ts +5 -0
- package/util/base-32.d.ts +2 -0
- package/util/base-85.d.ts +10 -0
- package/util/default-map.d.ts +1 -0
- package/util/generate-temp-file.d.ts +9 -0
- package/util/index.d.ts +43 -0
- package/visitor/syntax-names.d.ts +441 -0
- package/visitor/visitor.d.ts +26 -0
- package/write-artifact.d.ts +12 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type ts from 'typescript';
|
|
2
|
+
export declare class SourceLocation {
|
|
3
|
+
file: string;
|
|
4
|
+
line: number;
|
|
5
|
+
endLine: number;
|
|
6
|
+
column: number;
|
|
7
|
+
endColumn: number;
|
|
8
|
+
constructor(props: {
|
|
9
|
+
file: string;
|
|
10
|
+
line: number;
|
|
11
|
+
endLine: number;
|
|
12
|
+
column: number;
|
|
13
|
+
endColumn: number;
|
|
14
|
+
});
|
|
15
|
+
static fromNode(sourceFile: ts.SourceFile, node: ts.Node, programDirectory: string): SourceLocation;
|
|
16
|
+
static fromFile(sourceFile: ts.SourceFile, programDirectory: string): SourceLocation;
|
|
17
|
+
static fromTextRange(sourceFile: ts.SourceFile, textRange: ts.TextRange, programDirectory: string): SourceLocation;
|
|
18
|
+
static fromDiagnostic(diagnostic: ts.DiagnosticWithLocation, programDirectory: string): SourceLocation;
|
|
19
|
+
toString(): string;
|
|
20
|
+
static fromLocations(...sourceLocation: SourceLocation[]): SourceLocation;
|
|
21
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { AppStorageDefinition, ContractMemberNodeVisitor, ExpressionVisitor, RootNodeVisitor, StatementVisitor } from './nodes';
|
|
2
|
+
import * as nodes from './nodes';
|
|
3
|
+
export declare class ToCodeVisitor implements RootNodeVisitor<string[]>, ContractMemberNodeVisitor<string[]>, StatementVisitor<string[]>, ExpressionVisitor<string> {
|
|
4
|
+
#private;
|
|
5
|
+
visitRange(expression: nodes.Range): string;
|
|
6
|
+
visitVoidConstant(expression: nodes.VoidConstant): string;
|
|
7
|
+
visitGroupTransactionReference(expression: nodes.GroupTransactionReference): string;
|
|
8
|
+
visitPuyaLibCall(expression: nodes.PuyaLibCall): string;
|
|
9
|
+
visitARC4Router(expression: nodes.ARC4Router): string;
|
|
10
|
+
visitAppStorageDefinition(contractMemberNode: AppStorageDefinition): string[];
|
|
11
|
+
visitUInt64PostfixUnaryOperation(expression: nodes.UInt64PostfixUnaryOperation): string;
|
|
12
|
+
visitBigUIntPostfixUnaryOperation(expression: nodes.BigUIntPostfixUnaryOperation): string;
|
|
13
|
+
visitCompiledContract(expression: nodes.CompiledContract): string;
|
|
14
|
+
visitCompiledLogicSig(expression: nodes.CompiledLogicSig): string;
|
|
15
|
+
visitLoopExit(statement: nodes.LoopExit): string[];
|
|
16
|
+
visitLoopContinue(statement: nodes.LoopContinue): string[];
|
|
17
|
+
visitGoto(statement: nodes.Goto): string[];
|
|
18
|
+
visitIntersectionSliceExpression(expression: nodes.IntersectionSliceExpression): string;
|
|
19
|
+
visitBoxValueExpression(expression: nodes.BoxValueExpression): string;
|
|
20
|
+
visitIntegerConstant(expression: nodes.IntegerConstant): string;
|
|
21
|
+
visitDecimalConstant(expression: nodes.DecimalConstant): string;
|
|
22
|
+
visitBoolConstant(expression: nodes.BoolConstant): string;
|
|
23
|
+
visitBytesConstant(expression: nodes.BytesConstant): string;
|
|
24
|
+
visitStringConstant(expression: nodes.StringConstant): string;
|
|
25
|
+
visitTemplateVar(expression: nodes.TemplateVar): string;
|
|
26
|
+
visitMethodConstant(expression: nodes.MethodConstant): string;
|
|
27
|
+
visitAddressConstant(expression: nodes.AddressConstant): string;
|
|
28
|
+
visitARC4Encode(expression: nodes.ARC4Encode): string;
|
|
29
|
+
visitCopy(expression: nodes.Copy): string;
|
|
30
|
+
visitArrayConcat(expression: nodes.ArrayConcat): string;
|
|
31
|
+
visitArrayPop(expression: nodes.ArrayPop): string;
|
|
32
|
+
visitArrayExtend(expression: nodes.ArrayExtend): string;
|
|
33
|
+
visitARC4Decode(expression: nodes.ARC4Decode): string;
|
|
34
|
+
visitIntrinsicCall(expression: nodes.IntrinsicCall): string;
|
|
35
|
+
visitCreateInnerTransaction(expression: nodes.CreateInnerTransaction): string;
|
|
36
|
+
visitUpdateInnerTransaction(expression: nodes.UpdateInnerTransaction): string;
|
|
37
|
+
visitCheckedMaybe(expression: nodes.CheckedMaybe): string;
|
|
38
|
+
visitTupleExpression(expression: nodes.TupleExpression): string;
|
|
39
|
+
visitTupleItemExpression(expression: nodes.TupleItemExpression): string;
|
|
40
|
+
visitVarExpression(expression: nodes.VarExpression): string;
|
|
41
|
+
visitInnerTransactionField(expression: nodes.InnerTransactionField): string;
|
|
42
|
+
visitSubmitInnerTransaction(expression: nodes.SubmitInnerTransaction): string;
|
|
43
|
+
visitFieldExpression(expression: nodes.FieldExpression): string;
|
|
44
|
+
visitIndexExpression(expression: nodes.IndexExpression): string;
|
|
45
|
+
visitSliceExpression(expression: nodes.SliceExpression): string;
|
|
46
|
+
visitAppStateExpression(expression: nodes.AppStateExpression): string;
|
|
47
|
+
visitAppAccountStateExpression(expression: nodes.AppAccountStateExpression): string;
|
|
48
|
+
visitSingleEvaluation(expression: nodes.SingleEvaluation): string;
|
|
49
|
+
visitReinterpretCast(expression: nodes.ReinterpretCast): string;
|
|
50
|
+
visitNewArray(expression: nodes.NewArray): string;
|
|
51
|
+
visitConditionalExpression(expression: nodes.ConditionalExpression): string;
|
|
52
|
+
visitAssignmentExpression(expression: nodes.AssignmentExpression): string;
|
|
53
|
+
visitNumericComparisonExpression(expression: nodes.NumericComparisonExpression): string;
|
|
54
|
+
visitBytesComparisonExpression(expression: nodes.BytesComparisonExpression): string;
|
|
55
|
+
visitSubroutineCallExpression(expression: nodes.SubroutineCallExpression): string;
|
|
56
|
+
visitCallTarget(target: nodes.SubroutineCallExpression['target']): string;
|
|
57
|
+
visitUInt64UnaryOperation(expression: nodes.UInt64UnaryOperation): string;
|
|
58
|
+
visitBytesUnaryOperation(expression: nodes.BytesUnaryOperation): string;
|
|
59
|
+
visitUInt64BinaryOperation(expression: nodes.UInt64BinaryOperation): string;
|
|
60
|
+
visitBigUIntBinaryOperation(expression: nodes.BigUIntBinaryOperation): string;
|
|
61
|
+
visitBytesBinaryOperation(expression: nodes.BytesBinaryOperation): string;
|
|
62
|
+
visitBooleanBinaryOperation(expression: nodes.BooleanBinaryOperation): string;
|
|
63
|
+
visitNot(expression: nodes.Not): string;
|
|
64
|
+
visitEnumeration(expression: nodes.Enumeration): string;
|
|
65
|
+
visitReversed(expression: nodes.Reversed): string;
|
|
66
|
+
visitStateGet(expression: nodes.StateGet): string;
|
|
67
|
+
visitStateDelete(expression: nodes.StateDelete): string;
|
|
68
|
+
visitStateGetEx(expression: nodes.StateGetEx): string;
|
|
69
|
+
visitStateExists(expression: nodes.StateExists): string;
|
|
70
|
+
visitNewStruct(expression: nodes.NewStruct): string;
|
|
71
|
+
visitExpressionStatement(statement: nodes.ExpressionStatement): string[];
|
|
72
|
+
visitBlock(statement: nodes.Block): string[];
|
|
73
|
+
visitIfElse(statement: nodes.IfElse): string[];
|
|
74
|
+
visitSwitch(statement: nodes.Switch): string[];
|
|
75
|
+
visitWhileLoop(statement: nodes.WhileLoop): string[];
|
|
76
|
+
visitReturnStatement(statement: nodes.ReturnStatement): string[];
|
|
77
|
+
visitAssignmentStatement(statement: nodes.AssignmentStatement): string[];
|
|
78
|
+
visitUInt64AugmentedAssignment(statement: nodes.UInt64AugmentedAssignment): string[];
|
|
79
|
+
visitBigUIntAugmentedAssignment(statement: nodes.BigUIntAugmentedAssignment): string[];
|
|
80
|
+
visitBytesAugmentedAssignment(statement: nodes.BytesAugmentedAssignment): string[];
|
|
81
|
+
visitForInLoop(statement: nodes.ForInLoop): string[];
|
|
82
|
+
visitSubroutine(moduleStatement: nodes.Subroutine): string[];
|
|
83
|
+
visitContractMethod(statement: nodes.ContractMethod): string[];
|
|
84
|
+
visitLogicSignature(moduleStatement: nodes.LogicSignature): string[];
|
|
85
|
+
visitContractFragment(c: nodes.ContractFragment): string[];
|
|
86
|
+
visitSpecialMethod(statement: nodes.ContractMethod, name: string): string[];
|
|
87
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { wtypes } from './index';
|
|
2
|
+
export declare class TxnFieldData {
|
|
3
|
+
readonly immediate: string;
|
|
4
|
+
readonly wtype: wtypes.WType;
|
|
5
|
+
readonly numValues: number;
|
|
6
|
+
readonly isInnerParam: boolean;
|
|
7
|
+
constructor(data: {
|
|
8
|
+
field: TxnField;
|
|
9
|
+
wtype: wtypes.WType;
|
|
10
|
+
numValues?: number;
|
|
11
|
+
isInnerParam?: boolean;
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
export declare enum TxnField {
|
|
15
|
+
Sender = "Sender",
|
|
16
|
+
Fee = "Fee",
|
|
17
|
+
FirstValid = "FirstValid",
|
|
18
|
+
FirstValidTime = "FirstValidTime",
|
|
19
|
+
LastValid = "LastValid",
|
|
20
|
+
Note = "Note",
|
|
21
|
+
Lease = "Lease",
|
|
22
|
+
Receiver = "Receiver",
|
|
23
|
+
Amount = "Amount",
|
|
24
|
+
CloseRemainderTo = "CloseRemainderTo",
|
|
25
|
+
VotePK = "VotePK",
|
|
26
|
+
SelectionPK = "SelectionPK",
|
|
27
|
+
VoteFirst = "VoteFirst",
|
|
28
|
+
VoteLast = "VoteLast",
|
|
29
|
+
VoteKeyDilution = "VoteKeyDilution",
|
|
30
|
+
Type = "Type",
|
|
31
|
+
TypeEnum = "TypeEnum",
|
|
32
|
+
XferAsset = "XferAsset",
|
|
33
|
+
AssetAmount = "AssetAmount",
|
|
34
|
+
AssetSender = "AssetSender",
|
|
35
|
+
AssetReceiver = "AssetReceiver",
|
|
36
|
+
AssetCloseTo = "AssetCloseTo",
|
|
37
|
+
GroupIndex = "GroupIndex",
|
|
38
|
+
TxID = "TxID",
|
|
39
|
+
ApplicationID = "ApplicationID",
|
|
40
|
+
OnCompletion = "OnCompletion",
|
|
41
|
+
NumAppArgs = "NumAppArgs",
|
|
42
|
+
NumAccounts = "NumAccounts",
|
|
43
|
+
ApprovalProgram = "ApprovalProgram",
|
|
44
|
+
ClearStateProgram = "ClearStateProgram",
|
|
45
|
+
RekeyTo = "RekeyTo",
|
|
46
|
+
ConfigAsset = "ConfigAsset",
|
|
47
|
+
ConfigAssetTotal = "ConfigAssetTotal",
|
|
48
|
+
ConfigAssetDecimals = "ConfigAssetDecimals",
|
|
49
|
+
ConfigAssetDefaultFrozen = "ConfigAssetDefaultFrozen",
|
|
50
|
+
ConfigAssetUnitName = "ConfigAssetUnitName",
|
|
51
|
+
ConfigAssetName = "ConfigAssetName",
|
|
52
|
+
ConfigAssetURL = "ConfigAssetURL",
|
|
53
|
+
ConfigAssetMetadataHash = "ConfigAssetMetadataHash",
|
|
54
|
+
ConfigAssetManager = "ConfigAssetManager",
|
|
55
|
+
ConfigAssetReserve = "ConfigAssetReserve",
|
|
56
|
+
ConfigAssetFreeze = "ConfigAssetFreeze",
|
|
57
|
+
ConfigAssetClawback = "ConfigAssetClawback",
|
|
58
|
+
FreezeAsset = "FreezeAsset",
|
|
59
|
+
FreezeAssetAccount = "FreezeAssetAccount",
|
|
60
|
+
FreezeAssetFrozen = "FreezeAssetFrozen",
|
|
61
|
+
NumAssets = "NumAssets",
|
|
62
|
+
NumApplications = "NumApplications",
|
|
63
|
+
GlobalNumUint = "GlobalNumUint",
|
|
64
|
+
GlobalNumByteSlice = "GlobalNumByteSlice",
|
|
65
|
+
LocalNumUint = "LocalNumUint",
|
|
66
|
+
LocalNumByteSlice = "LocalNumByteSlice",
|
|
67
|
+
ExtraProgramPages = "ExtraProgramPages",
|
|
68
|
+
Nonparticipation = "Nonparticipation",
|
|
69
|
+
NumLogs = "NumLogs",
|
|
70
|
+
CreatedAssetID = "CreatedAssetID",
|
|
71
|
+
CreatedApplicationID = "CreatedApplicationID",
|
|
72
|
+
LastLog = "LastLog",
|
|
73
|
+
StateProofPK = "StateProofPK",
|
|
74
|
+
NumApprovalProgramPages = "NumApprovalProgramPages",
|
|
75
|
+
NumClearStateProgramPages = "NumClearStateProgramPages",
|
|
76
|
+
ApplicationArgs = "ApplicationArgs",
|
|
77
|
+
Accounts = "Accounts",
|
|
78
|
+
Assets = "Assets",
|
|
79
|
+
Applications = "Applications",
|
|
80
|
+
Logs = "Logs",
|
|
81
|
+
ApprovalProgramPages = "ApprovalProgramPages",
|
|
82
|
+
ClearStateProgramPages = "ClearStateProgramPages"
|
|
83
|
+
}
|
|
84
|
+
export declare const TxnFields: Record<TxnField, TxnFieldData>;
|
package/awst/util.d.ts
ADDED
package/awst/wtypes.d.ts
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { TransactionKind } from './models';
|
|
2
|
+
import type { SourceLocation } from './source-location';
|
|
3
|
+
export declare enum AVMType {
|
|
4
|
+
bytes = 1,
|
|
5
|
+
uint64 = 2,
|
|
6
|
+
any = 3
|
|
7
|
+
}
|
|
8
|
+
export declare class WType {
|
|
9
|
+
constructor(props: {
|
|
10
|
+
name: string;
|
|
11
|
+
immutable?: boolean;
|
|
12
|
+
scalarType: AVMType | null;
|
|
13
|
+
ephemeral?: boolean;
|
|
14
|
+
});
|
|
15
|
+
readonly name: string;
|
|
16
|
+
readonly immutable: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* ephemeral types are not suitable for naive storage / persistence,
|
|
19
|
+
* even if their underlying type is a simple stack value
|
|
20
|
+
*/
|
|
21
|
+
readonly ephemeral: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* The AVM stack type of this type (if any)
|
|
24
|
+
*/
|
|
25
|
+
readonly scalarType: AVMType | null;
|
|
26
|
+
equals(other: WType): boolean;
|
|
27
|
+
toString(): string;
|
|
28
|
+
get id(): string;
|
|
29
|
+
}
|
|
30
|
+
export declare const voidWType: WType;
|
|
31
|
+
export declare const boolWType: WType;
|
|
32
|
+
export declare const uint64WType: WType;
|
|
33
|
+
export declare const uint64RangeWType: WType;
|
|
34
|
+
export declare const bytesWType: WType;
|
|
35
|
+
export declare const stateKeyWType: WType;
|
|
36
|
+
export declare const boxKeyWType: WType;
|
|
37
|
+
export declare const stringWType: WType;
|
|
38
|
+
export declare const biguintWType: WType;
|
|
39
|
+
export declare const assetWType: WType;
|
|
40
|
+
export declare const accountWType: WType;
|
|
41
|
+
export declare const applicationWType: WType;
|
|
42
|
+
export declare abstract class ARC4Type extends WType {
|
|
43
|
+
readonly decodeType: WType | null;
|
|
44
|
+
readonly arc4Name: string;
|
|
45
|
+
readonly otherEncodeableTypes: WType[];
|
|
46
|
+
constructor({ decodeType, arc4Name, otherEncodeableTypes, ...rest }: {
|
|
47
|
+
decodeType: WType | null;
|
|
48
|
+
arc4Name: string;
|
|
49
|
+
otherEncodeableTypes: WType[];
|
|
50
|
+
name: string;
|
|
51
|
+
immutable?: boolean;
|
|
52
|
+
scalarType: AVMType | null;
|
|
53
|
+
ephemeral?: boolean;
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
export declare class WStructType extends WType {
|
|
57
|
+
}
|
|
58
|
+
export declare class WTuple extends WType {
|
|
59
|
+
types: WType[];
|
|
60
|
+
constructor(props: {
|
|
61
|
+
types: WType[];
|
|
62
|
+
immutable?: boolean;
|
|
63
|
+
});
|
|
64
|
+
toString(): string;
|
|
65
|
+
}
|
|
66
|
+
export declare class WArray extends WType {
|
|
67
|
+
readonly itemType: WType;
|
|
68
|
+
constructor(props: {
|
|
69
|
+
itemType: WType;
|
|
70
|
+
immutable: boolean;
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
export declare class WEnumeration extends WType {
|
|
74
|
+
readonly sequenceType: WType;
|
|
75
|
+
constructor(props: {
|
|
76
|
+
sequenceType: WType;
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
export declare class WGroupTransaction extends WType {
|
|
80
|
+
transactionType: TransactionKind | null;
|
|
81
|
+
constructor({ transactionType }: {
|
|
82
|
+
transactionType?: TransactionKind;
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
export declare class WInnerTransaction extends WType {
|
|
86
|
+
transactionType: TransactionKind | null;
|
|
87
|
+
constructor({ transactionType }: {
|
|
88
|
+
transactionType?: TransactionKind;
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
export declare class WInnerTransactionFields extends WType {
|
|
92
|
+
transactionType: TransactionKind | null;
|
|
93
|
+
constructor({ transactionType }: {
|
|
94
|
+
transactionType?: TransactionKind;
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
export declare class ARC4UIntN extends ARC4Type {
|
|
98
|
+
readonly n: bigint;
|
|
99
|
+
constructor({ n }: {
|
|
100
|
+
n: bigint;
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
export declare class ARC4UFixedNxM extends ARC4Type {
|
|
104
|
+
}
|
|
105
|
+
export declare class ARC4Struct extends ARC4Type {
|
|
106
|
+
}
|
|
107
|
+
export declare abstract class ARC4Array extends ARC4Type {
|
|
108
|
+
readonly elementType: ARC4Type;
|
|
109
|
+
protected constructor(props: {
|
|
110
|
+
arc4Name: string;
|
|
111
|
+
otherEncodeableTypes: WType[];
|
|
112
|
+
name: string;
|
|
113
|
+
elementType: ARC4Type;
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
export declare class ARC4DynamicArray extends ARC4Array {
|
|
117
|
+
readonly sourceLocation: SourceLocation | null;
|
|
118
|
+
constructor({ elementType, sourceLocation }: {
|
|
119
|
+
elementType: ARC4Type;
|
|
120
|
+
sourceLocation?: SourceLocation;
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
export declare class ARC4StaticArray extends ARC4Array {
|
|
124
|
+
readonly sourceLocation: SourceLocation | null;
|
|
125
|
+
readonly arraySize: bigint;
|
|
126
|
+
constructor({ elementType, sourceLocation, arraySize }: {
|
|
127
|
+
arraySize: bigint;
|
|
128
|
+
elementType: ARC4Type;
|
|
129
|
+
sourceLocation?: SourceLocation;
|
|
130
|
+
});
|
|
131
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import type { Expression, LValue, Statement } from '../awst/nodes';
|
|
3
|
+
import type { SourceLocation } from '../awst/source-location';
|
|
4
|
+
import type { Expressions } from '../visitor/syntax-names';
|
|
5
|
+
import type { Visitor } from '../visitor/visitor';
|
|
6
|
+
import type { AwstBuildContext } from './context/awst-build-context';
|
|
7
|
+
import type { InstanceBuilder } from './eb';
|
|
8
|
+
import { NodeBuilder } from './eb';
|
|
9
|
+
import type { PType } from './ptypes';
|
|
10
|
+
import { TextVisitor } from './text-visitor';
|
|
11
|
+
export declare abstract class BaseVisitor implements Visitor<Expressions, NodeBuilder> {
|
|
12
|
+
context: AwstBuildContext;
|
|
13
|
+
private baseAccept;
|
|
14
|
+
readonly textVisitor: TextVisitor;
|
|
15
|
+
protected constructor(context: AwstBuildContext);
|
|
16
|
+
logNotSupported(node: ts.Node | undefined, message: string): void;
|
|
17
|
+
throwNotSupported(node: ts.Node, message: string): never;
|
|
18
|
+
visitBigIntLiteral(node: ts.BigIntLiteral): InstanceBuilder;
|
|
19
|
+
visitRegularExpressionLiteral(node: ts.RegularExpressionLiteral): InstanceBuilder;
|
|
20
|
+
visitFalseKeyword(node: ts.FalseLiteral): InstanceBuilder;
|
|
21
|
+
visitTrueKeyword(node: ts.TrueLiteral): InstanceBuilder;
|
|
22
|
+
sourceLocation(node: ts.Node): SourceLocation;
|
|
23
|
+
visitStringLiteral(node: ts.StringLiteral): InstanceBuilder;
|
|
24
|
+
visitNoSubstitutionTemplateLiteral(node: ts.NoSubstitutionTemplateLiteral): InstanceBuilder;
|
|
25
|
+
visitNumericLiteral(node: ts.NumericLiteral): InstanceBuilder;
|
|
26
|
+
visitIdentifier(node: ts.Identifier): NodeBuilder;
|
|
27
|
+
visitImportKeyword(node: ts.ImportExpression): NodeBuilder;
|
|
28
|
+
visitNullKeyword(node: ts.NullLiteral): NodeBuilder;
|
|
29
|
+
visitPrivateIdentifier(node: ts.PrivateIdentifier): NodeBuilder;
|
|
30
|
+
visitSuperKeyword(node: ts.SuperExpression): NodeBuilder;
|
|
31
|
+
visitThisKeyword(node: ts.ThisExpression): NodeBuilder;
|
|
32
|
+
visitFunctionExpression(node: ts.FunctionExpression): NodeBuilder;
|
|
33
|
+
visitClassExpression(node: ts.ClassExpression): NodeBuilder;
|
|
34
|
+
visitObjectLiteralExpression(node: ts.ObjectLiteralExpression): NodeBuilder;
|
|
35
|
+
visitArrayLiteralExpression(node: ts.ArrayLiteralExpression): NodeBuilder;
|
|
36
|
+
visitPropertyAccessExpression(node: ts.PropertyAccessExpression): NodeBuilder;
|
|
37
|
+
visitElementAccessExpression(node: ts.ElementAccessExpression): NodeBuilder;
|
|
38
|
+
visitCallExpression(node: ts.CallExpression): NodeBuilder;
|
|
39
|
+
visitNewExpression(node: ts.NewExpression): NodeBuilder;
|
|
40
|
+
visitTaggedTemplateExpression(node: ts.TaggedTemplateExpression): NodeBuilder;
|
|
41
|
+
visitTypeAssertionExpression(node: ts.TypeAssertion): NodeBuilder;
|
|
42
|
+
visitParenthesizedExpression(node: ts.ParenthesizedExpression): NodeBuilder;
|
|
43
|
+
/**
|
|
44
|
+
* `delete obj.prop`
|
|
45
|
+
*
|
|
46
|
+
* Not supported currently as typescript requires 'prop' to be optional and we don't support optional values
|
|
47
|
+
*/
|
|
48
|
+
visitDeleteExpression(node: ts.DeleteExpression): NodeBuilder;
|
|
49
|
+
visitTypeOfExpression(node: ts.TypeOfExpression): NodeBuilder;
|
|
50
|
+
visitVoidExpression(node: ts.VoidExpression): NodeBuilder;
|
|
51
|
+
visitAwaitExpression(node: ts.AwaitExpression): NodeBuilder;
|
|
52
|
+
visitPrefixUnaryExpression(node: ts.PrefixUnaryExpression): NodeBuilder;
|
|
53
|
+
visitPostfixUnaryExpression(node: ts.PostfixUnaryExpression): NodeBuilder;
|
|
54
|
+
evaluateCondition(nodeOrBuilder: ts.Expression | NodeBuilder, negate?: boolean): Expression;
|
|
55
|
+
visitBinaryExpression(node: ts.BinaryExpression): NodeBuilder;
|
|
56
|
+
visitConditionalExpression(node: ts.ConditionalExpression): NodeBuilder;
|
|
57
|
+
createConditionalExpression({ condition, ptype, whenFalse, whenTrue, sourceLocation, }: {
|
|
58
|
+
ptype: PType;
|
|
59
|
+
condition: Expression;
|
|
60
|
+
whenTrue: InstanceBuilder;
|
|
61
|
+
whenFalse: InstanceBuilder;
|
|
62
|
+
sourceLocation: SourceLocation;
|
|
63
|
+
}): InstanceBuilder;
|
|
64
|
+
visitTemplateExpression(node: ts.TemplateExpression): NodeBuilder;
|
|
65
|
+
visitYieldExpression(node: ts.YieldExpression): NodeBuilder;
|
|
66
|
+
visitOmittedExpression(node: ts.OmittedExpression): NodeBuilder;
|
|
67
|
+
visitExpressionWithTypeArguments(node: ts.ExpressionWithTypeArguments): NodeBuilder;
|
|
68
|
+
visitAsExpression(node: ts.AsExpression): NodeBuilder;
|
|
69
|
+
visitNonNullExpression(node: ts.NonNullExpression): NodeBuilder;
|
|
70
|
+
visitSatisfiesExpression(node: ts.SatisfiesExpression): NodeBuilder;
|
|
71
|
+
handleAssignmentStatement(target: InstanceBuilder, source: InstanceBuilder, sourceLocation: SourceLocation): Statement;
|
|
72
|
+
handleAssignment(target: InstanceBuilder, source: InstanceBuilder, sourceLocation: SourceLocation): InstanceBuilder;
|
|
73
|
+
/**
|
|
74
|
+
* Given a target and source type, produce a type that represents the result of an assignment expression.
|
|
75
|
+
*
|
|
76
|
+
* This will largely represent the sourceType verbatim with the exception of numeric literal types which need
|
|
77
|
+
* to be narrowed using the targetType.
|
|
78
|
+
*
|
|
79
|
+
* Eg. a `number` on the rhs should be narrowed to whatever the lhs is for example uint64.
|
|
80
|
+
* @param targetType The type of the assignment target
|
|
81
|
+
* @param sourceType The type of the assignment source
|
|
82
|
+
* @param sourceLocation
|
|
83
|
+
* @private
|
|
84
|
+
*/
|
|
85
|
+
private buildAssignmentExpressionType;
|
|
86
|
+
buildLValue(target: InstanceBuilder, assignmentType: PType, sourceLocation: SourceLocation): LValue;
|
|
87
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import type { ContractReference } from '../awst/models';
|
|
3
|
+
import * as awst from '../awst/nodes';
|
|
4
|
+
import type { AwstBuildContext } from './context/awst-build-context';
|
|
5
|
+
import { ContractMethodBaseVisitor } from './contract-method-visitor';
|
|
6
|
+
export interface ConstructorInfo {
|
|
7
|
+
propertyInitializerStatements: awst.Statement[];
|
|
8
|
+
cref: ContractReference;
|
|
9
|
+
}
|
|
10
|
+
export declare class ConstructorVisitor extends ContractMethodBaseVisitor {
|
|
11
|
+
private readonly _result;
|
|
12
|
+
private _foundSuperCall;
|
|
13
|
+
private readonly _propertyInitializerStatements;
|
|
14
|
+
constructor(ctx: AwstBuildContext, node: ts.ConstructorDeclaration, contractInfo: ConstructorInfo);
|
|
15
|
+
get result(): awst.ContractMethod;
|
|
16
|
+
static buildConstructor(parentCtx: AwstBuildContext, node: ts.ConstructorDeclaration, constructorMethodInfo: ConstructorInfo): awst.ContractMethod;
|
|
17
|
+
visitBlock(node: ts.Block): awst.Block;
|
|
18
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import type { awst } from '../../awst';
|
|
3
|
+
import type { CompilationSet, ContractReference, LogicSigReference } from '../../awst/models';
|
|
4
|
+
import type { AppStorageDefinition } from '../../awst/nodes';
|
|
5
|
+
import { SourceLocation } from '../../awst/source-location';
|
|
6
|
+
import type { AppStorageDeclaration } from '../contract-data';
|
|
7
|
+
import type { NodeBuilder } from '../eb';
|
|
8
|
+
import type { ContractClassPType, PType } from '../ptypes';
|
|
9
|
+
import { EvaluationContext } from './evaluation-context';
|
|
10
|
+
import { SwitchLoopContext } from './switch-loop-context';
|
|
11
|
+
export interface AwstBuildContext {
|
|
12
|
+
/**
|
|
13
|
+
* Get the source location of a node in the current source file
|
|
14
|
+
* @param node
|
|
15
|
+
*/
|
|
16
|
+
getSourceLocation(node: ts.Node): SourceLocation;
|
|
17
|
+
/**
|
|
18
|
+
* Get NodeBuilder instance for the given identifier.
|
|
19
|
+
* @param node
|
|
20
|
+
*/
|
|
21
|
+
getBuilderForNode(node: ts.Identifier): NodeBuilder;
|
|
22
|
+
/**
|
|
23
|
+
* Reflect the PType of the given node
|
|
24
|
+
* @param node
|
|
25
|
+
*/
|
|
26
|
+
getPTypeForNode(node: ts.Node): PType;
|
|
27
|
+
/**
|
|
28
|
+
* Reflect generic type parameters for a call expression
|
|
29
|
+
* @param node
|
|
30
|
+
*/
|
|
31
|
+
getTypeParameters(node: ts.CallExpression): PType[];
|
|
32
|
+
/**
|
|
33
|
+
* Resolve the given identifier to a unique variable name that accounts
|
|
34
|
+
* for shadowed variable names.
|
|
35
|
+
* @param node
|
|
36
|
+
*/
|
|
37
|
+
resolveVariableName(node: ts.Identifier): string;
|
|
38
|
+
/**
|
|
39
|
+
* Resolve the given parameter declaration to a unique parameter name to be used
|
|
40
|
+
* in destructuring assignments where no explicit parameter name is available.
|
|
41
|
+
* @param node
|
|
42
|
+
*/
|
|
43
|
+
resolveDestructuredParamName(node: ts.ParameterDeclaration): string;
|
|
44
|
+
/**
|
|
45
|
+
* Generate a unique variable name for a discarded value.
|
|
46
|
+
*/
|
|
47
|
+
generateDiscardedVarName(): string;
|
|
48
|
+
/**
|
|
49
|
+
* Add a named constant to the current context
|
|
50
|
+
* @param name The unique name of the constant declaration in this source file
|
|
51
|
+
* @param value The compile time constant value
|
|
52
|
+
*/
|
|
53
|
+
addConstant(name: string, value: awst.Constant): void;
|
|
54
|
+
/**
|
|
55
|
+
* Retrieve the evaluation context
|
|
56
|
+
*/
|
|
57
|
+
get evaluationCtx(): EvaluationContext;
|
|
58
|
+
/**
|
|
59
|
+
* Retrieve the switch loop context
|
|
60
|
+
*/
|
|
61
|
+
get switchLoopCtx(): SwitchLoopContext;
|
|
62
|
+
/**
|
|
63
|
+
* Create a child context from this context. Used when entering a child parsing context such as a class or function.
|
|
64
|
+
*/
|
|
65
|
+
createChildContext(): AwstBuildContext;
|
|
66
|
+
addStorageDeclaration(declaration: AppStorageDeclaration): void;
|
|
67
|
+
getStorageDeclaration(contractType: ContractClassPType, memberName: string): AppStorageDeclaration | undefined;
|
|
68
|
+
getStorageDefinitionsForContract(contractType: ContractClassPType): Map<string, AppStorageDefinition>;
|
|
69
|
+
addToCompilationSet(compilationTarget: ContractReference | LogicSigReference): void;
|
|
70
|
+
get compilationSet(): CompilationSet;
|
|
71
|
+
}
|
|
72
|
+
export declare function buildContextForProgram(program: ts.Program): AwstBuildContext;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tracks the context in which expressions should be evaluated.
|
|
3
|
+
*
|
|
4
|
+
* A boolean context is more lenient with mixed expression types as it is only concerned with truthy-ness
|
|
5
|
+
*/
|
|
6
|
+
export declare class EvaluationContext {
|
|
7
|
+
#private;
|
|
8
|
+
get isBoolean(): boolean;
|
|
9
|
+
enterBooleanContext(): Disposable;
|
|
10
|
+
leaveBooleanContext(): Disposable;
|
|
11
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import type { Block, Goto } from '../../awst/nodes';
|
|
3
|
+
import type { SourceLocation } from '../../awst/source-location';
|
|
4
|
+
type LoopContext = Disposable & {
|
|
5
|
+
breakTarget: Block;
|
|
6
|
+
continueTarget: Block;
|
|
7
|
+
readonly hasBreaks: boolean;
|
|
8
|
+
readonly hasContinues: boolean;
|
|
9
|
+
};
|
|
10
|
+
type SwitchContext = Disposable & {
|
|
11
|
+
breakTarget: Block;
|
|
12
|
+
caseTarget(caseIndex: number, sourceLocation: SourceLocation): Block;
|
|
13
|
+
gotoCase(caseIndex: number, sourceLocation: SourceLocation): Goto;
|
|
14
|
+
readonly hasBreaks: boolean;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Tracks parent switches and loops so that break and continue statements
|
|
18
|
+
* can target the correct parent.
|
|
19
|
+
*/
|
|
20
|
+
export declare class SwitchLoopContext {
|
|
21
|
+
private labelCount;
|
|
22
|
+
private unlabelledCount;
|
|
23
|
+
constructor();
|
|
24
|
+
private switchLoopStack;
|
|
25
|
+
getBreakTarget(label: ts.Identifier | undefined, sourceLocation: SourceLocation): string;
|
|
26
|
+
getContinueTarget(label: ts.Identifier | undefined, sourceLocation: SourceLocation): string;
|
|
27
|
+
enterLoop(node: ts.WhileStatement | ts.ForStatement | ts.ForOfStatement | ts.ForInStatement | ts.DoStatement, sourceLocation: SourceLocation): LoopContext;
|
|
28
|
+
private uniqueNameForLabel;
|
|
29
|
+
enterSwitch(node: ts.SwitchStatement, sourceLocation: SourceLocation): SwitchContext;
|
|
30
|
+
}
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type ts from 'typescript';
|
|
2
|
+
export declare class UniqueNameResolver {
|
|
3
|
+
protected readonly symbolToName: Map<ts.Symbol, string>;
|
|
4
|
+
protected readonly nameToCount: Map<string, number>;
|
|
5
|
+
constructor(parent?: UniqueNameResolver);
|
|
6
|
+
/**
|
|
7
|
+
* Resolve a rawName to a unique name within the scope of this resolver. When provided
|
|
8
|
+
* with a symbol which has already been seen, return the same name
|
|
9
|
+
* @param rawName
|
|
10
|
+
* @param symbol
|
|
11
|
+
*/
|
|
12
|
+
resolveUniqueName(rawName: string, symbol: ts.Symbol | undefined): string;
|
|
13
|
+
createChild(): UniqueNameResolver;
|
|
14
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { AppStorageDefinition, BytesConstant } from '../awst/nodes';
|
|
2
|
+
import { AppStorageKind } from '../awst/nodes';
|
|
3
|
+
import type { SourceLocation } from '../awst/source-location';
|
|
4
|
+
import type { ContractClassPType, StorageProxyPType } from './ptypes';
|
|
5
|
+
import { BoxMapPType, BoxPType, BoxRefPType, GlobalStateType, LocalStateType } from './ptypes';
|
|
6
|
+
export declare class AppStorageDeclaration {
|
|
7
|
+
readonly memberName: string;
|
|
8
|
+
readonly ptype: GlobalStateType | LocalStateType | BoxMapPType | BoxPType | BoxRefPType;
|
|
9
|
+
readonly keyOverride: BytesConstant | null;
|
|
10
|
+
readonly sourceLocation: SourceLocation;
|
|
11
|
+
readonly definedIn: ContractClassPType;
|
|
12
|
+
readonly description: string | null;
|
|
13
|
+
constructor(props: {
|
|
14
|
+
memberName: string;
|
|
15
|
+
ptype: StorageProxyPType;
|
|
16
|
+
keyOverride: BytesConstant | null;
|
|
17
|
+
sourceLocation: SourceLocation;
|
|
18
|
+
definedIn: ContractClassPType;
|
|
19
|
+
description: string | null;
|
|
20
|
+
});
|
|
21
|
+
get kind(): AppStorageKind;
|
|
22
|
+
get key(): BytesConstant;
|
|
23
|
+
get definition(): AppStorageDefinition;
|
|
24
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type ts from 'typescript';
|
|
2
|
+
import type { ContractReference } from '../awst/models';
|
|
3
|
+
import * as awst from '../awst/nodes';
|
|
4
|
+
import type { AwstBuildContext } from './context/awst-build-context';
|
|
5
|
+
import type { NodeBuilder } from './eb';
|
|
6
|
+
import { FunctionVisitor } from './function-visitor';
|
|
7
|
+
export type ContractMethodInfo = {
|
|
8
|
+
cref: ContractReference;
|
|
9
|
+
arc4MethodConfig?: awst.ContractMethod['arc4MethodConfig'];
|
|
10
|
+
};
|
|
11
|
+
export declare class ContractMethodBaseVisitor extends FunctionVisitor {
|
|
12
|
+
visitSuperKeyword(node: ts.SuperExpression): NodeBuilder;
|
|
13
|
+
visitThisKeyword(node: ts.ThisExpression): NodeBuilder;
|
|
14
|
+
}
|
|
15
|
+
export declare class ContractMethodVisitor extends ContractMethodBaseVisitor {
|
|
16
|
+
private readonly _result;
|
|
17
|
+
constructor(ctx: AwstBuildContext, node: ts.MethodDeclaration, contractInfo: ContractMethodInfo);
|
|
18
|
+
get result(): awst.ContractMethod;
|
|
19
|
+
static buildContractMethod(parentCtx: AwstBuildContext, node: ts.MethodDeclaration, contractMethodInfo: ContractMethodInfo): awst.ContractMethod;
|
|
20
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import type * as awst from '../awst/nodes';
|
|
3
|
+
import { ContractFragment } from '../awst/nodes';
|
|
4
|
+
import type { ClassElements } from '../visitor/syntax-names';
|
|
5
|
+
import type { Visitor } from '../visitor/visitor';
|
|
6
|
+
import { BaseVisitor } from './base-visitor';
|
|
7
|
+
import type { AwstBuildContext } from './context/awst-build-context';
|
|
8
|
+
export declare class ContractVisitor extends BaseVisitor implements Visitor<ClassElements, void> {
|
|
9
|
+
private _ctor?;
|
|
10
|
+
private _subroutines;
|
|
11
|
+
private _approvalProgram;
|
|
12
|
+
private _clearStateProgram;
|
|
13
|
+
private _className;
|
|
14
|
+
private _contractPType;
|
|
15
|
+
private readonly _propertyInitialization;
|
|
16
|
+
readonly result: ContractFragment;
|
|
17
|
+
accept: <TNode extends ts.Node>(node: TNode) => import("../visitor/visitor").MethodReturnType<import("../visitor/visitor").VisitorMethod<import("../visitor/visitor").KindForNode<import("../visitor/syntax-names").MapBaseType<TNode>>>, ContractVisitor>;
|
|
18
|
+
constructor(ctx: AwstBuildContext, classDec: ts.ClassDeclaration);
|
|
19
|
+
private acceptAndIgnoreBuildErrors;
|
|
20
|
+
private makeDefaultConstructor;
|
|
21
|
+
private getBaseContracts;
|
|
22
|
+
visitClassStaticBlockDeclaration(node: ts.ClassStaticBlockDeclaration): void;
|
|
23
|
+
visitConstructor(node: ts.ConstructorDeclaration): void;
|
|
24
|
+
visitGetAccessor(node: ts.GetAccessorDeclaration): void;
|
|
25
|
+
visitIndexSignature(node: ts.IndexSignatureDeclaration): void;
|
|
26
|
+
private buildDefaultArgument;
|
|
27
|
+
private buildArc4Config;
|
|
28
|
+
visitMethodDeclaration(node: ts.MethodDeclaration): void;
|
|
29
|
+
visitPropertyDeclaration(node: ts.PropertyDeclaration): void;
|
|
30
|
+
visitSemicolonClassElement(node: ts.SemicolonClassElement): void;
|
|
31
|
+
visitSetAccessor(node: ts.SetAccessorDeclaration): void;
|
|
32
|
+
static buildContract(ctx: AwstBuildContext, classDec: ts.ClassDeclaration): awst.ContractFragment;
|
|
33
|
+
}
|