@algorandfoundation/puya-ts 1.2.0-beta.32 → 1.2.0-beta.34
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/{analyser-service-4cYQscWZ.js → analyser-service-DjrWRS0-.js} +3 -3
- package/{analyser-service-4cYQscWZ.js.map → analyser-service-DjrWRS0-.js.map} +1 -1
- package/analyserService.mjs +3 -3
- package/{arc4-clientgen-CkO21MdT.js → arc4-clientgen-CZtNN1eT.js} +3 -3
- package/arc4-clientgen-CZtNN1eT.js.map +1 -0
- package/awst_build/ast-visitors/class-definition-visitor.d.ts +721 -1
- package/awst_build/ast-visitors/function-visitor.d.ts +721 -1
- package/awst_build/ast-visitors/text-visitor.d.ts +721 -1
- package/awst_build/eb/arc4/arrays.d.ts +2 -1
- package/awst_build/eb/arc4/c2c.d.ts +0 -17
- package/awst_build/eb/array-like/arrays.d.ts +3 -2
- package/awst_build/eb/bytes-expression-builder.d.ts +0 -28
- package/awst_build/eb/contract-builder.d.ts +0 -11
- package/awst_build/eb/index.d.ts +0 -1
- package/awst_build/eb/literal/object-literal-expression-builder.d.ts +8 -4
- package/awst_build/eb/objects/util.d.ts +0 -2
- package/awst_build/eb/op-module-builder.d.ts +0 -3
- package/awst_build/eb/storage/box/box.d.ts +1 -21
- package/awst_build/eb/string-expression-builder.d.ts +0 -6
- package/awst_build/eb/util/resolve-compat-builder.d.ts +0 -8
- package/awst_build/op-metadata.d.ts +4 -3
- package/awst_build/ptypes/arc4-types.d.ts +0 -1
- package/awst_build/ptypes/index.d.ts +1 -1
- package/awst_build/ptypes/visitors/index-type-visitor.d.ts +0 -30
- package/bin/puyats-clientgen.mjs +5 -5
- package/bin/puyats-ls.mjs +6 -6
- package/bin/puyats-ls.mjs.map +1 -1
- package/bin/run-cli.mjs +8 -8
- package/{check-node-version-CJZN8bUo.js → check-node-version-BYGc-qxw.js} +3 -3
- package/{check-node-version-CJZN8bUo.js.map → check-node-version-BYGc-qxw.js.map} +1 -1
- package/cli.mjs +8 -8
- package/{compile-P13jbcuM.js → compile-BKk4hPli.js} +6 -6
- package/{compile-P13jbcuM.js.map → compile-BKk4hPli.js.map} +1 -1
- package/constants.d.ts +5 -0
- package/{contract-class-model-BUOeMEKh.js → contract-class-model-Dpn9A-pJ.js} +38 -33
- package/contract-class-model-Dpn9A-pJ.js.map +1 -0
- package/errors.d.ts +1 -6
- package/index.mjs +8 -9
- package/index.mjs.map +1 -1
- package/language-server/compile-trigger-queue.d.ts +2 -2
- package/language-server/puya-language-server.d.ts +0 -38
- package/logger/index.d.ts +0 -7
- package/{options-DgrJjFC_.js → options-BCW57sPn.js} +142 -132
- package/options-BCW57sPn.js.map +1 -0
- package/options.d.ts +4 -3
- package/package.json +2 -2
- package/puya/check-puya-version.d.ts +0 -13
- package/puya/log-deserializer.d.ts +0 -2
- package/{resolve-puya-path-n5rXecTR.js → resolve-puya-path-CdZID0Yd.js} +4 -4
- package/resolve-puya-path-CdZID0Yd.js.map +1 -0
- package/{semver-C4QVXBwz.js → semver-a7hIj_hk.js} +2 -2
- package/{semver-C4QVXBwz.js.map → semver-a7hIj_hk.js.map} +1 -1
- package/{util-J87OKSaa.js → util-nZLj7LWS.js} +2 -2
- package/{util-J87OKSaa.js.map → util-nZLj7LWS.js.map} +1 -1
- package/visitor/syntax-names.d.ts +4 -4
- package/visitor/visitor.d.ts +4 -4
- package/arc4-clientgen-CkO21MdT.js.map +0 -1
- package/contract-class-model-BUOeMEKh.js.map +0 -1
- package/language-server/ls-logger.d.ts +0 -11
- package/options-DgrJjFC_.js.map +0 -1
- package/resolve-puya-path-n5rXecTR.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ao as LibClassType, d as Constants, bp as boolPType, co as wtypes, b$ as stringPType, a4 as GenericPType, cp as codeInvariant, aL as ReadonlyTuplePType, ax as MutableTuplePType, aD as PType, aA as NumericLiteralPType, c2 as uint64PType, bo as biguintPType, z as ArrayPType, aJ as ReadonlyArrayPType, e as accountPType, bq as bytesPType, ap as LibFunctionType, cq as invariant, _ as ContractClassPType, bu as compiledContractType, aa as ImmutableObjectPType, b5 as applicationItxnType, v as voidPType, aw as MutableObjectPType, I as InternalError, c as CodeError, cr as throwError, cs as StringConstant, ct as BytesConstant, cu as IntegerConstant, cv as BoolConstant, cw as AddressConstant, cx as MethodConstant, cy as DecimalConstant, cz as TemplateVar, cg as LogSource, L as LogLevel, cA as instanceOfAny, cB as SingleEvaluation, cC as VarExpression, cD as nodeFactory, cE as NotSupported, l as logger, cF as TupleItemExpression, cG as FieldExpression, cH as IndexExpression, cI as TupleExpression, cJ as AppStateExpression, cK as AppAccountStateExpression, cL as BoxValueExpression, cM as ReinterpretCast, cN as StateGetEx, cO as StateGet, aU as TransientType, bU as numberPType, bn as bigIntPType, b6 as arc28EmitFunction, y as ArrayLiteralPType, H as BigIntLiteralPType, cP as hasFlags, cQ as BinaryBooleanOperator, ay as NamespacePType, bm as baseContractType, b9 as arc4BaseContractType, cR as SymbolName, a_ as UnionPType, a9 as GroupTransactionPType, h as anyGtxnType, aX as Uint64EnumMemberType, aV as TypeParameterType, bB as esSymbol, c4 as unknownPType, bS as neverPType, b2 as anyPType, bT as nullPType, c3 as undefinedPType, Z as ClusteredPrototype, ae as IntersectionPType, bO as logicSigBaseType, av as LogicSigPType, aY as Uint64EnumType, a1 as FunctionPType, w as ApprovalProgram, X as ClearStateProgram, cn as isIn, R as BoxMapPType, S as BoxPType, as as LocalMapType, au as LocalStateType, a6 as GlobalMapType, a8 as GlobalStateType, aP as SuperPrototypeSelector, Y as ClusteredContractClassType, ch as SourceLocation, cS as intersectsFlags, cT as extractModuleName, cU as toSubScript, A as AbsolutePath, cV as CompilationSet, cW as ARC4ABIMethodConfig, C as ContractReference, V as BytesPType, cX as EqualityComparison, aB as ObjectLiteralPType, bE as isObjectType$1, b_ as readonlyDecorator, b7 as arc4AbiMethodDecorator, b8 as arc4BareMethodDecorator, cY as ARC4CreateOption, cZ as NewArray, O as OnCompletionAction, c_ as BytesEncoding, ce as bigIntToUint8Array, c$ as FixableCodeError, d0 as UInt64BinaryOperator, d1 as tryConvertEnum, d2 as NumericComparison, d3 as UInt64UnaryOperator, bG as itoaMethod, aZ as Uint64Function, d4 as UInt64PostfixUnaryOperator, a0 as FixedArrayPType, al as IterableIteratorType, ak as IterableIteratorGeneric, f as applicationPType, g as assetPType, bV as onCompleteActionType, d5 as wrapInCodeError, cd as base32ToUint8Array, c1 as transactionTypeType, d6 as TransactionKind, bt as compileFunctionType, bv as compiledLogicSigType, d7 as LogicSigReference, ab as InnerTransactionPType, aT as TransactionFunctionType, c0 as submitGroupItxnFunction, am as ItxnParamsPType, d8 as getInnerTransactionType, d9 as getItxnParamsType, da as CompiledContract, db as ARC4BareMethodConfig, dc as MethodSignature, cj as enumFromValue, x as ArrayGeneric, $ as FixedArrayGeneric, cm as zipStrict, bD as isArrayType, bF as isTupleLike, bQ as matchFunction, bb as assertMatchFunction, dd as BigUIntBinaryOperator, K as BigUintFunction, de as BigUIntPostfixUnaryOperator, cf as utf8ToUint8Array, df as BytesBinaryOperator, dg as IntrinsicCall, cb as uint8ArrayToUtf8, T as BytesFunction, U as BytesGeneric, cc as base64ToUint8Array, dh as enumKeyFromValue, di as BytesUnaryOperator, bs as cloneFunctionPType, bw as contractOptionsDecorator, bz as ensureBudgetFunction, dj as PuyaLibFunction, bW as opUpFeeSourceType, af as IntrinsicEnumType, bP as logicSigOptionsDecorator, ac as InstanceType, aC as ObjectWithOptionalFieldsType, c7 as vrfVerifyPType, bR as mimcConfigurationsPType, by as ecdsaPType, bx as ecPType, bl as base64PType, ag as IntrinsicFunctionGroupType, dk as Expression, ai as IntrinsicFunctionType, aM as ReferenceArrayGeneric, aN as ReferenceArrayType, dl as AppStorageKind, a$ as UnsupportedType, dm as transientTypeErrors, a7 as GlobalStateGeneric, aR as TemplateVarFunction, dn as getGroupTransactionType, bH as itxnComposePType, aW as Uint64EnumMemberLiteralType, b0 as anyItxnParamsType, c6 as validateEncodingFunctionPType, M as BooleanFunction, aO as StringFunction, aI as ReadonlyArrayGeneric, aK as ReadonlyGeneric, a2 as GeneratorGeneric, a3 as GeneratorType, aG as PromiseGeneric, aH as PromiseType, W as ClassMethodDecoratorContext, aQ as SuperPrototypeSelectorGeneric, aF as PolytypeClassMethodHelper, bL as logFunction, ba as assertFunction, bA as errFunction, bM as loggedAssertFunction, bN as loggedErrFunction, c5 as urangeFunction, br as bzeroFunction, aj as IntrinsicFunctionTypeType, q as ALL_OP_ENUMS, ah as IntrinsicFunctionGroupTypeType, a5 as GlobalMapGeneric, at as LocalStateGeneric, ar as LocalMapGeneric, N as BoxGeneric, Q as BoxMapGeneric, t as ApplicationFunctionType, r as AccountFunction, E as AssetFunction, p as paymentGtxnType, aE as PaymentTxnFunction, k as keyRegistrationGtxnType, an as KeyRegistrationTxnFunction, i as assetConfigGtxnType, B as AssetConfigTxnFunction, j as assetTransferGtxnType, F as AssetTransferTxnFunction, m as assetFreezeGtxnType, D as AssetFreezeTxnFunction, n as applicationCallGtxnType, u as ApplicationTxnFunction, aS as TransactionFunction, bX as paymentItxnFn, bI as keyRegistrationItxnFn, bc as assetConfigItxnFn, bi as assetTransferItxnFn, bf as assetFreezeItxnFn, b3 as applicationCallItxnFn, bZ as paymentItxnType, bK as keyRegistrationItxnType, be as assetConfigItxnType, bk as assetTransferItxnType, bh as assetFreezeItxnType, bY as paymentItxnParamsType, bJ as keyRegistrationItxnParamsType, bd as assetConfigItxnParamsType, bj as assetTransferItxnParamsType, bg as assetFreezeItxnParamsType, b4 as applicationCallItxnParamsType, bC as inputOnlyObjects, dp as Contract, dq as InstanceSuperMethodTarget, dr as ExpressionStatement, ds as AssertExpression, dt as VoidConstant, du as ArrayConcat, dv as ArrayPop, dw as ArrayReplace, dx as ArrayLength, dy as SizeOf, dz as UpdateInnerTransaction, dA as CheckedMaybe, dB as StageInnerTransactions, dC as SubmitInnerTransaction, dD as AssignmentExpression, dE as CommaExpression, dF as NumericComparisonExpression, dG as BytesComparisonExpression, dH as PuyaLibCall, dI as UInt64UnaryOperation, dJ as UInt64PostfixUnaryOperation, dK as BigUIntPostfixUnaryOperation, dL as BytesUnaryOperation, dM as UInt64BinaryOperation, dN as BigUIntBinaryOperation, dO as BooleanBinaryOperation, dP as Not, dQ as Emit, dR as Range, dS as Enumeration, dT as Reversed, dU as StateExists, dV as ARC4Router, dW as MethodSignatureString, dX as SubroutineID, dY as ContractMethodTarget, dZ as InstanceMethodTarget, ca as uint8ArrayToBase32, ck as mkDirIfNotExists, d_ as patchErrorLocation, d$ as Goto, e0 as ReturnStatement, e1 as ContractMethod, e2 as sameSets, b as ContractClassModel, e3 as Subroutine, e4 as LogicSigClassModel, e5 as ptypeIn, e6 as expandMaybeArray, a as LoggingContext, P as PuyaError } from './contract-class-model-
|
|
1
|
+
import { ao as LibClassType, d as Constants, bp as boolPType, co as wtypes, b$ as stringPType, a4 as GenericPType, cp as codeInvariant, aL as ReadonlyTuplePType, ax as MutableTuplePType, aD as PType, aA as NumericLiteralPType, c2 as uint64PType, bo as biguintPType, z as ArrayPType, aJ as ReadonlyArrayPType, e as accountPType, bq as bytesPType, ap as LibFunctionType, cq as invariant, _ as ContractClassPType, bu as compiledContractType, aa as ImmutableObjectPType, b5 as applicationItxnType, v as voidPType, aw as MutableObjectPType, I as InternalError, c as CodeError, cr as throwError, cs as StringConstant, ct as BytesConstant, cu as IntegerConstant, cv as BoolConstant, cw as AddressConstant, cx as MethodConstant, cy as DecimalConstant, cz as TemplateVar, cg as LogSource, L as LogLevel, cA as instanceOfAny, cB as SingleEvaluation, cC as VarExpression, cD as nodeFactory, cE as NotSupported, l as logger, cF as TupleItemExpression, cG as FieldExpression, cH as IndexExpression, cI as TupleExpression, cJ as AppStateExpression, cK as AppAccountStateExpression, cL as BoxValueExpression, cM as ReinterpretCast, cN as StateGetEx, cO as StateGet, aU as TransientType, bU as numberPType, bn as bigIntPType, b6 as arc28EmitFunction, y as ArrayLiteralPType, H as BigIntLiteralPType, cP as hasFlags, cQ as BinaryBooleanOperator, ay as NamespacePType, bm as baseContractType, b9 as arc4BaseContractType, cR as SymbolName, a_ as UnionPType, a9 as GroupTransactionPType, h as anyGtxnType, aX as Uint64EnumMemberType, aV as TypeParameterType, bB as esSymbol, c4 as unknownPType, bS as neverPType, b2 as anyPType, bT as nullPType, c3 as undefinedPType, Z as ClusteredPrototype, ae as IntersectionPType, bO as logicSigBaseType, av as LogicSigPType, aY as Uint64EnumType, a1 as FunctionPType, w as ApprovalProgram, X as ClearStateProgram, cn as isIn, R as BoxMapPType, S as BoxPType, as as LocalMapType, au as LocalStateType, a6 as GlobalMapType, a8 as GlobalStateType, aP as SuperPrototypeSelector, Y as ClusteredContractClassType, ch as SourceLocation, cS as intersectsFlags, cT as extractModuleName, cU as toSubScript, A as AbsolutePath, cV as CompilationSet, cW as ARC4ABIMethodConfig, C as ContractReference, V as BytesPType, cX as EqualityComparison, aB as ObjectLiteralPType, bE as isObjectType$1, b_ as readonlyDecorator, b7 as arc4AbiMethodDecorator, b8 as arc4BareMethodDecorator, cY as ARC4CreateOption, cZ as NewArray, O as OnCompletionAction, c_ as BytesEncoding, ce as bigIntToUint8Array, c$ as FixableCodeError, d0 as UInt64BinaryOperator, d1 as tryConvertEnum, d2 as NumericComparison, d3 as UInt64UnaryOperator, bG as itoaMethod, aZ as Uint64Function, d4 as UInt64PostfixUnaryOperator, a0 as FixedArrayPType, al as IterableIteratorType, ak as IterableIteratorGeneric, f as applicationPType, g as assetPType, bV as onCompleteActionType, d5 as wrapInCodeError, cd as base32ToUint8Array, c1 as transactionTypeType, d6 as TransactionKind, bt as compileFunctionType, bv as compiledLogicSigType, d7 as LogicSigReference, ab as InnerTransactionPType, aT as TransactionFunctionType, c0 as submitGroupItxnFunction, am as ItxnParamsPType, d8 as getInnerTransactionType, d9 as getItxnParamsType, da as CompiledContract, db as ARC4BareMethodConfig, dc as MethodSignature, cj as enumFromValue, x as ArrayGeneric, $ as FixedArrayGeneric, cm as zipStrict, bD as isArrayType, bF as isTupleLike, bQ as matchFunction, bb as assertMatchFunction, dd as BigUIntBinaryOperator, K as BigUintFunction, de as BigUIntPostfixUnaryOperator, cf as utf8ToUint8Array, df as BytesBinaryOperator, dg as IntrinsicCall, cb as uint8ArrayToUtf8, T as BytesFunction, U as BytesGeneric, cc as base64ToUint8Array, dh as enumKeyFromValue, di as BytesUnaryOperator, bs as cloneFunctionPType, bw as contractOptionsDecorator, bz as ensureBudgetFunction, dj as PuyaLibFunction, bW as opUpFeeSourceType, af as IntrinsicEnumType, bP as logicSigOptionsDecorator, ac as InstanceType, aC as ObjectWithOptionalFieldsType, c7 as vrfVerifyPType, bR as mimcConfigurationsPType, by as ecdsaPType, bx as ecPType, bl as base64PType, ag as IntrinsicFunctionGroupType, dk as Expression, ai as IntrinsicFunctionType, aM as ReferenceArrayGeneric, aN as ReferenceArrayType, dl as AppStorageKind, a$ as UnsupportedType, dm as transientTypeErrors, a7 as GlobalStateGeneric, aR as TemplateVarFunction, dn as getGroupTransactionType, bH as itxnComposePType, aW as Uint64EnumMemberLiteralType, b0 as anyItxnParamsType, c6 as validateEncodingFunctionPType, M as BooleanFunction, aO as StringFunction, aI as ReadonlyArrayGeneric, aK as ReadonlyGeneric, a2 as GeneratorGeneric, a3 as GeneratorType, aG as PromiseGeneric, aH as PromiseType, W as ClassMethodDecoratorContext, aQ as SuperPrototypeSelectorGeneric, aF as PolytypeClassMethodHelper, bL as logFunction, ba as assertFunction, bA as errFunction, bM as loggedAssertFunction, bN as loggedErrFunction, c5 as urangeFunction, br as bzeroFunction, aj as IntrinsicFunctionTypeType, q as ALL_OP_ENUMS, ah as IntrinsicFunctionGroupTypeType, a5 as GlobalMapGeneric, at as LocalStateGeneric, ar as LocalMapGeneric, N as BoxGeneric, Q as BoxMapGeneric, t as ApplicationFunctionType, r as AccountFunction, E as AssetFunction, p as paymentGtxnType, aE as PaymentTxnFunction, k as keyRegistrationGtxnType, an as KeyRegistrationTxnFunction, i as assetConfigGtxnType, B as AssetConfigTxnFunction, j as assetTransferGtxnType, F as AssetTransferTxnFunction, m as assetFreezeGtxnType, D as AssetFreezeTxnFunction, n as applicationCallGtxnType, u as ApplicationTxnFunction, aS as TransactionFunction, bX as paymentItxnFn, bI as keyRegistrationItxnFn, bc as assetConfigItxnFn, bi as assetTransferItxnFn, bf as assetFreezeItxnFn, b3 as applicationCallItxnFn, bZ as paymentItxnType, bK as keyRegistrationItxnType, be as assetConfigItxnType, bk as assetTransferItxnType, bh as assetFreezeItxnType, bY as paymentItxnParamsType, bJ as keyRegistrationItxnParamsType, bd as assetConfigItxnParamsType, bj as assetTransferItxnParamsType, bg as assetFreezeItxnParamsType, b4 as applicationCallItxnParamsType, bC as inputOnlyObjects, dp as Contract, dq as InstanceSuperMethodTarget, dr as ExpressionStatement, ds as AssertExpression, dt as VoidConstant, du as ArrayConcat, dv as ArrayPop, dw as ArrayReplace, dx as ArrayLength, dy as SizeOf, dz as UpdateInnerTransaction, dA as CheckedMaybe, dB as StageInnerTransactions, dC as SubmitInnerTransaction, dD as AssignmentExpression, dE as CommaExpression, dF as NumericComparisonExpression, dG as BytesComparisonExpression, dH as PuyaLibCall, dI as UInt64UnaryOperation, dJ as UInt64PostfixUnaryOperation, dK as BigUIntPostfixUnaryOperation, dL as BytesUnaryOperation, dM as UInt64BinaryOperation, dN as BigUIntBinaryOperation, dO as BooleanBinaryOperation, dP as Not, dQ as Emit, dR as Range, dS as Enumeration, dT as Reversed, dU as StateExists, dV as ARC4Router, dW as MethodSignatureString, dX as SubroutineID, dY as ContractMethodTarget, dZ as InstanceMethodTarget, ca as uint8ArrayToBase32, ck as mkDirIfNotExists, d_ as patchErrorLocation, d$ as Goto, e0 as ReturnStatement, e1 as ContractMethod, e2 as sameSets, b as ContractClassModel, e3 as Subroutine, e4 as LogicSigClassModel, e5 as ptypeIn, e6 as expandMaybeArray, a as LoggingContext, P as PuyaError } from './contract-class-model-Dpn9A-pJ.js';
|
|
2
2
|
import * as fs from 'node:fs';
|
|
3
3
|
import 'node:util';
|
|
4
4
|
import pathe__default, { normalize } from 'pathe';
|
|
@@ -320,7 +320,6 @@ class UintNType extends ARC4EncodedType {
|
|
|
320
320
|
return visitor.visitUintNType(this);
|
|
321
321
|
}
|
|
322
322
|
}
|
|
323
|
-
const arc4Uint64 = new UintNType({ n: 64n });
|
|
324
323
|
const UFixedNxMGeneric = new GenericPType({
|
|
325
324
|
name: 'UFixed',
|
|
326
325
|
module: Constants.moduleNames.algoTs.arc4.encodedTypes,
|
|
@@ -1617,12 +1616,12 @@ function requireStringConstant(builder) {
|
|
|
1617
1616
|
}
|
|
1618
1617
|
function requireIntegerConstant(builder) {
|
|
1619
1618
|
const constant = requestConstantOfType(builder, uint64PType) ?? requestConstantOfType(builder, biguintPType);
|
|
1620
|
-
codeInvariant(constant instanceof IntegerConstant, 'Expected integer literal');
|
|
1619
|
+
codeInvariant(constant instanceof IntegerConstant, 'Expected integer literal', builder.sourceLocation);
|
|
1621
1620
|
return constant;
|
|
1622
1621
|
}
|
|
1623
1622
|
function requireBooleanConstant(builder) {
|
|
1624
1623
|
const constant = requireConstantOfType(builder, boolPType);
|
|
1625
|
-
codeInvariant(constant instanceof BoolConstant, 'Expected boolean literal');
|
|
1624
|
+
codeInvariant(constant instanceof BoolConstant, 'Expected boolean literal', builder.sourceLocation);
|
|
1626
1625
|
return constant;
|
|
1627
1626
|
}
|
|
1628
1627
|
function requestConstantOfType(builder, ptype) {
|
|
@@ -2809,7 +2808,7 @@ let TypeResolver = (() => {
|
|
|
2809
2808
|
}
|
|
2810
2809
|
else if (t instanceof SuperPrototypeSelector) ;
|
|
2811
2810
|
else {
|
|
2812
|
-
throw new CodeError(`Unexpected type: ${t}. Polytype can only be used to support multiple inheritance in contracts for now. All base types must extend the Contract or BaseContract class
|
|
2811
|
+
throw new CodeError(`Unexpected type: ${t}. Polytype can only be used to support multiple inheritance in contracts for now. All base types must extend the Contract or BaseContract class.`, { sourceLocation });
|
|
2813
2812
|
}
|
|
2814
2813
|
}
|
|
2815
2814
|
return new ClusteredContractClassType({
|
|
@@ -3420,7 +3419,7 @@ class ConvertBytesFunctionBuilder extends FunctionBuilder {
|
|
|
3420
3419
|
],
|
|
3421
3420
|
callLocation: sourceLocation,
|
|
3422
3421
|
});
|
|
3423
|
-
codeInvariant(ptype instanceof ARC4EncodedType, 'Generic type must be an ARC4 encoded type');
|
|
3422
|
+
codeInvariant(ptype instanceof ARC4EncodedType, 'Generic type must be an ARC4 encoded type', sourceLocation);
|
|
3424
3423
|
const prefixBytes = getPrefixValue(prefix);
|
|
3425
3424
|
const validate = requireStringConstant(strategy).value === 'validate';
|
|
3426
3425
|
return instanceEb(nodeFactory.aRC4FromBytes({
|
|
@@ -3794,70 +3793,78 @@ class ResolvedObjectLiteralExpressionBuilder extends InstanceExpressionBuilder {
|
|
|
3794
3793
|
class ObjectLiteralExpressionBuilder extends LiteralExpressionBuilder {
|
|
3795
3794
|
ptype;
|
|
3796
3795
|
propertyToItemMap;
|
|
3797
|
-
|
|
3796
|
+
bindings;
|
|
3798
3797
|
isSingleEval;
|
|
3799
3798
|
isConstant = false;
|
|
3800
3799
|
static fromParts(sourceLocation, parts) {
|
|
3800
|
+
// `bindings` preserves every contributing entry in source order, so that destructuring with
|
|
3801
|
+
// duplicate keys (e.g. `({ a: p, a: q } = obj)`) keeps both targets. `propertyToItemMap` maps
|
|
3802
|
+
// each source property name to its latest binding for object-literal "last write wins" semantics
|
|
3803
|
+
// (spread overrides, duplicate keys).
|
|
3801
3804
|
const propertyToItemMap = {};
|
|
3802
|
-
const
|
|
3805
|
+
const bindings = [];
|
|
3803
3806
|
for (const part of parts) {
|
|
3804
3807
|
if (part.type === 'properties') {
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
}
|
|
3808
|
+
const { name, target } = part.property;
|
|
3809
|
+
propertyToItemMap[name] = bindings.length;
|
|
3810
|
+
bindings.push({ name, target });
|
|
3809
3811
|
}
|
|
3810
3812
|
else {
|
|
3811
3813
|
const obj = part.obj.singleEvaluation();
|
|
3812
3814
|
for (const [name] of spreadableProperties(part.obj.ptype, part.spreadLocation)) {
|
|
3813
|
-
propertyToItemMap[name] =
|
|
3814
|
-
|
|
3815
|
+
propertyToItemMap[name] = bindings.length;
|
|
3816
|
+
bindings.push({ name, target: requireInstanceBuilder(obj.memberAccess(name, part.spreadLocation)) });
|
|
3815
3817
|
}
|
|
3816
3818
|
}
|
|
3817
3819
|
}
|
|
3818
|
-
const types = []
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
}
|
|
3823
|
-
return new ObjectLiteralExpressionBuilder(sourceLocation, new ObjectLiteralPType({ properties: types }), propertyToItemMap,
|
|
3820
|
+
const types = Object.entries(propertyToItemMap).map(([name, idx]) => ({
|
|
3821
|
+
name,
|
|
3822
|
+
ptype: bindings[idx].target.ptype,
|
|
3823
|
+
description: null,
|
|
3824
|
+
}));
|
|
3825
|
+
return new ObjectLiteralExpressionBuilder(sourceLocation, new ObjectLiteralPType({ properties: types }), propertyToItemMap, bindings);
|
|
3824
3826
|
}
|
|
3825
|
-
constructor(sourceLocation, ptype, propertyToItemMap,
|
|
3827
|
+
constructor(sourceLocation, ptype, propertyToItemMap, bindings, isSingleEval = false) {
|
|
3826
3828
|
super(sourceLocation);
|
|
3827
3829
|
this.ptype = ptype;
|
|
3828
3830
|
this.propertyToItemMap = propertyToItemMap;
|
|
3829
|
-
this.
|
|
3831
|
+
this.bindings = bindings;
|
|
3830
3832
|
this.isSingleEval = isSingleEval;
|
|
3831
3833
|
}
|
|
3832
3834
|
singleEvaluation() {
|
|
3833
3835
|
if (this.isSingleEval)
|
|
3834
3836
|
return this;
|
|
3837
|
+
invariant(this.bindings.length === Object.keys(this.propertyToItemMap).length, 'singleEvaluation called with duplicate or spread-overridden bindings; route through resolveToPType first');
|
|
3835
3838
|
const tuple = nodeFactory.singleEvaluation({
|
|
3836
3839
|
source: nodeFactory.tupleExpression({
|
|
3837
|
-
items: this.
|
|
3840
|
+
items: this.bindings.map((item) => item.target.resolve()),
|
|
3838
3841
|
sourceLocation: this.sourceLocation,
|
|
3839
3842
|
wtype: this.ptype.wtype,
|
|
3840
3843
|
}),
|
|
3841
3844
|
});
|
|
3842
|
-
return new ObjectLiteralExpressionBuilder(this.sourceLocation, this.ptype, this.propertyToItemMap, this.
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3845
|
+
return new ObjectLiteralExpressionBuilder(this.sourceLocation, this.ptype, this.propertyToItemMap, this.bindings.map((item, index) => ({
|
|
3846
|
+
name: item.name,
|
|
3847
|
+
target: instanceEb(nodeFactory.tupleItemExpression({
|
|
3848
|
+
base: tuple,
|
|
3849
|
+
index: BigInt(index),
|
|
3850
|
+
sourceLocation: item.target.sourceLocation,
|
|
3851
|
+
}), item.target.ptype),
|
|
3852
|
+
})), true);
|
|
3847
3853
|
}
|
|
3848
3854
|
resolve() {
|
|
3849
3855
|
throw new InternalError('Cannot resolve object literal', { sourceLocation: this.sourceLocation });
|
|
3850
3856
|
}
|
|
3851
3857
|
resolveLValue() {
|
|
3858
|
+
invariant(this.bindings.length === Object.keys(this.propertyToItemMap).length, 'resolveLValue called with duplicate bindings; destructuring assignment must iterate bindings via buildAssignmentValues');
|
|
3852
3859
|
return nodeFactory.tupleExpression({
|
|
3853
|
-
items: this.
|
|
3860
|
+
items: this.bindings.map(({ target }) => target.resolveLValue()),
|
|
3854
3861
|
sourceLocation: this.sourceLocation,
|
|
3855
3862
|
wtype: this.ptype.getImmutable().wtype,
|
|
3856
3863
|
});
|
|
3857
3864
|
}
|
|
3858
3865
|
memberAccess(name, sourceLocation) {
|
|
3859
3866
|
if (name in this.propertyToItemMap) {
|
|
3860
|
-
return this.
|
|
3867
|
+
return this.bindings[this.propertyToItemMap[name]].target;
|
|
3861
3868
|
}
|
|
3862
3869
|
throw new CodeError(`${name} does not exist on ${this.typeDescription}`, { sourceLocation });
|
|
3863
3870
|
}
|
|
@@ -3866,7 +3873,7 @@ class ObjectLiteralExpressionBuilder extends LiteralExpressionBuilder {
|
|
|
3866
3873
|
}
|
|
3867
3874
|
toObjectType(ptype) {
|
|
3868
3875
|
let base;
|
|
3869
|
-
if (this.isSingleEval || (this.ptype.hasSameStructure(ptype) && this.
|
|
3876
|
+
if (this.isSingleEval || (this.ptype.hasSameStructure(ptype) && this.bindings.length === Object.keys(ptype.properties).length)) {
|
|
3870
3877
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
3871
3878
|
base = this;
|
|
3872
3879
|
}
|
|
@@ -3876,7 +3883,7 @@ class ObjectLiteralExpressionBuilder extends LiteralExpressionBuilder {
|
|
|
3876
3883
|
const itemToPropertyType = Object.fromEntries(Object.entries(this.propertyToItemMap).map(([propName, index]) => [index, getIndexType(ptype, propName, this.sourceLocation)]));
|
|
3877
3884
|
const tuple = nodeFactory.singleEvaluation({
|
|
3878
3885
|
source: nodeFactory.tupleExpression({
|
|
3879
|
-
items: this.
|
|
3886
|
+
items: this.bindings.map((item, index) => requireExpressionOfType(item.target, itemToPropertyType[index] ?? item.target.ptype)),
|
|
3880
3887
|
sourceLocation: this.sourceLocation,
|
|
3881
3888
|
}),
|
|
3882
3889
|
});
|
|
@@ -3886,7 +3893,11 @@ class ObjectLiteralExpressionBuilder extends LiteralExpressionBuilder {
|
|
|
3886
3893
|
base = new ResolvedObjectLiteralExpressionBuilder(nodeFactory.tupleExpression({
|
|
3887
3894
|
items: ptype.properties.map(({ name }) => {
|
|
3888
3895
|
const index = this.propertyToItemMap[name];
|
|
3889
|
-
return nodeFactory.tupleItemExpression({
|
|
3896
|
+
return nodeFactory.tupleItemExpression({
|
|
3897
|
+
base: tuple,
|
|
3898
|
+
index: BigInt(index),
|
|
3899
|
+
sourceLocation: this.bindings[index].target.sourceLocation,
|
|
3900
|
+
});
|
|
3890
3901
|
}),
|
|
3891
3902
|
sourceLocation: this.sourceLocation,
|
|
3892
3903
|
wtype: tempType.wtype,
|
|
@@ -3916,10 +3927,10 @@ class ObjectLiteralExpressionBuilder extends LiteralExpressionBuilder {
|
|
|
3916
3927
|
checkForUnclonedMutables(scenario) {
|
|
3917
3928
|
const usedIndexes = new Set(Object.values(this.propertyToItemMap));
|
|
3918
3929
|
let contains = false;
|
|
3919
|
-
for (const [idx, item] of this.
|
|
3930
|
+
for (const [idx, item] of this.bindings.entries()) {
|
|
3920
3931
|
if (!usedIndexes.has(idx))
|
|
3921
3932
|
continue;
|
|
3922
|
-
contains ||= item.checkForUnclonedMutables('being used in an object literal');
|
|
3933
|
+
contains ||= item.target.checkForUnclonedMutables('being used in an object literal');
|
|
3923
3934
|
}
|
|
3924
3935
|
return contains;
|
|
3925
3936
|
}
|
|
@@ -3986,7 +3997,7 @@ class Arc4AbiMethodDecoratorBuilder extends NodeBuilder {
|
|
|
3986
3997
|
typeArgs,
|
|
3987
3998
|
genericTypeArgs: 1,
|
|
3988
3999
|
callLocation: sourceLocation,
|
|
3989
|
-
funcName:
|
|
4000
|
+
funcName: Constants.symbolNames.arc4AbiDecoratorName,
|
|
3990
4001
|
argSpec: (a) => [
|
|
3991
4002
|
a.obj({
|
|
3992
4003
|
allowActions: a.optional(stringPType, new ReadonlyArrayPType({ elementType: stringPType })),
|
|
@@ -4041,10 +4052,10 @@ function resolveDefaultArguments(defaultArguments, sourceLocation) {
|
|
|
4041
4052
|
const result = {};
|
|
4042
4053
|
if (!defaultArguments)
|
|
4043
4054
|
return result;
|
|
4044
|
-
codeInvariant(defaultArguments instanceof ObjectLiteralExpressionBuilder, `Default argument specification should be an object literal
|
|
4055
|
+
codeInvariant(defaultArguments instanceof ObjectLiteralExpressionBuilder, `Default argument specification should be an object literal`, sourceLocation);
|
|
4045
4056
|
for (const { name } of defaultArguments.ptype.properties) {
|
|
4046
4057
|
const paramConfig = defaultArguments.memberAccess(name, sourceLocation);
|
|
4047
|
-
codeInvariant(paramConfig instanceof ObjectLiteralExpressionBuilder, 'Default argument specification should be an object literal');
|
|
4058
|
+
codeInvariant(paramConfig instanceof ObjectLiteralExpressionBuilder, 'Default argument specification should be an object literal', sourceLocation);
|
|
4048
4059
|
if (paramConfig.hasProperty('constant')) {
|
|
4049
4060
|
result[name] = {
|
|
4050
4061
|
type: 'constant',
|
|
@@ -5914,7 +5925,7 @@ class ItxnParamsFactoryFunctionBuilder extends FunctionBuilder {
|
|
|
5914
5925
|
}
|
|
5915
5926
|
}
|
|
5916
5927
|
function mapTransactionFields(mappedFields, fields, kind, sourceLocation, ignoreProps) {
|
|
5917
|
-
codeInvariant(isObjectType$1(fields.ptype), 'fields argument must be an object type');
|
|
5928
|
+
codeInvariant(isObjectType$1(fields.ptype), 'fields argument must be an object type', sourceLocation);
|
|
5918
5929
|
for (const { name } of fields.ptype.properties) {
|
|
5919
5930
|
if (ignoreProps?.has(name))
|
|
5920
5931
|
continue;
|
|
@@ -6330,7 +6341,7 @@ function getOca(ocaField, allowedCompletionTypes, sourceLocation) {
|
|
|
6330
6341
|
if (ocaField) {
|
|
6331
6342
|
codeInvariant(ocaField instanceof IntegerConstant, `${txnFieldName.onCompletion} should be a compile time constant`, ocaField.sourceLocation);
|
|
6332
6343
|
const oca = enumFromValue(Number(ocaField.value), OnCompletionAction);
|
|
6333
|
-
codeInvariant(allowedCompletionTypes.includes(oca), `${txnFieldName.onCompletion} should be one of ${allowedCompletionTypes}
|
|
6344
|
+
codeInvariant(allowedCompletionTypes.includes(oca), `${txnFieldName.onCompletion} should be one of ${allowedCompletionTypes}`, ocaField.sourceLocation);
|
|
6334
6345
|
return oca;
|
|
6335
6346
|
}
|
|
6336
6347
|
else {
|
|
@@ -6675,7 +6686,7 @@ function newUintN(initialValueBuilder, ptype, sourceLocation) {
|
|
|
6675
6686
|
if (initialValueBuilder.resolvableToPType(uint64PType)) {
|
|
6676
6687
|
const initialValue = initialValueBuilder.resolveToPType(uint64PType).resolve();
|
|
6677
6688
|
if (initialValue instanceof IntegerConstant) {
|
|
6678
|
-
codeInvariant(isValidLiteralForPType(initialValue.value, ptype), `${initialValue.value} cannot be converted to ${ptype}
|
|
6689
|
+
codeInvariant(isValidLiteralForPType(initialValue.value, ptype), `${initialValue.value} cannot be converted to ${ptype}`, sourceLocation);
|
|
6679
6690
|
return new UintNExpressionBuilder(nodeFactory.integerConstant({
|
|
6680
6691
|
value: initialValue.value,
|
|
6681
6692
|
wtype: ptype.wtype,
|
|
@@ -6694,7 +6705,7 @@ function newUintN(initialValueBuilder, ptype, sourceLocation) {
|
|
|
6694
6705
|
if (initialValueBuilder.resolvableToPType(biguintPType)) {
|
|
6695
6706
|
const initialValue = initialValueBuilder.resolveToPType(biguintPType).resolve();
|
|
6696
6707
|
if (initialValue instanceof IntegerConstant) {
|
|
6697
|
-
codeInvariant(isValidLiteralForPType(initialValue.value, ptype), `${initialValue.value} cannot be converted to ${ptype}
|
|
6708
|
+
codeInvariant(isValidLiteralForPType(initialValue.value, ptype), `${initialValue.value} cannot be converted to ${ptype}`, sourceLocation);
|
|
6698
6709
|
return new UintNExpressionBuilder(nodeFactory.integerConstant({
|
|
6699
6710
|
value: initialValue.value,
|
|
6700
6711
|
wtype: ptype.wtypeOrThrow,
|
|
@@ -6720,12 +6731,12 @@ function newUintN(initialValueBuilder, ptype, sourceLocation) {
|
|
|
6720
6731
|
let sourceLength;
|
|
6721
6732
|
if (initialValue instanceof BytesConstant) {
|
|
6722
6733
|
// Constant bytes: compile-time length check via value
|
|
6723
|
-
codeInvariant(isValidLiteralForPType(initialValue.value, ptype), `${initialValue.value} cannot be converted to ${ptype}
|
|
6734
|
+
codeInvariant(isValidLiteralForPType(initialValue.value, ptype), `${initialValue.value} cannot be converted to ${ptype}`, sourceLocation);
|
|
6724
6735
|
sourceLength = BigInt(initialValue.value.byteLength);
|
|
6725
6736
|
}
|
|
6726
6737
|
else if (originalType instanceof BytesPType && originalType.length !== null) {
|
|
6727
6738
|
// Fixed-size bytes type: compile-time length check via type
|
|
6728
|
-
codeInvariant(originalType.length <= expectedLength, `${originalType} cannot be converted to ${ptype}
|
|
6739
|
+
codeInvariant(originalType.length <= expectedLength, `${originalType} cannot be converted to ${ptype}`, sourceLocation);
|
|
6729
6740
|
sourceLength = originalType.length;
|
|
6730
6741
|
}
|
|
6731
6742
|
if (sourceLength !== undefined) {
|
|
@@ -6898,7 +6909,7 @@ class PushFunctionBuilder extends FunctionBuilder {
|
|
|
6898
6909
|
funcName: 'Array.push',
|
|
6899
6910
|
});
|
|
6900
6911
|
const target = this.arrayBuilder.resolve();
|
|
6901
|
-
codeInvariant(isReferableExpression(target), 'target of Array.push method must be a variable or state expression');
|
|
6912
|
+
codeInvariant(isReferableExpression(target), 'target of Array.push method must be a variable or state expression', sourceLocation);
|
|
6902
6913
|
return instanceEb(nodeFactory.commaExpression({
|
|
6903
6914
|
expressions: [
|
|
6904
6915
|
nodeFactory.arrayExtend({
|
|
@@ -7222,7 +7233,7 @@ class VoidExpressionBuilder extends InstanceExpressionBuilder {
|
|
|
7222
7233
|
super(expr, voidPType);
|
|
7223
7234
|
}
|
|
7224
7235
|
resolveLValue() {
|
|
7225
|
-
throw new CodeError(`${this.typeDescription} is not a valid assignment target
|
|
7236
|
+
throw new CodeError(`${this.typeDescription} is not a valid assignment target`, { sourceLocation: this.sourceLocation });
|
|
7226
7237
|
}
|
|
7227
7238
|
}
|
|
7228
7239
|
|
|
@@ -8431,7 +8442,7 @@ class PolytypeClassSuperMethodBuilder extends FunctionBuilder {
|
|
|
8431
8442
|
argSpec: (a) => [a.required(ContractClassPType)],
|
|
8432
8443
|
});
|
|
8433
8444
|
const matchedBaseType = this.ptype.baseTypes.find((b) => b.equals(contract.ptype));
|
|
8434
|
-
codeInvariant(matchedBaseType, `${contract.ptype} must be a direct base type of this class
|
|
8445
|
+
codeInvariant(matchedBaseType, `${contract.ptype} must be a direct base type of this class`, sourceLocation);
|
|
8435
8446
|
return new PolytypeExplicitClassAccessExpressionBuilder(matchedBaseType, sourceLocation);
|
|
8436
8447
|
}
|
|
8437
8448
|
}
|
|
@@ -8442,10 +8453,10 @@ class PolytypeExplicitClassAccessExpressionBuilder extends InstanceBuilder {
|
|
|
8442
8453
|
ptype;
|
|
8443
8454
|
isConstant = false;
|
|
8444
8455
|
resolve() {
|
|
8445
|
-
throw new CodeError('Contract class cannot be used as a value');
|
|
8456
|
+
throw new CodeError('Contract class cannot be used as a value', { sourceLocation: this.sourceLocation });
|
|
8446
8457
|
}
|
|
8447
8458
|
resolveLValue() {
|
|
8448
|
-
throw new CodeError('Contract class cannot be used as a value');
|
|
8459
|
+
throw new CodeError('Contract class cannot be used as a value', { sourceLocation: this.sourceLocation });
|
|
8449
8460
|
}
|
|
8450
8461
|
constructor(ptype, sourceLocation) {
|
|
8451
8462
|
super(sourceLocation);
|
|
@@ -8467,10 +8478,10 @@ class PolytypeExplicitClassAccessExpressionBuilder extends InstanceBuilder {
|
|
|
8467
8478
|
class ContractClassBuilder extends InstanceBuilder {
|
|
8468
8479
|
isConstant = false;
|
|
8469
8480
|
resolve() {
|
|
8470
|
-
throw new CodeError('Contract class cannot be used as a value');
|
|
8481
|
+
throw new CodeError('Contract class cannot be used as a value', { sourceLocation: this.sourceLocation });
|
|
8471
8482
|
}
|
|
8472
8483
|
resolveLValue() {
|
|
8473
|
-
throw new CodeError('Contract class cannot be used as a value');
|
|
8484
|
+
throw new CodeError('Contract class cannot be used as a value', { sourceLocation: this.sourceLocation });
|
|
8474
8485
|
}
|
|
8475
8486
|
ptype;
|
|
8476
8487
|
constructor(sourceLocation, ptype) {
|
|
@@ -8479,10 +8490,10 @@ class ContractClassBuilder extends InstanceBuilder {
|
|
|
8479
8490
|
this.ptype = ptype;
|
|
8480
8491
|
}
|
|
8481
8492
|
newCall(args, typeArgs, sourceLocation) {
|
|
8482
|
-
throw new CodeError('Contract class cannot be constructed manually');
|
|
8493
|
+
throw new CodeError('Contract class cannot be constructed manually', { sourceLocation });
|
|
8483
8494
|
}
|
|
8484
8495
|
call(args, typeArgs, sourceLocation) {
|
|
8485
|
-
throw new CodeError('Contract class cannot be called manually');
|
|
8496
|
+
throw new CodeError('Contract class cannot be called manually', { sourceLocation });
|
|
8486
8497
|
}
|
|
8487
8498
|
memberAccess(name, sourceLocation) {
|
|
8488
8499
|
switch (name) {
|
|
@@ -8712,10 +8723,10 @@ class LogFunctionBuilder extends FunctionBuilder {
|
|
|
8712
8723
|
class LogicSigClassBuilder extends InstanceBuilder {
|
|
8713
8724
|
isConstant = false;
|
|
8714
8725
|
resolve() {
|
|
8715
|
-
throw new CodeError('LogicSig class cannot be used as a value');
|
|
8726
|
+
throw new CodeError('LogicSig class cannot be used as a value', { sourceLocation: this.sourceLocation });
|
|
8716
8727
|
}
|
|
8717
8728
|
resolveLValue() {
|
|
8718
|
-
throw new CodeError('LogicSig class cannot be used as a value');
|
|
8729
|
+
throw new CodeError('LogicSig class cannot be used as a value', { sourceLocation: this.sourceLocation });
|
|
8719
8730
|
}
|
|
8720
8731
|
ptype;
|
|
8721
8732
|
constructor(sourceLocation, ptype) {
|
|
@@ -8724,10 +8735,10 @@ class LogicSigClassBuilder extends InstanceBuilder {
|
|
|
8724
8735
|
this.ptype = ptype;
|
|
8725
8736
|
}
|
|
8726
8737
|
newCall(args, typeArgs, sourceLocation) {
|
|
8727
|
-
throw new CodeError('LogicSig class cannot be constructed manually');
|
|
8738
|
+
throw new CodeError('LogicSig class cannot be constructed manually', { sourceLocation });
|
|
8728
8739
|
}
|
|
8729
8740
|
call(args, typeArgs, sourceLocation) {
|
|
8730
|
-
throw new CodeError('LogicSig class cannot be called manually');
|
|
8741
|
+
throw new CodeError('LogicSig class cannot be called manually', { sourceLocation });
|
|
8731
8742
|
}
|
|
8732
8743
|
}
|
|
8733
8744
|
class LogicSigOptionsDecoratorBuilder extends FunctionBuilder {
|
|
@@ -15343,7 +15354,7 @@ class LocalStateFunctionResultBuilder extends InstanceBuilder {
|
|
|
15343
15354
|
ptype;
|
|
15344
15355
|
buildStorageDeclaration(memberName, memberLocation, memberDescription, contractType) {
|
|
15345
15356
|
if (this._expr)
|
|
15346
|
-
codeInvariant(this._expr instanceof BytesConstant, `key is must be a compile time constant value if ${this.typeDescription} is assigned to a contract member
|
|
15357
|
+
codeInvariant(this._expr instanceof BytesConstant, `key is must be a compile time constant value if ${this.typeDescription} is assigned to a contract member`, memberLocation);
|
|
15347
15358
|
return new AppStorageDeclaration({
|
|
15348
15359
|
sourceLocation: memberLocation,
|
|
15349
15360
|
ptype: this.ptype,
|
|
@@ -15831,13 +15842,13 @@ class ValidateEncodingFunctionBuilder extends FunctionBuilder {
|
|
|
15831
15842
|
argSpec: (a) => [a.required()],
|
|
15832
15843
|
callLocation: sourceLocation,
|
|
15833
15844
|
});
|
|
15834
|
-
codeInvariant(!(ptype instanceof BytesPType) || ptype.length !== null, 'Cannot validate unbounded bytes');
|
|
15845
|
+
codeInvariant(!(ptype instanceof BytesPType) || ptype.length !== null, 'Cannot validate unbounded bytes', sourceLocation);
|
|
15835
15846
|
const validateType = ptype.equals(accountPType)
|
|
15836
15847
|
? arc4AddressAlias
|
|
15837
15848
|
: ptype instanceof BytesPType && ptype.length !== null
|
|
15838
15849
|
? new StaticBytesType({ length: ptype.length })
|
|
15839
15850
|
: ptype;
|
|
15840
|
-
codeInvariant(validateType.wtype instanceof wtypes.ARC4Type, 'Can only validate ARC4-encoded types');
|
|
15851
|
+
codeInvariant(validateType.wtype instanceof wtypes.ARC4Type, 'Can only validate ARC4-encoded types', sourceLocation);
|
|
15841
15852
|
const expr = nodeFactory.aRC4FromBytes({
|
|
15842
15853
|
value: theValue.resolve(),
|
|
15843
15854
|
validate: true,
|
|
@@ -16024,11 +16035,11 @@ function registerPTypes(typeRegistry) {
|
|
|
16024
16035
|
typeRegistry.register({ ptype: arc4BareMethodDecorator, singletonEb: Arc4BareMethodDecoratorBuilder });
|
|
16025
16036
|
typeRegistry.register({ ptype: ByteClass, singletonEb: classBuilderForUintNAlias(ByteClass, arc4ByteAlias) });
|
|
16026
16037
|
typeRegistry.register({ ptype: UintN8Class, singletonEb: classBuilderForUintNAlias(UintN8Class, new UintNType({ n: 8n })) });
|
|
16027
|
-
typeRegistry.register({ ptype: UintN16Class, singletonEb: classBuilderForUintNAlias(
|
|
16028
|
-
typeRegistry.register({ ptype: UintN32Class, singletonEb: classBuilderForUintNAlias(
|
|
16029
|
-
typeRegistry.register({ ptype: UintN64Class, singletonEb: classBuilderForUintNAlias(
|
|
16030
|
-
typeRegistry.register({ ptype: UintN128Class, singletonEb: classBuilderForUintNAlias(
|
|
16031
|
-
typeRegistry.register({ ptype: UintN256Class, singletonEb: classBuilderForUintNAlias(
|
|
16038
|
+
typeRegistry.register({ ptype: UintN16Class, singletonEb: classBuilderForUintNAlias(UintN16Class, new UintNType({ n: 16n })) });
|
|
16039
|
+
typeRegistry.register({ ptype: UintN32Class, singletonEb: classBuilderForUintNAlias(UintN32Class, new UintNType({ n: 32n })) });
|
|
16040
|
+
typeRegistry.register({ ptype: UintN64Class, singletonEb: classBuilderForUintNAlias(UintN64Class, new UintNType({ n: 64n })) });
|
|
16041
|
+
typeRegistry.register({ ptype: UintN128Class, singletonEb: classBuilderForUintNAlias(UintN128Class, new UintNType({ n: 128n })) });
|
|
16042
|
+
typeRegistry.register({ ptype: UintN256Class, singletonEb: classBuilderForUintNAlias(UintN256Class, new UintNType({ n: 256n })) });
|
|
16032
16043
|
typeRegistry.registerGeneric({
|
|
16033
16044
|
generic: UintNGeneric,
|
|
16034
16045
|
ptype: UintNType,
|
|
@@ -17229,6 +17240,26 @@ const accept = (visitor, node) => {
|
|
|
17229
17240
|
}
|
|
17230
17241
|
};
|
|
17231
17242
|
|
|
17243
|
+
class LooseEqualityOperator extends CodeFix {
|
|
17244
|
+
constructor({ sourceLocation, errorMessage, operatorRequired, }) {
|
|
17245
|
+
super({
|
|
17246
|
+
sourceLocation,
|
|
17247
|
+
errorMessage,
|
|
17248
|
+
fixMessage: `Replace with ${operatorRequired}`,
|
|
17249
|
+
logLevel: LogLevel.Error,
|
|
17250
|
+
edits: LooseEqualityOperator.buildEdits(sourceLocation.node, operatorRequired),
|
|
17251
|
+
});
|
|
17252
|
+
}
|
|
17253
|
+
static buildEdits(node, operatorRequired) {
|
|
17254
|
+
return [
|
|
17255
|
+
{
|
|
17256
|
+
range: getNodeRange(node),
|
|
17257
|
+
newText: operatorRequired,
|
|
17258
|
+
},
|
|
17259
|
+
];
|
|
17260
|
+
}
|
|
17261
|
+
}
|
|
17262
|
+
|
|
17232
17263
|
class NoOpNonNullAssertion extends CodeFix {
|
|
17233
17264
|
constructor({ sourceLocation }) {
|
|
17234
17265
|
super({
|
|
@@ -17252,26 +17283,6 @@ class NoOpNonNullAssertion extends CodeFix {
|
|
|
17252
17283
|
}
|
|
17253
17284
|
}
|
|
17254
17285
|
|
|
17255
|
-
class LooseEqualityOperator extends CodeFix {
|
|
17256
|
-
constructor({ sourceLocation, errorMessage, operatorRequired, }) {
|
|
17257
|
-
super({
|
|
17258
|
-
sourceLocation,
|
|
17259
|
-
errorMessage,
|
|
17260
|
-
fixMessage: `Replace with ${operatorRequired}`,
|
|
17261
|
-
logLevel: LogLevel.Error,
|
|
17262
|
-
edits: LooseEqualityOperator.buildEdits(sourceLocation.node, operatorRequired),
|
|
17263
|
-
});
|
|
17264
|
-
}
|
|
17265
|
-
static buildEdits(node, operatorRequired) {
|
|
17266
|
-
return [
|
|
17267
|
-
{
|
|
17268
|
-
range: getNodeRange(node),
|
|
17269
|
-
newText: operatorRequired,
|
|
17270
|
-
},
|
|
17271
|
-
];
|
|
17272
|
-
}
|
|
17273
|
-
}
|
|
17274
|
-
|
|
17275
17286
|
class ConditionalExpressionBuilder extends LiteralExpressionBuilder {
|
|
17276
17287
|
isConstant = false;
|
|
17277
17288
|
_ptype;
|
|
@@ -17353,9 +17364,9 @@ function handleAssignmentStatement(context, target, source, sourceLocation) {
|
|
|
17353
17364
|
return nodeFactory.expressionStatement({ expr: handleAssignment(context, target, source, sourceLocation, true).resolve() });
|
|
17354
17365
|
}
|
|
17355
17366
|
function handleAssignment(context, target, source, sourceLocation, isStatement) {
|
|
17356
|
-
checkForUnclonedMutables(target, source
|
|
17367
|
+
checkForUnclonedMutables(target, source);
|
|
17357
17368
|
if (isSpecialItxnType(source)) {
|
|
17358
|
-
codeInvariant(isStatement, 'inner transaction results can not be used in assignment expressions');
|
|
17369
|
+
codeInvariant(isStatement, 'inner transaction results can not be used in assignment expressions', sourceLocation);
|
|
17359
17370
|
return handleItxnAssignment(context, target, source, sourceLocation);
|
|
17360
17371
|
}
|
|
17361
17372
|
const narrowedSourceType = narrowSourceType(target.ptype, source.ptype, sourceLocation);
|
|
@@ -17389,7 +17400,7 @@ function buildAssignmentValues(target, source, sourceLocation) {
|
|
|
17389
17400
|
for (const [index, item] of target[StaticIterator]().entries()) {
|
|
17390
17401
|
if (item instanceof OmittedExpressionBuilder)
|
|
17391
17402
|
continue;
|
|
17392
|
-
const values = buildAssignmentValues(item, requireInstanceBuilder(source.indexAccess(BigInt(index), source.sourceLocation))
|
|
17403
|
+
const values = buildAssignmentValues(item, requireInstanceBuilder(source.indexAccess(BigInt(index), source.sourceLocation)));
|
|
17393
17404
|
targets.push(values.target);
|
|
17394
17405
|
sources.push(values.source);
|
|
17395
17406
|
}
|
|
@@ -17399,11 +17410,11 @@ function buildAssignmentValues(target, source, sourceLocation) {
|
|
|
17399
17410
|
};
|
|
17400
17411
|
}
|
|
17401
17412
|
else if (target instanceof ObjectLiteralExpressionBuilder) {
|
|
17402
|
-
//
|
|
17413
|
+
// Destructured object
|
|
17403
17414
|
const targets = [];
|
|
17404
17415
|
const sources = [];
|
|
17405
|
-
for (const { name } of target.
|
|
17406
|
-
const values = buildAssignmentValues(
|
|
17416
|
+
for (const { name, target: targetBuilder } of target.bindings) {
|
|
17417
|
+
const values = buildAssignmentValues(targetBuilder, requireInstanceBuilder(source.memberAccess(name, source.sourceLocation)));
|
|
17407
17418
|
targets.push(values.target);
|
|
17408
17419
|
sources.push(values.source);
|
|
17409
17420
|
}
|
|
@@ -17423,7 +17434,7 @@ function buildAssignmentExpression(target, source, sourceLocation, isStatement)
|
|
|
17423
17434
|
const expressionType = getAssignmentExpressionType(target.ptype, source.ptype);
|
|
17424
17435
|
// Skip single eval for non-destructuring assignments
|
|
17425
17436
|
const sourceSingle = isDestructuringAssignment(target) || (!target.ptype.equals(expressionType) && !isStatement) ? source.singleEvaluation() : source;
|
|
17426
|
-
const assignmentValues = buildAssignmentValues(target, sourceSingle
|
|
17437
|
+
const assignmentValues = buildAssignmentValues(target, sourceSingle);
|
|
17427
17438
|
const assignment = nodeFactory.assignmentExpression({
|
|
17428
17439
|
target: assignmentValues.target,
|
|
17429
17440
|
value: assignmentValues.source,
|
|
@@ -17532,12 +17543,12 @@ function handleItxnAssignment(context, target, source, sourceLocation) {
|
|
|
17532
17543
|
function checkForUnclonedMutables(target, source, sourceLocation) {
|
|
17533
17544
|
if (target instanceof ArrayLiteralExpressionBuilder) {
|
|
17534
17545
|
for (const [index, item] of target[StaticIterator]().entries()) {
|
|
17535
|
-
checkForUnclonedMutables(item, requireInstanceBuilder(source.indexAccess(BigInt(index), source.sourceLocation))
|
|
17546
|
+
checkForUnclonedMutables(item, requireInstanceBuilder(source.indexAccess(BigInt(index), source.sourceLocation)));
|
|
17536
17547
|
}
|
|
17537
17548
|
}
|
|
17538
17549
|
else if (target instanceof ObjectLiteralExpressionBuilder) {
|
|
17539
|
-
for (const { name } of target.
|
|
17540
|
-
checkForUnclonedMutables(
|
|
17550
|
+
for (const { name, target: targetBuilder } of target.bindings) {
|
|
17551
|
+
checkForUnclonedMutables(targetBuilder, requireInstanceBuilder(source.memberAccess(name, source.sourceLocation)));
|
|
17541
17552
|
}
|
|
17542
17553
|
}
|
|
17543
17554
|
else {
|
|
@@ -17670,8 +17681,9 @@ class BaseVisitor {
|
|
|
17670
17681
|
return [
|
|
17671
17682
|
{
|
|
17672
17683
|
type: 'properties',
|
|
17673
|
-
|
|
17674
|
-
|
|
17684
|
+
property: {
|
|
17685
|
+
name: this.textVisitor.accept(p.name),
|
|
17686
|
+
target: requireInstanceBuilder(this.baseAccept(p.initializer)),
|
|
17675
17687
|
},
|
|
17676
17688
|
},
|
|
17677
17689
|
];
|
|
@@ -17681,7 +17693,7 @@ class BaseVisitor {
|
|
|
17681
17693
|
return [
|
|
17682
17694
|
{
|
|
17683
17695
|
type: 'properties',
|
|
17684
|
-
|
|
17696
|
+
property: { name: this.textVisitor.accept(p.name), target: requireInstanceBuilder(this.baseAccept(p.name)) },
|
|
17685
17697
|
},
|
|
17686
17698
|
];
|
|
17687
17699
|
case ts.SyntaxKind.SpreadAssignment:
|
|
@@ -17984,7 +17996,7 @@ class BaseVisitor {
|
|
|
17984
17996
|
sourceLocation,
|
|
17985
17997
|
}), right.ptype);
|
|
17986
17998
|
}
|
|
17987
|
-
|
|
17999
|
+
this.throwNotSupported(node, `Binary expression with op ${getSyntaxName(binaryOpKind)}`);
|
|
17988
18000
|
}
|
|
17989
18001
|
visitConditionalExpression(node) {
|
|
17990
18002
|
const sourceLocation = this.sourceLocation(node);
|
|
@@ -18211,7 +18223,7 @@ class DecoratorVisitor extends BaseVisitor {
|
|
|
18211
18223
|
let readonlyDecorator = undefined;
|
|
18212
18224
|
for (const data of DecoratorVisitor.buildDecoratorData(target)) {
|
|
18213
18225
|
switch (data.type) {
|
|
18214
|
-
case
|
|
18226
|
+
case Constants.symbolNames.arc4AbiDecoratorName:
|
|
18215
18227
|
if (abiDecorator) {
|
|
18216
18228
|
logger.error(data.sourceLocation, 'Only one abimethod decorator is allowed per method. Multiple on complete actions can be provided in a single decorator');
|
|
18217
18229
|
}
|
|
@@ -18222,7 +18234,7 @@ class DecoratorVisitor extends BaseVisitor {
|
|
|
18222
18234
|
abiDecorator = data;
|
|
18223
18235
|
}
|
|
18224
18236
|
break;
|
|
18225
|
-
case
|
|
18237
|
+
case Constants.symbolNames.arc4BareDecoratorName:
|
|
18226
18238
|
if (bareDecorator) {
|
|
18227
18239
|
logger.error(data.sourceLocation, 'Only one baremethod decorator is allowed per method. Multiple on complete actions can be provided in a single decorator');
|
|
18228
18240
|
}
|
|
@@ -18233,7 +18245,7 @@ class DecoratorVisitor extends BaseVisitor {
|
|
|
18233
18245
|
bareDecorator = data;
|
|
18234
18246
|
}
|
|
18235
18247
|
break;
|
|
18236
|
-
case
|
|
18248
|
+
case Constants.symbolNames.readonlyDecoratorName:
|
|
18237
18249
|
if (readonlyDecorator) {
|
|
18238
18250
|
logger.error(data.sourceLocation, 'Only one readonly decorator is allowed per method');
|
|
18239
18251
|
}
|
|
@@ -18313,7 +18325,7 @@ class FunctionVisitor extends BaseVisitor {
|
|
|
18313
18325
|
const sourceLocation = this.sourceLocation(node);
|
|
18314
18326
|
const args = node.parameters.map((p) => this.accept(p));
|
|
18315
18327
|
const assignDestructuredParams = this.evaluateParameterBindingExpressions(node.parameters, sourceLocation);
|
|
18316
|
-
codeInvariant(node.body, 'Functions must have a body');
|
|
18328
|
+
codeInvariant(node.body, 'Functions must have a body', sourceLocation);
|
|
18317
18329
|
const body = assignDestructuredParams.length
|
|
18318
18330
|
? nodeFactory.block({ sourceLocation }, assignDestructuredParams, this.accept(node.body))
|
|
18319
18331
|
: this.accept(node.body);
|
|
@@ -18326,17 +18338,23 @@ class FunctionVisitor extends BaseVisitor {
|
|
|
18326
18338
|
visitBindingName(bindingName, sourceLocation) {
|
|
18327
18339
|
switch (bindingName.kind) {
|
|
18328
18340
|
case ts.SyntaxKind.ObjectBindingPattern: {
|
|
18329
|
-
const
|
|
18341
|
+
const parts = [];
|
|
18330
18342
|
for (const element of bindingName.elements) {
|
|
18331
18343
|
const sourceLocation = this.sourceLocation(element);
|
|
18332
|
-
const
|
|
18333
|
-
|
|
18334
|
-
const propertyName = this.textVisitor.accept(propertyNameIdentifier);
|
|
18344
|
+
const sourcePropertyNameIdentifier = element.propertyName ?? element.name;
|
|
18345
|
+
codeInvariant(ts.isIdentifier(sourcePropertyNameIdentifier), 'propertyName must be an identifier', sourceLocation);
|
|
18335
18346
|
codeInvariant(!element.dotDotDotToken, 'Spread operator is not supported here', sourceLocation);
|
|
18336
18347
|
codeInvariant(!element.initializer, 'Initializer on object binding pattern is not supported', sourceLocation);
|
|
18337
|
-
|
|
18348
|
+
const sourcePropertyName = this.textVisitor.accept(sourcePropertyNameIdentifier);
|
|
18349
|
+
parts.push({
|
|
18350
|
+
type: 'properties',
|
|
18351
|
+
property: {
|
|
18352
|
+
name: sourcePropertyName,
|
|
18353
|
+
target: this.visitBindingName(element.name, sourceLocation),
|
|
18354
|
+
},
|
|
18355
|
+
});
|
|
18338
18356
|
}
|
|
18339
|
-
return ObjectLiteralExpressionBuilder.fromParts(sourceLocation,
|
|
18357
|
+
return ObjectLiteralExpressionBuilder.fromParts(sourceLocation, parts);
|
|
18340
18358
|
}
|
|
18341
18359
|
case ts.SyntaxKind.ArrayBindingPattern: {
|
|
18342
18360
|
const items = [];
|
|
@@ -18389,9 +18407,7 @@ class FunctionVisitor extends BaseVisitor {
|
|
|
18389
18407
|
return [];
|
|
18390
18408
|
}
|
|
18391
18409
|
visitClassDeclaration(node) {
|
|
18392
|
-
|
|
18393
|
-
sourceLocation: this.sourceLocation(node),
|
|
18394
|
-
});
|
|
18410
|
+
this.throwNotSupported(node, 'Nested classes');
|
|
18395
18411
|
}
|
|
18396
18412
|
visitVariableDeclarationList(node) {
|
|
18397
18413
|
const isConstDeclaration = hasFlags(node.flags, ts.NodeFlags.Const);
|
|
@@ -18401,7 +18417,7 @@ class FunctionVisitor extends BaseVisitor {
|
|
|
18401
18417
|
// Typescript will already error if a destructuring expression is used without an initializer
|
|
18402
18418
|
if (ts.isIdentifier(d.name)) {
|
|
18403
18419
|
const ptype = this.context.getPTypeForNode(d.name);
|
|
18404
|
-
codeInvariant(ptype.wtype, `${ptype.fullName} is not a valid variable type
|
|
18420
|
+
codeInvariant(ptype.wtype, `${ptype.fullName} is not a valid variable type`, sourceLocation);
|
|
18405
18421
|
}
|
|
18406
18422
|
return [];
|
|
18407
18423
|
}
|
|
@@ -18521,14 +18537,10 @@ class FunctionVisitor extends BaseVisitor {
|
|
|
18521
18537
|
}
|
|
18522
18538
|
}
|
|
18523
18539
|
visitForInStatement(node) {
|
|
18524
|
-
|
|
18525
|
-
sourceLocation: this.sourceLocation(node),
|
|
18526
|
-
});
|
|
18540
|
+
this.throwNotSupported(node, 'For in statements');
|
|
18527
18541
|
}
|
|
18528
18542
|
visitTryStatement(node) {
|
|
18529
|
-
|
|
18530
|
-
sourceLocation: this.sourceLocation(node),
|
|
18531
|
-
});
|
|
18543
|
+
this.throwNotSupported(node, 'Try statements');
|
|
18532
18544
|
}
|
|
18533
18545
|
visitEmptyStatement(node) {
|
|
18534
18546
|
return nodeFactory.block({ sourceLocation: this.sourceLocation(node), comment: 'Empty statement' });
|
|
@@ -18624,7 +18636,7 @@ class FunctionVisitor extends BaseVisitor {
|
|
|
18624
18636
|
});
|
|
18625
18637
|
}
|
|
18626
18638
|
visitWithStatement(node) {
|
|
18627
|
-
|
|
18639
|
+
this.throwNotSupported(node, 'with statements');
|
|
18628
18640
|
}
|
|
18629
18641
|
visitSwitchStatement(node) {
|
|
18630
18642
|
const env_5 = { stack: [], error: void 0, hasError: false };
|
|
@@ -18673,16 +18685,14 @@ class FunctionVisitor extends BaseVisitor {
|
|
|
18673
18685
|
return this.accept(node.statement);
|
|
18674
18686
|
}
|
|
18675
18687
|
visitThrowStatement(node) {
|
|
18676
|
-
|
|
18677
|
-
sourceLocation: this.sourceLocation(node),
|
|
18678
|
-
});
|
|
18688
|
+
this.throwNotSupported(node, 'Throw statements');
|
|
18679
18689
|
}
|
|
18680
18690
|
visitDebuggerStatement(node) {
|
|
18681
18691
|
logger.warn(this.sourceLocation(node), 'Ignoring debugger statement');
|
|
18682
18692
|
return [];
|
|
18683
18693
|
}
|
|
18684
18694
|
visitImportDeclaration(node) {
|
|
18685
|
-
|
|
18695
|
+
this.throwNotSupported(node, 'Non-top-level import declarations');
|
|
18686
18696
|
}
|
|
18687
18697
|
visitBlock(node) {
|
|
18688
18698
|
return nodeFactory.block({
|
|
@@ -18818,7 +18828,7 @@ class ContractMethodVisitor extends ContractMethodBaseVisitor {
|
|
|
18818
18828
|
allowedCompletionTypes: [OnCompletionAction.NoOp],
|
|
18819
18829
|
create: ARC4CreateOption.disallow,
|
|
18820
18830
|
};
|
|
18821
|
-
if (decorator?.type ===
|
|
18831
|
+
if (decorator?.type === Constants.symbolNames.arc4BareDecoratorName) {
|
|
18822
18832
|
this.checkBareMethodTypes(functionType, methodLocation);
|
|
18823
18833
|
return new ARC4BareMethodConfig({
|
|
18824
18834
|
sourceLocation: decorator.sourceLocation,
|
|
@@ -18826,7 +18836,7 @@ class ContractMethodVisitor extends ContractMethodBaseVisitor {
|
|
|
18826
18836
|
create: decorator.create ?? conventionalDefaults?.create ?? unspecifiedDefaults.create,
|
|
18827
18837
|
});
|
|
18828
18838
|
}
|
|
18829
|
-
if (decorator?.type ===
|
|
18839
|
+
if (decorator?.type === Constants.symbolNames.arc4AbiDecoratorName) {
|
|
18830
18840
|
return new ARC4ABIMethodConfig({
|
|
18831
18841
|
readonly: decorator.readonly ?? false,
|
|
18832
18842
|
sourceLocation: decorator.sourceLocation,
|
|
@@ -18861,7 +18871,7 @@ class ContractMethodVisitor extends ContractMethodBaseVisitor {
|
|
|
18861
18871
|
return null;
|
|
18862
18872
|
}
|
|
18863
18873
|
validateDecoratorRoutingData(functionType, decorator, impliedByConvention) {
|
|
18864
|
-
if (!decorator || !impliedByConvention || decorator.type ===
|
|
18874
|
+
if (!decorator || !impliedByConvention || decorator.type === Constants.symbolNames.readonlyDecoratorName)
|
|
18865
18875
|
return;
|
|
18866
18876
|
if (decorator.allowedCompletionTypes !== undefined &&
|
|
18867
18877
|
impliedByConvention.allowedCompletionTypes !== undefined &&
|
|
@@ -18971,7 +18981,7 @@ class ConstructorVisitor extends ContractMethodBaseVisitor {
|
|
|
18971
18981
|
const statement = this.accept(s);
|
|
18972
18982
|
if (isSuperCall(s)) {
|
|
18973
18983
|
// Property initializer statements should be injected immediately after the super() call
|
|
18974
|
-
codeInvariant(!this._foundSuperCall, 'A constructor can only contain one call to super()');
|
|
18984
|
+
codeInvariant(!this._foundSuperCall, 'A constructor can only contain one call to super()', this.sourceLocation(s));
|
|
18975
18985
|
this._foundSuperCall = true;
|
|
18976
18986
|
return nodeFactory.block({
|
|
18977
18987
|
sourceLocation: this.sourceLocation(s),
|
|
@@ -19114,7 +19124,7 @@ class ContractVisitor extends ClassDefinitionVisitor {
|
|
|
19114
19124
|
const sourceLocation = this.sourceLocation(node);
|
|
19115
19125
|
codeInvariant(!node.questionToken, 'Optional properties are not supported', sourceLocation);
|
|
19116
19126
|
codeInvariant(!node.exclamationToken, 'Non-null assertion operators on properties are not supported', sourceLocation);
|
|
19117
|
-
codeInvariant(!node.modifiers?.some((m) => m.kind === ts.SyntaxKind.StaticKeyword), 'Static properties are not supported');
|
|
19127
|
+
codeInvariant(!node.modifiers?.some((m) => m.kind === ts.SyntaxKind.StaticKeyword), 'Static properties are not supported', sourceLocation);
|
|
19118
19128
|
const propertyName = this.textVisitor.accept(node.name);
|
|
19119
19129
|
codeInvariant(node.initializer, 'Properties must have an initializer', sourceLocation);
|
|
19120
19130
|
if (node.type) {
|
|
@@ -19348,7 +19358,7 @@ class SourceFileVisitor extends BaseVisitor {
|
|
|
19348
19358
|
return [];
|
|
19349
19359
|
}
|
|
19350
19360
|
const maybeConst = requireInstanceBuilder(initializerBuilder);
|
|
19351
|
-
codeInvariant(maybeConst.isConstant || maybeConst.isConstantOp, 'Module level assignments must be compile time constants');
|
|
19361
|
+
codeInvariant(maybeConst.isConstant || maybeConst.isConstantOp, 'Module level assignments must be compile time constants', sourceLocation);
|
|
19352
19362
|
this.context.addConstant(dec.name, maybeConst);
|
|
19353
19363
|
return [];
|
|
19354
19364
|
});
|
|
@@ -23520,5 +23530,5 @@ class PuyaOptions {
|
|
|
23520
23530
|
}
|
|
23521
23531
|
}
|
|
23522
23532
|
|
|
23523
|
-
export {
|
|
23524
|
-
//# sourceMappingURL=options-
|
|
23533
|
+
export { parseCliTemplateVar as $, ARC4ArrayType as A, ByteClass as B, ContractProxyGeneric as C, DynamicArrayGeneric as D, abiCallFunction as E, arc4AddressAlias as F, arc4BooleanType as G, arc4ByteAlias as H, arc4StringType as I, arc4StructBaseType as J, compileArc4Function as K, convertBytesFunction as L, decodeArc4Function as M, encodeArc4Function as N, methodSelectorFunction as O, sizeOfFunction as P, uint8ArrayToHex as Q, hexToUint8Array as R, StaticArrayGeneric as S, TypedApplicationCallResponseGeneric as T, UFixedNxMGeneric as U, CompileOptions as V, TypeResolver as W, processInputPaths as X, registerPTypes as Y, typeRegistry as Z, defaultPuyaOptions as _, ARC4BoolClass as a, LocalsCoalescingStrategy as a0, PuyaService as a1, deserializeAndLog as a2, createTsProgram as a3, buildAwst as a4, validateAwst as a5, sleep as a6, DefaultMap as a7, relinquishThread as a8, ARC4EncodedType as b, ARC4InstanceType as c, ARC4StrClass as d, ARC4StructClass as e, ARC4StructType as f, ARC4TupleType as g, AddressClass as h, Arc4TupleGeneric as i, ContractProxyType as j, DynamicArrayType as k, DynamicBytesConstructor as l, DynamicBytesType as m, StaticArrayType as n, StaticBytesGeneric as o, StaticBytesType as p, TypedApplicationCallResponseType as q, UFixedNxMType as r, UintN128Class as s, UintN16Class as t, UintN256Class as u, UintN32Class as v, UintN64Class as w, UintN8Class as x, UintNGeneric as y, UintNType as z };
|
|
23534
|
+
//# sourceMappingURL=options-BCW57sPn.js.map
|