diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 000000000..9a54f6a90 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,11 @@ +node_modules/ +dist/ +coverage/ +**/output/ +./src/test/bugs/output/ +./src/test/features/output/ +src/func/funcfiftlib.js +src/grammar/grammar.ohm*.ts +src/grammar/grammar.ohm*.js +jest.setup.js +jest.teardown.js \ No newline at end of file diff --git a/.eslintrc.cjs b/.eslintrc.cjs new file mode 100644 index 000000000..d8e9d3e44 --- /dev/null +++ b/.eslintrc.cjs @@ -0,0 +1,26 @@ +/* eslint-env node */ +module.exports = { + extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'], + parser: '@typescript-eslint/parser', + plugins: ['@typescript-eslint'], + root: true, + env: { + node: true, + es2021: true, + }, + rules: { + '@typescript-eslint/no-unused-vars': [ + 'error', + { + "argsIgnorePattern": "^_", + "varsIgnorePattern": "^_", + "caughtErrorsIgnorePattern": "^_" + } + ], + "@typescript-eslint/no-var-requires": ['error', + { + allow: ['/package\\.json$'] + } + ], + }, +}; diff --git a/.github/workflows/tact.yml b/.github/workflows/tact.yml index 593d50b0e..916e1d61d 100644 --- a/.github/workflows/tact.yml +++ b/.github/workflows/tact.yml @@ -36,6 +36,10 @@ jobs: yarn gen yarn build yarn coverage + + - name: Check there are no errors reported by ESLint + run: | + yarn lint - name: Compare Tact version from CLI flag `--version` against package.json if: runner.os != 'Windows' diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ae2dc59e..a5939a92a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,10 +19,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - The equality and non-equality operators (`==` and `!=`) now support slices and strings by comparing the hashes of the left-hand and right-hand sides : PR [#105](https://github.com/tact-lang/tact/pull/105) - Continuous integration now tests the dev [tact-template](https://github.com/tact-lang/tact-template)'s version with the dev version of Tact: PR [#111](https://github.com/tact-lang/tact/pull/111) - Continuous integration now tests the latest [Blueprint](https://github.com/ton-org/blueprint)'s version with the dev version of Tact: PR [#152](https://github.com/tact-lang/tact/pull/152) +- Continuous integration now checks there are no ESLint warnings: PR [#157](https://github.com/tact-lang/tact/pull/157) ### Fixed - Relative imports from parent directories: PR [#125](https://github.com/tact-lang/tact/pull/125) - The typechecker failed to identify different types when using the `==` and `!=` operators: PR [#127](https://github.com/tact-lang/tact/pull/127) +- ESLint warnings for the whole Tact codebase: PR [#157](https://github.com/tact-lang/tact/pull/157) ## [1.1.5] - 2023-12-01 diff --git a/examples/increment.spec.ts b/examples/increment.spec.ts index 95747d9bb..466f92dd4 100644 --- a/examples/increment.spec.ts +++ b/examples/increment.spec.ts @@ -6,10 +6,10 @@ describe('increment', () => { it('should deploy', async () => { // Create wallet - let system = await ContractSystem.create(); - let treasure = system.treasure('treasure'); - let contract = system.open(await IncrementContract.fromInit()); - let tracker = system.track(contract.address); + const system = await ContractSystem.create(); + const treasure = system.treasure('treasure'); + const contract = system.open(await IncrementContract.fromInit()); + const tracker = system.track(contract.address); await contract.send(treasure, { value: toNano('10') }, { $$type: 'Deploy', queryId: 0n }); await system.run(); expect(tracker.collect()).toMatchSnapshot(); @@ -18,18 +18,5 @@ describe('increment', () => { await contract.send(treasure, { value: toNano('10') }, { $$type: 'Increment', key: 0n, value: -1232n }); await system.run(); expect(tracker.collect()).toMatchSnapshot(); - - // Get counters - let counters = await contract.getCounters(); - let counters2 = await contract.getCounters2(); - - // let res = await executor.get('counters'); - // let dict = parseDict(res.stack.readCell().beginParse(), 257, (sc) => sc.readInt(257).toString(10)); - // // console.warn(dict); - - // let res2 = await executor.get('counters2'); - // let dict2 = parseDict(res2.stack.readCell().beginParse(), 267, (sc) => sc.readInt(257).toString(10)); - // // console.warn(dict2); - // // new BN(Array.from(dict.keys())[0]).toString('hex'); }); }); \ No newline at end of file diff --git a/examples/multisig-3.spec.ts b/examples/multisig-3.spec.ts index 911660e83..91b0dbfec 100644 --- a/examples/multisig-3.spec.ts +++ b/examples/multisig-3.spec.ts @@ -6,13 +6,13 @@ describe('muiltisig-3', () => { it('should deploy', async () => { // Init contract - let key1 = 1n; - let key2 = 1n; - let key3 = 1n; - let system = await ContractSystem.create(); - let treasure = system.treasure('treasure'); - let contract = system.open(await MultisigContract.fromInit(key1, key2, key3)); - let tracker = system.track(contract.address); + const key1 = 1n; + const key2 = 1n; + const key3 = 1n; + const system = await ContractSystem.create(); + const treasure = system.treasure('treasure'); + const contract = system.open(await MultisigContract.fromInit(key1, key2, key3)); + const tracker = system.track(contract.address); await contract.send(treasure, { value: toNano('10') }, 'Deploy'); await system.run(); expect(tracker.collect()).toMatchSnapshot(); diff --git a/examples/wallet.spec.ts b/examples/wallet.spec.ts index e318a2129..f6a3c5e40 100644 --- a/examples/wallet.spec.ts +++ b/examples/wallet.spec.ts @@ -7,12 +7,12 @@ describe('wallet', () => { it('should deploy', async () => { // Create wallet - let key = testKey('wallet-key'); - let publicKey = beginCell().storeBuffer(key.publicKey).endCell().beginParse().loadUintBig(256); - let system = await ContractSystem.create(); - let treasure = system.treasure('treasure'); - let contract = system.open(await Wallet.fromInit(publicKey, 0n)); - let tracker = system.track(contract.address); + const key = testKey('wallet-key'); + const publicKey = beginCell().storeBuffer(key.publicKey).endCell().beginParse().loadUintBig(256); + const system = await ContractSystem.create(); + const treasure = system.treasure('treasure'); + const contract = system.open(await Wallet.fromInit(publicKey, 0n)); + const tracker = system.track(contract.address); await contract.send(treasure, { value: toNano('10') }, 'Deploy'); await system.run(); @@ -22,7 +22,7 @@ describe('wallet', () => { expect(await contract.getSeqno()).toBe(0n); // Send transfer and check seqno - let transfer: Transfer = { + const transfer: Transfer = { $$type: 'Transfer', seqno: 0n, mode: 1n, @@ -30,7 +30,7 @@ describe('wallet', () => { to: treasure.address, body: null }; - let signature = sign(beginCell().store(storeTransfer(transfer)).endCell().hash(), key.secretKey); + const signature = sign(beginCell().store(storeTransfer(transfer)).endCell().hash(), key.secretKey); await contract.send(treasure, { value: toNano(1) }, { $$type: 'TransferMessage', transfer, diff --git a/jest.setup.js b/jest.setup.js index 7541dd365..f9f704d67 100644 --- a/jest.setup.js +++ b/jest.setup.js @@ -1,3 +1,4 @@ +// eslint-disable-next-line @typescript-eslint/no-var-requires const coverage = require('@tact-lang/coverage'); module.exports = async () => { diff --git a/package.json b/package.json index 956a0ba73..b3aaece39 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,8 @@ "build": "tsc && cp ./src/grammar/grammar.ohm* ./dist/grammar/ && cp ./src/func/funcfiftlib.* ./dist/func", "test": "jest", "coverage": "cross-env COVERAGE=true jest", - "release": "yarn clean && yarn build && yarn coverage && yarn release-it --npm.yarn1" + "release": "yarn clean && yarn build && yarn coverage && yarn release-it --npm.yarn1", + "lint": "yarn eslint ." }, "files": [ "dist/**/*", @@ -30,6 +31,8 @@ "dependencies": { "@ipld/dag-pb": "2.1.18", "@tact-lang/opcode": "^0.0.14", + "@ton/core": "0.49.2", + "@ton/crypto": "^3.2.0", "arg": "^5.0.2", "blockstore-core": "1.0.5", "change-case": "^4.1.2", @@ -40,8 +43,6 @@ "path-normalize": "^6.0.10", "prando": "^6.0.1", "qs": "^6.11.0", - "@ton/core": "0.49.2", - "@ton/crypto": "^3.2.0", "zod": "^3.20.2" }, "devDependencies": { @@ -49,12 +50,17 @@ "@release-it/keep-a-changelog": "^3.1.0", "@tact-lang/coverage": "^0.0.8", "@tact-lang/emulator": "^4.2.3", + "@tact-lang/ton-abi": "^0.0.3", + "@tact-lang/ton-jest": "^0.0.4", "@types/glob": "^8.1.0", "@types/jest": "^29.2.3", "@types/js-yaml": "^4.0.5", "@types/node": "^18.11.9", "@types/qs": "^6.9.7", + "@typescript-eslint/eslint-plugin": "^7.0.2", + "@typescript-eslint/parser": "^7.0.2", "cross-env": "^7.0.3", + "eslint": "^8.56.0", "glob": "^8.1.0", "jest": "^29.3.1", "js-yaml": "^4.1.0", @@ -63,11 +69,9 @@ "rollup": "^3.17.2", "shiki": "^0.12.1", "ton-compiler": "^2.3.0", - "@tact-lang/ton-jest": "^0.0.4", "ts-jest": "^29.0.3", "ts-node": "^10.9.1", - "typescript": "^4.9.3", - "@tact-lang/ton-abi": "^0.0.3" + "typescript": "^4.9.3" }, "publishConfig": { "access": "public", diff --git a/scripts/grammar.ts b/scripts/grammar.ts index bd3a30bc1..a167ffa54 100644 --- a/scripts/grammar.ts +++ b/scripts/grammar.ts @@ -1,4 +1,4 @@ -import { getHighlighter, BUNDLED_LANGUAGES, BUNDLED_THEMES } from 'shiki'; +import { getHighlighter, BUNDLED_LANGUAGES, BUNDLED_THEMES, ILanguageRegistration } from 'shiki'; import fs from 'fs'; import yaml from 'js-yaml'; import path from 'path'; @@ -6,13 +6,13 @@ import path from 'path'; (async () => { // Patch grammar bundler - let grammarBundlePath = path.resolve(__dirname, '..', 'src', 'grammar', 'grammar.ohm-bundle.js'); + const grammarBundlePath = path.resolve(__dirname, '..', 'src', 'grammar', 'grammar.ohm-bundle.js'); let src = fs.readFileSync(grammarBundlePath, 'utf-8'); src = src.replace(`require('ohm-js')`, `(require('ohm-js').default || require('ohm-js'))`); fs.writeFileSync(grammarBundlePath, src, 'utf-8'); // Load textmate grammar - let sourceGrammar = fs.readFileSync(require.resolve('../grammar/tact.tmLanguage.yaml'), 'utf-8'); + const sourceGrammar = fs.readFileSync(require.resolve('../grammar/tact.tmLanguage.yaml'), 'utf-8'); let loadedGrammar = yaml.load(sourceGrammar); // Process grammar @@ -23,6 +23,7 @@ import path from 'path'; } return result; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any function transformGrammarRule(rule: any, propertyNames: string[], transformProperty: (ruleProperty: string) => string) { for (const propertyName of propertyNames) { const value = rule[propertyName]; @@ -31,22 +32,24 @@ import path from 'path'; } } - for (var propertyName in rule) { + for (const propertyName in rule) { const value = rule[propertyName]; if (typeof value === 'object') { transformGrammarRule(value, propertyNames, transformProperty); } } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any function transformGrammarRepository(grammar: any, propertyNames: string[], transformProperty: (ruleProperty: string) => string) { const repository = grammar.repository; - for (let key in repository) { + for (const key in repository) { transformGrammarRule(repository[key], propertyNames, transformProperty); } } type VariableReplacer = [RegExp, string]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any function processGrammar(src: any) { - let variables = src.variables; + const variables = src.variables; delete src.variables; const variableReplacers: VariableReplacer[] = []; for (const variableName in variables) { @@ -68,11 +71,11 @@ import path from 'path'; // Generate sample highlight const grammarTact = JSON.parse(fs.readFileSync(require.resolve('../grammar/tact.tmLanguage.json'), 'utf-8')); - for (let f of fs.readdirSync(path.resolve(__dirname, '..', 'grammar'))) { + for (const f of fs.readdirSync(path.resolve(__dirname, '..', 'grammar'))) { if (f.endsWith('.tact')) { - let name = f.substring(0, f.length - '.tact'.length); + const name = f.substring(0, f.length - '.tact'.length); const grammarSample = fs.readFileSync(path.resolve(__dirname, '..', 'grammar', name + '.tact'), 'utf-8'); - let highlighter = await getHighlighter({ + const highlighter = await getHighlighter({ themes: BUNDLED_THEMES, langs: [ ...BUNDLED_LANGUAGES, @@ -82,16 +85,16 @@ import path from 'path'; grammar: grammarTact, aliases: ['tact'], } - ] as any, + ] as ILanguageRegistration[], }); - let theme = 'dark-plus'; // Most features + const theme = 'dark-plus'; // Most features let res = highlighter.codeToHtml(grammarSample, { lang: 'tact', theme }); res = `${res}`; fs.writeFileSync(path.resolve(__dirname, '..', 'grammar', name + '.html'), res); - let tokens = highlighter.codeToThemedTokens(grammarSample, 'tact', theme); + const tokens = highlighter.codeToThemedTokens(grammarSample, 'tact', theme); fs.writeFileSync(path.resolve(__dirname, '..', 'grammar', name + '.json'), JSON.stringify(tokens, null, 2)); } } diff --git a/scripts/pack.ts b/scripts/pack.ts index 634e4435e..496aeac72 100644 --- a/scripts/pack.ts +++ b/scripts/pack.ts @@ -4,18 +4,18 @@ import glob from 'glob'; import { posixNormalize } from '../src/utils/filePath'; // Pack func -let wasmBase64 = fs.readFileSync(path.resolve(__dirname, '..', 'src', 'func', 'funcfiftlib.wasm')).toString('base64'); -let wasmBase64js = `module.exports = { FuncFiftLibWasm: '${wasmBase64}' };`; +const wasmBase64 = fs.readFileSync(path.resolve(__dirname, '..', 'src', 'func', 'funcfiftlib.wasm')).toString('base64'); +const wasmBase64js = `module.exports = { FuncFiftLibWasm: '${wasmBase64}' };`; fs.writeFileSync(path.resolve(__dirname, '..', 'src', 'func', 'funcfiftlib.wasm.js'), wasmBase64js); // Pack stdlib -let stdlibFiles = glob.sync(path.resolve(__dirname, '..', 'stdlib', '**', '*.@(tact|fc)'), {windowsPathsNoEscape: true}); +const stdlibFiles = glob.sync(path.resolve(__dirname, '..', 'stdlib', '**', '*.@(tact|fc)'), {windowsPathsNoEscape: true}); const dirPrefixToRemove = posixNormalize(path.resolve(__dirname, '..', 'stdlib')) + '/'; // Remove also the leading slash let output: string = ''; -output = 'let files: { [key: string]: string } = {};\n'; -for (let f of stdlibFiles) { +output = 'const files: { [key: string]: string } = {};\n'; +for (const f of stdlibFiles) { let code = fs.readFileSync(f).toString('base64'); - let name = f.replace(dirPrefixToRemove, ''); + const name = f.replace(dirPrefixToRemove, ''); output += `files['${name}'] =\n`; let first = true; while (code.length > 0) { diff --git a/scripts/prepare.ts b/scripts/prepare.ts index 537943c06..f7b8999ff 100644 --- a/scripts/prepare.ts +++ b/scripts/prepare.ts @@ -1,7 +1,6 @@ import fs from 'fs'; import { decompileAll } from '@tact-lang/opcode'; import { run } from '../src/node'; -import { Cell } from '@ton/core'; import { build } from '../src/pipeline/build'; import { FuncCompilationResult, funcCompile } from '../src/func/funcCompile'; import path from 'path'; @@ -25,8 +24,8 @@ import { __DANGER__disableVersionNumber } from '../src/pipeline/version'; } // Verify projects - for (let pkgPath of glob.sync(path.normalize(path.resolve(__dirname, '..', 'examples', 'output', '*.pkg')))) { - let res = await verify({ pkg: fs.readFileSync(pkgPath, 'utf-8') }); + for (const pkgPath of glob.sync(path.normalize(path.resolve(__dirname, '..', 'examples', 'output', '*.pkg')))) { + const res = await verify({ pkg: fs.readFileSync(pkgPath, 'utf-8') }); if (!res.ok) { console.error('Failed to verify ' + pkgPath + ': ' + res.error); process.exit(1); @@ -34,20 +33,20 @@ import { __DANGER__disableVersionNumber } from '../src/pipeline/version'; } // Compile test contracts - for (let p of [{ path: path.resolve(__dirname, '..', 'src', 'test', 'contracts') }]) { - let recs = fs.readdirSync(p.path); - for (let r of recs) { + for (const p of [{ path: path.resolve(__dirname, '..', 'src', 'test', 'contracts') }]) { + const recs = fs.readdirSync(p.path); + for (const r of recs) { if (!r.endsWith('.tact')) { continue; } - let config: ConfigProject = { + const config: ConfigProject = { name: r.slice(0, r.length - '.tact'.length), path: './' + r, output: './output/', }; - let stdlib = '@stdlib'; - let project = createNodeFileSystem(p.path, false); + const stdlib = '@stdlib'; + const project = createNodeFileSystem(p.path, false); await build({ config, stdlib, @@ -57,9 +56,9 @@ import { __DANGER__disableVersionNumber } from '../src/pipeline/version'; } // Compile func files - for (let p of [{ path: __dirname + "/../func/" }]) { - let recs = fs.readdirSync(p.path); - for (let r of recs) { + for (const p of [{ path: __dirname + "/../func/" }]) { + const recs = fs.readdirSync(p.path); + for (const r of recs) { if (!r.endsWith('.fc')) { continue; } @@ -68,9 +67,9 @@ import { __DANGER__disableVersionNumber } from '../src/pipeline/version'; console.log('Processing ' + p.path + r); let c: FuncCompilationResult; try { - let stdlibPath = path.resolve(__dirname, '..', 'stdlib', 'stdlib.fc'); - let stdlib = fs.readFileSync(stdlibPath, 'utf-8'); - let code = fs.readFileSync(p.path + r, 'utf-8'); + const stdlibPath = path.resolve(__dirname, '..', 'stdlib', 'stdlib.fc'); + const stdlib = fs.readFileSync(stdlibPath, 'utf-8'); + const code = fs.readFileSync(p.path + r, 'utf-8'); c = await funcCompile({ entries: [ stdlibPath, @@ -98,7 +97,7 @@ import { __DANGER__disableVersionNumber } from '../src/pipeline/version'; fs.writeFileSync(p.path + r + ".cell", c.output!); // Cell -> Fift decompiler - let source = decompileAll({ src: c.output! }); + const source = decompileAll({ src: c.output! }); fs.writeFileSync(p.path + r + ".rev.fift", source); } } diff --git a/src/abi/global.ts b/src/abi/global.ts index f9a9d5699..b5cd7d3d5 100644 --- a/src/abi/global.ts +++ b/src/abi/global.ts @@ -1,5 +1,5 @@ import { Address, Cell, toNano } from "@ton/core"; -import { enabledDebug, enabledMaterchain } from "../config/features"; +import { enabledDebug, enabledMasterchain } from "../config/features"; import { writeAddress, writeCell } from "../generator/writers/writeConstant"; import { writeExpression } from "../generator/writers/writeExpression"; import { throwError } from "../grammar/ast"; @@ -7,8 +7,6 @@ import { resolveConstantValue } from "../types/resolveConstantValue"; import { getErrorId } from "../types/resolveErrors"; import { AbiFunction } from "./AbiFunction"; import { sha256_sync } from "@ton/crypto"; -import { getType } from "../types/resolveDescriptors"; -import { ops } from "../generator/writers/ops"; export const GlobalFunctions: { [key: string]: AbiFunction } = { ton: { @@ -29,7 +27,7 @@ export const GlobalFunctions: { [key: string]: AbiFunction } = { if (resolved.length !== 1) { throwError('ton() expects single string argument', ref); } - let str = resolveConstantValue({ kind: 'ref', name: 'String', optional: false }, resolved[0], ctx.ctx) as string; + const str = resolveConstantValue({ kind: 'ref', name: 'String', optional: false }, resolved[0], ctx.ctx) as string; return toNano(str).toString(10); } }, @@ -57,8 +55,8 @@ export const GlobalFunctions: { [key: string]: AbiFunction } = { if (resolved.length !== 2) { throwError('pow() expects two integer arguments', ref); } - let a = resolveConstantValue({ kind: 'ref', name: 'Int', optional: false }, resolved[0], ctx.ctx) as bigint; - let b = resolveConstantValue({ kind: 'ref', name: 'Int', optional: false }, resolved[1], ctx.ctx) as bigint; + const a = resolveConstantValue({ kind: 'ref', name: 'Int', optional: false }, resolved[0], ctx.ctx) as bigint; + const b = resolveConstantValue({ kind: 'ref', name: 'Int', optional: false }, resolved[1], ctx.ctx) as bigint; return (a ** b).toString(10); } }, @@ -86,7 +84,7 @@ export const GlobalFunctions: { [key: string]: AbiFunction } = { if (resolved.length !== 2) { throwError('require() expects two arguments', ref); } - let str = resolveConstantValue({ kind: 'ref', name: 'String', optional: false }, resolved[1], ctx.ctx) as string; + const str = resolveConstantValue({ kind: 'ref', name: 'String', optional: false }, resolved[1], ctx.ctx) as string; return `throw_unless(${getErrorId(str, ctx.ctx)}, ${writeExpression(resolved[0], ctx)})`; } }, @@ -108,19 +106,19 @@ export const GlobalFunctions: { [key: string]: AbiFunction } = { if (resolved.length !== 1) { throwError('address() expects one argument', ref); } - let str = resolveConstantValue({ kind: 'ref', name: 'String', optional: false }, resolved[0], ctx.ctx) as string; - let address = Address.parse(str); + const str = resolveConstantValue({ kind: 'ref', name: 'String', optional: false }, resolved[0], ctx.ctx) as string; + const address = Address.parse(str); if (address.workChain !== 0 && address.workChain !== -1) { throwError(`Address ${str} invalid address`, ref); } - if (!enabledMaterchain(ctx.ctx)) { + if (!enabledMasterchain(ctx.ctx)) { if (address.workChain !== 0) { throwError(`Address ${str} from masterchain are not enabled for this contract`, ref); } } // Generate address - let res = writeAddress(address, ctx); + const res = writeAddress(address, ctx); ctx.used(res); return res + '()'; } @@ -145,7 +143,7 @@ export const GlobalFunctions: { [key: string]: AbiFunction } = { } // Load cell data - let str = resolveConstantValue({ kind: 'ref', name: 'String', optional: false }, resolved[0], ctx.ctx) as string; + const str = resolveConstantValue({ kind: 'ref', name: 'String', optional: false }, resolved[0], ctx.ctx) as string; let c: Cell; try { c = Cell.fromBase64(str); @@ -154,7 +152,7 @@ export const GlobalFunctions: { [key: string]: AbiFunction } = { } // Generate address - let res = writeCell(c, ctx); + const res = writeCell(c, ctx); ctx.used(res); return `${res}()`; } @@ -171,9 +169,9 @@ export const GlobalFunctions: { [key: string]: AbiFunction } = { if (!enabledDebug(ctx.ctx)) { return `${ctx.used('__tact_nop')}()`; } - let arg = args[0]; + const arg = args[0]; if (arg.kind === 'map') { - let exp = writeExpression(resolved[0], ctx); + const exp = writeExpression(resolved[0], ctx); return `${ctx.used(`__tact_debug`)}(${exp})`; } else if (arg.kind === 'null') { return `${ctx.used(`__tact_debug_str`)}("null")`; @@ -181,13 +179,13 @@ export const GlobalFunctions: { [key: string]: AbiFunction } = { return `${ctx.used(`__tact_debug_str`)}("void")`; } else if (arg.kind === 'ref') { if (arg.name === 'Int' || arg.name === 'Builder' || arg.name === 'Slice' || arg.name === 'Cell' || arg.name === 'StringBuilder') { - let exp = writeExpression(resolved[0], ctx); + const exp = writeExpression(resolved[0], ctx); return `${ctx.used(`__tact_debug_str`)}(${ctx.used(`__tact_int_to_string`)}(${exp}))`; } else if (arg.name === 'Bool') { - let exp = writeExpression(resolved[0], ctx); + const exp = writeExpression(resolved[0], ctx); return `${ctx.used(`__tact_debug_bool`)}(${exp})`; } else if (arg.name === 'String') { - let exp = writeExpression(resolved[0], ctx); + const exp = writeExpression(resolved[0], ctx); return `${ctx.used(`__tact_debug_str`)}(${exp})`; } throwError('dump() not supported for type: ' + arg.name, ref); @@ -204,7 +202,7 @@ export const GlobalFunctions: { [key: string]: AbiFunction } = { } return { kind: 'null' }; }, - generate: (ctx, args, resolved, ref) => { + generate: (_ctx, _args, _resolved, _ref) => { return 'null()'; } }, @@ -233,7 +231,7 @@ export const GlobalFunctions: { [key: string]: AbiFunction } = { // String case if (args[0].name === 'String') { try { - let str = resolveConstantValue({ kind: 'ref', name: 'String', optional: false }, resolved[0], ctx.ctx) as string; + const str = resolveConstantValue({ kind: 'ref', name: 'String', optional: false }, resolved[0], ctx.ctx) as string; if (Buffer.from(str).length > 128) { throwError('sha256 expects string argument with byte length <= 128', ref); } @@ -241,13 +239,13 @@ export const GlobalFunctions: { [key: string]: AbiFunction } = { } catch (e) { // Not a constant } - let exp = writeExpression(resolved[0], ctx); + const exp = writeExpression(resolved[0], ctx); return `string_hash(${exp})`; } // Slice case if (args[0].name === 'Slice') { - let exp = writeExpression(resolved[0], ctx); + const exp = writeExpression(resolved[0], ctx); return `string_hash(${exp})`; } diff --git a/src/abi/map.ts b/src/abi/map.ts index 1d4932660..7e72d1516 100644 --- a/src/abi/map.ts +++ b/src/abi/map.ts @@ -13,7 +13,7 @@ export const MapFunctions: { [key: string]: AbiFunction } = { if (args.length !== 3) { throwError('set expects two arguments', ref); // Should not happen } - let self = args[0]; + const self = args[0]; if (!self || self.kind !== 'map') { throwError('set expects a map as self argument', ref); // Should not happen } @@ -48,13 +48,13 @@ export const MapFunctions: { [key: string]: AbiFunction } = { if (args.length !== 3) { throwError('set expects two arguments', ref); // Ignore self argument } - let self = args[0]; + const self = args[0]; if (!self || self.kind !== 'map') { throwError('set expects a map as self argument', ref); // Should not happen } // Render expressions - let resolved = exprs.map((v) => writeExpression(v, ctx)); + const resolved = exprs.map((v) => writeExpression(v, ctx)); // Handle Int key if (self.key === 'Int') { @@ -87,7 +87,7 @@ export const MapFunctions: { [key: string]: AbiFunction } = { ctx.used(`__tact_dict_set_${kind}_slice`); return `${resolved[0]}~__tact_dict_set_${kind}_slice(${bits}, ${resolved[1]}, ${resolved[2]})`; } else { - let t = getType(ctx.ctx, self.value); + const t = getType(ctx.ctx, self.value); if (t.kind === 'contract') { throwError(`Contract can't be value of a map`, ref); } @@ -130,7 +130,7 @@ export const MapFunctions: { [key: string]: AbiFunction } = { ctx.used(`__tact_dict_set_slice_slice`); return `${resolved[0]}~__tact_dict_set_slice_slice(267, ${resolved[1]}, ${resolved[2]})`; } else { - let t = getType(ctx.ctx, self.value); + const t = getType(ctx.ctx, self.value); if (t.kind === 'contract') { throwError(`Contract can't be value of a map`, ref); } @@ -161,7 +161,7 @@ export const MapFunctions: { [key: string]: AbiFunction } = { if (args.length !== 2) { throwError('set expects one argument', ref); // Ignore self argument } - let self = args[0]; + const self = args[0]; if (!self || self.kind !== 'map') { throwError('set expects a map as self argument', ref); // Should not happen } @@ -181,13 +181,13 @@ export const MapFunctions: { [key: string]: AbiFunction } = { if (args.length !== 2) { throwError('set expects one argument', ref); // Ignore self argument } - let self = args[0]; + const self = args[0]; if (!self || self.kind !== 'map') { throwError('set expects a map as self argument', ref); // Should not happen } // Render expressions - let resolved = exprs.map((v) => writeExpression(v, ctx)); + const resolved = exprs.map((v) => writeExpression(v, ctx)); // Handle Int key if (self.key === 'Int') { @@ -220,7 +220,7 @@ export const MapFunctions: { [key: string]: AbiFunction } = { ctx.used(`__tact_dict_get_${kind}_slice`); return `__tact_dict_get_${kind}_slice(${resolved[0]}, ${bits}, ${resolved[1]})`; } else { - let t = getType(ctx.ctx, self.value); + const t = getType(ctx.ctx, self.value); if (t.kind === 'contract') { throwError(`Contract can't be value of a map`, ref); } @@ -259,7 +259,7 @@ export const MapFunctions: { [key: string]: AbiFunction } = { ctx.used(`__tact_dict_get_slice_slice`); return `__tact_dict_get_slice_slice(${resolved[0]}, 267, ${resolved[1]})`; } else { - let t = getType(ctx.ctx, self.value); + const t = getType(ctx.ctx, self.value); if (t.kind === 'contract') { throwError(`Contract can't be value of a map`, ref); } @@ -286,7 +286,7 @@ export const MapFunctions: { [key: string]: AbiFunction } = { if (args.length !== 1) { throwError('asCell expects one argument', ref); // Ignore self argument } - let self = args[0]; + const self = args[0]; if (!self || self.kind !== 'map') { throwError('asCell expects a map as self argument', ref); // Should not happen } @@ -297,7 +297,7 @@ export const MapFunctions: { [key: string]: AbiFunction } = { if (args.length !== 1) { throwError('asCell expects one argument', ref); // Ignore self argument } - let self = args[0]; + const self = args[0]; if (!self || self.kind !== 'map') { throwError('asCell expects a map as self argument', ref); // Should not happen } diff --git a/src/abi/struct.ts b/src/abi/struct.ts index 21fc85392..5d2fc7a90 100644 --- a/src/abi/struct.ts +++ b/src/abi/struct.ts @@ -14,7 +14,7 @@ export const StructFunctions: { [key: string]: AbiFunction } = { if (args[0].kind !== 'ref') { throwError('toCell() is implemented only a struct type', ref); } - let tp = getType(ctx, args[0].name); + const tp = getType(ctx, args[0].name); if (tp.kind !== 'struct') { throwError('toCell() is implemented only a struct type', ref); } diff --git a/src/benchmarks/benchmarks.spec.ts b/src/benchmarks/benchmarks.spec.ts index 5f20f53fa..8ed7533e1 100644 --- a/src/benchmarks/benchmarks.spec.ts +++ b/src/benchmarks/benchmarks.spec.ts @@ -7,30 +7,30 @@ describe('benchmarks', () => { it('benchmark functions', async () => { // Launch emulator - let system = await ContractSystem.create(); - let treasure = system.treasure('benchmarks'); - let functions = system.open(await Functions.fromInit()); - let tracker = system.track(functions.address); + const system = await ContractSystem.create(); + const treasure = system.treasure('benchmarks'); + const functions = system.open(await Functions.fromInit()); + const tracker = system.track(functions.address); await functions.send(treasure, { value: toNano(1) }, { $$type: 'Add', value: 10n }); await system.run(); // Find gas used - let gasUsed = tracker.collect().reduce((a, v) => a + v.events.reduce((c, d) => d.$type === 'processed' ? c + d.gasUsed : c, 0n), 0n); + const gasUsed = tracker.collect().reduce((a, v) => a + v.events.reduce((c, d) => d.$type === 'processed' ? c + d.gasUsed : c, 0n), 0n); expect(gasUsed).toMatchInlineSnapshot(`3648n`); expect(functions.init!.code.toBoc().length).toMatchInlineSnapshot(`429`); }); it('benchmark functions(inline)', async () => { // Launch emulator - let system = await ContractSystem.create(); - let treasure = system.treasure('benchmarks'); - let functions = system.open(await FunctionsInline.fromInit()); - let tracker = system.track(functions.address); + const system = await ContractSystem.create(); + const treasure = system.treasure('benchmarks'); + const functions = system.open(await FunctionsInline.fromInit()); + const tracker = system.track(functions.address); await functions.send(treasure, { value: toNano(1) }, { $$type: 'Add', value: 10n }); await system.run(); // Find gas used - let gasUsed = tracker.collect().reduce((a, v) => a + v.events.reduce((c, d) => d.$type === 'processed' ? c + d.gasUsed : c, 0n), 0n); + const gasUsed = tracker.collect().reduce((a, v) => a + v.events.reduce((c, d) => d.$type === 'processed' ? c + d.gasUsed : c, 0n), 0n); expect(gasUsed).toMatchInlineSnapshot(`3517n`); expect(functions.init!.code.toBoc().length).toMatchInlineSnapshot(`422`); }); diff --git a/src/bindings/typescript/serializers.ts b/src/bindings/typescript/serializers.ts index f40e6f415..b82979701 100644 --- a/src/bindings/typescript/serializers.ts +++ b/src/bindings/typescript/serializers.ts @@ -16,7 +16,7 @@ export type Serializer = { abiMatcher: (src: ABITypeRef) => T | null, }; -let intSerializer: Serializer<{ bits: number, optional: boolean }> = { +const intSerializer: Serializer<{ bits: number, optional: boolean }> = { tsType(v) { if (v.optional) { return 'bigint | null'; @@ -62,7 +62,7 @@ let intSerializer: Serializer<{ bits: number, optional: boolean }> = { } }; -let uintSerializer: Serializer<{ bits: number, optional: boolean }> = { +const uintSerializer: Serializer<{ bits: number, optional: boolean }> = { tsType(v) { if (v.optional) { return 'bigint | null'; @@ -108,7 +108,7 @@ let uintSerializer: Serializer<{ bits: number, optional: boolean }> = { } }; -let coinsSerializer: Serializer<{ optional: boolean }> = { +const coinsSerializer: Serializer<{ optional: boolean }> = { tsType(v) { if (v.optional) { return 'bigint | null'; @@ -152,7 +152,7 @@ let coinsSerializer: Serializer<{ optional: boolean }> = { } }; -let boolSerializer: Serializer<{ optional: boolean }> = { +const boolSerializer: Serializer<{ optional: boolean }> = { tsType(v) { if (v.optional) { return 'boolean | null'; @@ -196,7 +196,7 @@ let boolSerializer: Serializer<{ optional: boolean }> = { } }; -let addressSerializer: Serializer<{ optional: boolean }> = { +const addressSerializer: Serializer<{ optional: boolean }> = { tsType(v) { if (v.optional) { return 'Address | null'; @@ -236,7 +236,7 @@ let addressSerializer: Serializer<{ optional: boolean }> = { } }; -let cellSerializer: Serializer<{ kind: 'cell' | 'slice' | 'builder', optional: boolean }> = { +const cellSerializer: Serializer<{ kind: 'cell' | 'slice' | 'builder', optional: boolean }> = { tsType(v) { if (v.optional) { return 'Cell | null'; @@ -286,8 +286,8 @@ let cellSerializer: Serializer<{ kind: 'cell' | 'slice' | 'builder', optional: b } } -let remainderSerializer: Serializer<{ kind: 'cell' | 'slice' | 'builder' }> = { - tsType(v) { +const remainderSerializer: Serializer<{ kind: 'cell' | 'slice' | 'builder' }> = { + tsType(_v) { return 'Cell'; }, tsLoad(v, slice, field, w) { @@ -320,7 +320,7 @@ let remainderSerializer: Serializer<{ kind: 'cell' | 'slice' | 'builder' }> = { } } -let fixedBytesSerializer: Serializer<{ bytes: number, optional: boolean }> = { +const fixedBytesSerializer: Serializer<{ bytes: number, optional: boolean }> = { tsType(v) { if (v.optional) { return 'Buffer | null'; @@ -364,7 +364,7 @@ let fixedBytesSerializer: Serializer<{ bytes: number, optional: boolean }> = { } }; -let stringSerializer: Serializer<{ optional: boolean }> = { +const stringSerializer: Serializer<{ optional: boolean }> = { tsType(v) { if (v.optional) { return 'string | null'; @@ -408,7 +408,7 @@ let stringSerializer: Serializer<{ optional: boolean }> = { } } -let guard: Serializer<{}> = { +const guard: Serializer = { abiMatcher(src) { if (src.kind === 'simple') { if (primitiveTypes.includes(src.type)) { @@ -417,24 +417,24 @@ let guard: Serializer<{}> = { } return null; }, - tsType(v) { + tsType(_v) { throw Error('Unreachable'); }, - tsLoad(v, slice, field, w) { + tsLoad(_v, _slice, _field, _w) { throw Error('Unreachable'); }, - tsLoadTuple(v, reader, field, w) { + tsLoadTuple(_v, _reader, _field, _w) { throw Error('Unreachable'); }, - tsStore(v, builder, field, w) { + tsStore(_v, _builder, _field, _w) { throw Error('Unreachable'); }, - tsStoreTuple(v, to, field, w) { + tsStoreTuple(_v, _to, _field, _w) { throw Error('Unreachable'); } } -let struct: Serializer<{ name: string, optional: boolean }> = { +const struct: Serializer<{ name: string, optional: boolean }> = { abiMatcher(src) { if (src.kind === 'simple') { if (src.format !== null && src.format !== undefined) { @@ -545,7 +545,7 @@ function getValueParser(src: MapSerializerDescrValue) { } } -let map: Serializer = { +const map: Serializer = { abiMatcher(src) { if (src.kind === 'dict') { if (src.format !== null && src.format !== undefined) { @@ -669,6 +669,7 @@ let map: Serializer = { }, } +// eslint-disable-next-line @typescript-eslint/no-explicit-any export const serializers: Serializer[] = [ // Primitive types @@ -682,7 +683,7 @@ export const serializers: Serializer[] = [ fixedBytesSerializer, stringSerializer, - // Guard to catch all primitve types that wasn't handled + // Guard to catch all primitive types that wasn't handled guard, // Structs as fallback diff --git a/src/bindings/typescript/writeStruct.ts b/src/bindings/typescript/writeStruct.ts index 0045e5f91..3b74f6d32 100644 --- a/src/bindings/typescript/writeStruct.ts +++ b/src/bindings/typescript/writeStruct.ts @@ -7,10 +7,10 @@ export function writeStruct(name: string, fields: { name: string, type: ABITypeR w.append(`${exp ? 'export ' : ' '}type ${name} = {`); w.inIndent(() => { w.append(`$$type: '${name}';`); - outer: for (let f of fields) { + outer: for (const f of fields) { - for (let s of serializers) { - let v = s.abiMatcher(f.type); + for (const s of serializers) { + const v = s.abiMatcher(f.type); if (v) { w.append(`${f.name}: ${s.tsType(v)};`); continue outer; @@ -31,28 +31,28 @@ export function writeParser(s: ABIType, allocation: AllocationCell, w: Writer) { if (s.header) { w.append(`if (sc_0.loadUint(32) !== ${s.header}) { throw Error('Invalid prefix'); }`); } - writeParserCell(0, 0, allocation, s, w); + writeParserCell(0, allocation, s, w); w.append(`return { ${[`$$type: '${s.name}' as const`, ...s.fields.map((v) => v.name + ': _' + v.name)].join(', ')} };`); }); w.append(`}`); w.append(); } -function writeParserCell(gen: number, offset: number, src: AllocationCell, s: ABIType, w: Writer) { - for (let f of src.ops) { - writeParserField(gen, offset++, s, w); +function writeParserCell(gen: number, src: AllocationCell, s: ABIType, w: Writer) { + for (const f of src.ops) { + writeParserField(gen, f, s, w); } if (src.next) { w.append(`let sc_${gen + 1} = sc_${gen}.loadRef().beginParse();`); - writeParserCell(gen + 1, offset, src.next, s, w); + writeParserCell(gen + 1, src.next, s, w); } } -function writeParserField(gen: number, offset: number, s: ABIType, w: Writer) { - let name = '_' + s.fields[offset].name; - let type = s.fields[offset].type; - for (let s of serializers) { - let v = s.abiMatcher(type); +function writeParserField(gen: number, field: AllocationOperation, s: ABIType, w: Writer) { + const name = '_' + field.name; + const type = field.type; + for (const s of serializers) { + const v = s.abiMatcher(type); if (v) { s.tsLoad(v, `sc_${gen}`, name, w); return; @@ -93,7 +93,7 @@ export function writeInitSerializer(name: string, allocation: AllocationCell, w: } function writeSerializerCell(gen: number, src: AllocationCell, w: Writer) { - for (let f of src.ops) { + for (const f of src.ops) { writeSerializerField(gen, f, w); } if (src.next) { @@ -104,10 +104,10 @@ function writeSerializerCell(gen: number, src: AllocationCell, w: Writer) { } function writeSerializerField(gen: number, s: AllocationOperation, w: Writer) { - let name = 'src.' + s.name; - let type = s.type; - for (let s of serializers) { - let v = s.abiMatcher(type); + const name = 'src.' + s.name; + const type = s.type; + for (const s of serializers) { + const v = s.abiMatcher(type); if (v) { s.tsStore(v, `b_${gen}`, name, w); return; @@ -119,7 +119,7 @@ function writeSerializerField(gen: number, s: AllocationOperation, w: Writer) { export function writeTupleParser(s: ABIType, w: Writer) { w.append(`function loadTuple${s.name}(source: TupleReader) {`); w.inIndent(() => { - for (let f of s.fields) { + for (const f of s.fields) { writeTupleFieldParser('_' + f.name, f.type, w); } w.append(`return { ${[`$$type: '${s.name}' as const`, ...s.fields.map((v) => v.name + ': _' + v.name)].join(', ')} };`); @@ -133,8 +133,8 @@ export function writeGetParser(name: string, type: ABITypeRef, w: Writer) { } function writeTupleFieldParser(name: string, type: ABITypeRef, w: Writer, fromGet = false) { - for (let s of serializers) { - let v = s.abiMatcher(type); + for (const s of serializers) { + const v = s.abiMatcher(type); if (v) { s.tsLoadTuple(v, `source`, name, w, fromGet); return; @@ -147,7 +147,7 @@ export function writeTupleSerializer(s: ABIType, w: Writer) { w.append(`function storeTuple${s.name}(source: ${s.name}) {`); w.inIndent(() => { w.append(`let builder = new TupleBuilder();`); - for (let f of s.fields) { + for (const f of s.fields) { writeVariableToStack(`source.${f.name}`, f.type, w); } w.append(`return builder.build();`); @@ -161,8 +161,8 @@ export function writeArgumentToStack(name: string, ref: ABITypeRef, w: Writer) { } function writeVariableToStack(name: string, type: ABITypeRef, w: Writer) { - for (let s of serializers) { - let v = s.abiMatcher(type); + for (const s of serializers) { + const v = s.abiMatcher(type); if (v) { s.tsStoreTuple(v, `builder`, name, w); return; diff --git a/src/bindings/writeTypescript.ts b/src/bindings/writeTypescript.ts index f4c281160..d4b56b74e 100644 --- a/src/bindings/writeTypescript.ts +++ b/src/bindings/writeTypescript.ts @@ -9,10 +9,10 @@ import { serializers } from './typescript/serializers'; function writeArguments(args: ABIArgument[]) { - let res: string[] = []; - outer: for (let f of args) { - for (let s of serializers) { - let v = s.abiMatcher(f.type); + const res: string[] = []; + outer: for (const f of args) { + for (const s of serializers) { + const v = s.abiMatcher(f.type); if (v) { res.push(`${f.name}: ${s.tsType(v)}`); continue outer; @@ -33,7 +33,7 @@ export function writeTypescript(abi: ContractABI, init?: { bits: number; } | undefined }) { - let w = new Writer(); + const w = new Writer(); w.write(` import { @@ -60,19 +60,19 @@ export function writeTypescript(abi: ContractABI, init?: { `); w.append(); - let allocations: { [key: string]: { size: { bits: number, refs: number }, root: AllocationCell } } = {}; + const allocations: { [key: string]: { size: { bits: number, refs: number }, root: AllocationCell } } = {}; // Structs if (abi.types) { // Allocations - let refs = (src: ABIType) => { - let res: ABIType[] = [] - let t = new Set(); - for (let f of src.fields) { + const refs = (src: ABIType) => { + const res: ABIType[] = [] + const t = new Set(); + for (const f of src.fields) { const r = f.type; if (r.kind === 'simple') { - let e = abi.types!.find((v) => v.name === r.type); + const e = abi.types!.find((v) => v.name === r.type); if (e) { if (!t.has(r.type)) { t.add(r.type); @@ -83,19 +83,19 @@ export function writeTypescript(abi: ContractABI, init?: { } return res; } - let sortedTypes = topologicalSort(abi.types, refs); - for (let f of sortedTypes) { - let ops = f.fields.map((v) => ({ + const sortedTypes = topologicalSort(abi.types, refs); + for (const f of sortedTypes) { + const ops = f.fields.map((v) => ({ name: v.name, type: v.type, op: getAllocationOperationFromField(v.type, (s) => allocations[s].size) })); - let headerBits = f.header ? 32 : 0; - let allocation = allocate({ reserved: { bits: headerBits, refs: 0 }, ops }); + const headerBits = f.header ? 32 : 0; + const allocation = allocate({ reserved: { bits: headerBits, refs: 0 }, ops }); allocations[f.name] = { size: { bits: allocation.size.bits + headerBits, refs: allocation.size.refs }, root: allocation }; } - for (let s of abi.types) { + for (const s of abi.types) { writeStruct(s.name, s.fields, true, w); writeSerializer(s, allocations[s.name].root, w); writeParser(s, allocations[s.name].root, w); @@ -110,7 +110,7 @@ export function writeTypescript(abi: ContractABI, init?: { // Write serializer const argTypeName = (abi.name || 'Contract') + '_init_args'; - let ops = init.args.map((v) => ({ + const ops = init.args.map((v) => ({ name: v.name, type: v.type, op: getAllocationOperationFromField(v.type, (s) => allocations[s].size) @@ -145,7 +145,7 @@ export function writeTypescript(abi: ContractABI, init?: { w.append(`const ${abi.name}_errors: { [key: number]: { message: string } } = {`); w.inIndent(() => { if (abi.errors) { - for (let k in abi.errors) { + for (const k in abi.errors) { w.append(`${k}: { message: \`${abi.errors[parseInt(k, 10)].message}\` },`); } } @@ -157,7 +157,7 @@ export function writeTypescript(abi: ContractABI, init?: { w.append(`const ${abi.name}_types: ABIType[] = [`); w.inIndent(() => { if (abi.types) { - for (let t of abi.types) { + for (const t of abi.types) { w.append(JSON.stringify(t) + ','); } } @@ -169,7 +169,7 @@ export function writeTypescript(abi: ContractABI, init?: { w.append(`const ${abi.name}_getters: ABIGetter[] = [`); w.inIndent(() => { if (abi.getters) { - for (let t of abi.getters) { + for (const t of abi.getters) { w.append(JSON.stringify(t) + ','); } } @@ -181,7 +181,7 @@ export function writeTypescript(abi: ContractABI, init?: { w.append(`const ${abi.name}_receivers: ABIReceiver[] = [`); w.inIndent(() => { if (abi.receivers) { - for (let t of abi.receivers) { + for (const t of abi.receivers) { w.append(JSON.stringify(t) + ','); } } @@ -242,7 +242,7 @@ export function writeTypescript(abi: ContractABI, init?: { if (abi.receivers && abi.receivers.filter((v) => v.receiver === 'internal').length > 0) { // Types - let receivers: string[] = []; + const receivers: string[] = []; for (const r of abi.receivers) { if (r.receiver !== 'internal') { continue; @@ -322,7 +322,7 @@ export function writeTypescript(abi: ContractABI, init?: { if (abi.receivers && abi.receivers.filter((v) => v.receiver === 'external').length > 0) { // Types - let receivers: string[] = []; + const receivers: string[] = []; for (const r of abi.receivers) { if (r.receiver !== 'external') { continue; @@ -401,12 +401,12 @@ export function writeTypescript(abi: ContractABI, init?: { // Getters if (abi.getters) { - for (let g of abi.getters) { + for (const g of abi.getters) { w.append(`async get${changeCase.pascalCase(g.name)}(${['provider: ContractProvider', ...writeArguments(g.arguments ? g.arguments : [])].join(', ')}) {`); w.inIndent(() => { w.append(`let builder = new TupleBuilder();`); if (g.arguments) { - for (let a of g.arguments) { + for (const a of g.arguments) { writeArgumentToStack(a.name, a.type, w); } } diff --git a/src/browser.ts b/src/browser.ts index 1902b679f..cc8dbb294 100644 --- a/src/browser.ts +++ b/src/browser.ts @@ -10,18 +10,18 @@ export async function run(args: { }) { // Verify config - let config = verifyConfig(args.config); + const config = verifyConfig(args.config); // Create project's writable fs - let project = createVirtualFileSystem('/', args.files, false); + const project = createVirtualFileSystem('/', args.files, false); // Create stdlib path - let stdlib = '@stdlib'; + const stdlib = '@stdlib'; // Compile let success = true; - for (let p of config.projects) { - let built = await build({ config: p, project, stdlib, logger: args.logger }); + for (const p of config.projects) { + const built = await build({ config: p, project, stdlib, logger: args.logger }); success = success && built; } return success; diff --git a/src/check.ts b/src/check.ts index 5cf2959bf..7c15c196c 100644 --- a/src/check.ts +++ b/src/check.ts @@ -25,14 +25,14 @@ export type CheckResult = { export function check(args: { project: VirtualFileSystem, entrypoint: string }): CheckResult { // Create context - let stdlib = createVirtualFileSystem('@stdlib/', files); + const stdlib = createVirtualFileSystem('@stdlib/', files); let ctx: CompilerContext = new CompilerContext({ shared: {} }); ctx = featureEnable(ctx, 'debug'); // Enable debug flag (does not affect type checking in practice) ctx = featureEnable(ctx, 'masterchain'); // Enable masterchain flag to avoid masterchain-specific errors ctx = featureEnable(ctx, 'external'); // Enable external messages flag to avoid external-specific errors // Execute check - let items: CheckResultItem[] = []; + const items: CheckResultItem[] = []; try { precompile(ctx, args.project, stdlib, args.entrypoint); } catch (e) { @@ -53,10 +53,12 @@ export function check(args: { project: VirtualFileSystem, entrypoint: string }): } }); } else { - if (typeof (e as any).message === 'string') { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const msg = (e as any).message; + if (typeof msg === 'string') { items.push({ type: 'error', - message: (e as any).message, + message: msg, location: { file: args.entrypoint, line: 0, diff --git a/src/config/features.ts b/src/config/features.ts index 72933feff..210201b1e 100644 --- a/src/config/features.ts +++ b/src/config/features.ts @@ -10,7 +10,7 @@ export function enabledDebug(ctx: CompilerContext) { return featureEnabled(ctx, 'debug'); } -export function enabledMaterchain(ctx: CompilerContext) { +export function enabledMasterchain(ctx: CompilerContext) { return featureEnabled(ctx, 'masterchain'); } diff --git a/src/config/parseConfig.ts b/src/config/parseConfig.ts index d83de3727..f0ae1f7e0 100644 --- a/src/config/parseConfig.ts +++ b/src/config/parseConfig.ts @@ -25,7 +25,7 @@ export type ConfigProject = z.infer; export type Options = z.infer; export function parseConfig(src: string) { - let parsed = JSON.parse(src); + const parsed = JSON.parse(src); return configSchema.parse(parsed); } diff --git a/src/context.ts b/src/context.ts index c78df7407..b0fd6c0e3 100644 --- a/src/context.ts +++ b/src/context.ts @@ -1,8 +1,8 @@ export class CompilerContext { - readonly shared: { [key: symbol]: any } = {}; + readonly shared: { [key: symbol]: object } = {}; - constructor(args: { shared: { [key: symbol]: any } } = { shared: {} }) { + constructor(args: { shared: { [key: symbol]: object } } = { shared: {} }) { this.shared = args.shared; Object.freeze(this.shared); Object.freeze(this); @@ -19,13 +19,13 @@ export class CompilerContext { } export function createContextStore() { - let symbol = Symbol(); + const symbol = Symbol(); return { get(ctx: CompilerContext, key: string | number) { if (!ctx.shared[symbol]) { return null; } - let m = ctx.shared[symbol] as { [key: string | number]: T }; + const m = ctx.shared[symbol] as { [key: string | number]: T }; if (m[key]) { return m[key]; } else { @@ -36,7 +36,7 @@ export function createContextStore() { if (!ctx.shared[symbol]) { return {} as { [key: string | number]: T }; } - let m = ctx.shared[symbol] as { [key: string | number]: T }; + const m = ctx.shared[symbol] as { [key: string | number]: T }; return m; }, set(ctx: CompilerContext, key: string | number, v: T) { diff --git a/src/func/funcCompile.spec.ts b/src/func/funcCompile.spec.ts index 0cf8ac9f6..0e5a44492 100644 --- a/src/func/funcCompile.spec.ts +++ b/src/func/funcCompile.spec.ts @@ -6,8 +6,8 @@ import files from '../imports/stdlib'; describe('funcCompile', () => { it('should compile small contract', async () => { - let source = fs.readFileSync(path.resolve(__dirname, '__testdata__', 'small.fc'), 'utf8'); - let res = await funcCompile({ + const source = fs.readFileSync(path.resolve(__dirname, '__testdata__', 'small.fc'), 'utf8'); + const res = await funcCompile({ entries: ['/stdlib.fc', '/small.fc'], sources: [{ path: '/stdlib.fc', diff --git a/src/func/funcCompile.ts b/src/func/funcCompile.ts index b804de1d7..cdbe17c5b 100644 --- a/src/func/funcCompile.ts +++ b/src/func/funcCompile.ts @@ -2,23 +2,28 @@ import { TactLogger } from "../logger"; import { errorToString } from "../utils/errorToString"; // Wasm Imports +// eslint-disable-next-line @typescript-eslint/no-var-requires const CompilerModule = require('./funcfiftlib.js'); +// eslint-disable-next-line @typescript-eslint/no-var-requires const FuncFiftLibWasm = require('./funcfiftlib.wasm.js').FuncFiftLibWasm; const WasmBinary = Buffer.from(FuncFiftLibWasm, 'base64'); type Pointer = unknown; +// eslint-disable-next-line @typescript-eslint/no-explicit-any const writeToCString = (mod: any, data: string): Pointer => { const len = mod.lengthBytesUTF8(data) + 1; const ptr = mod._malloc(len); mod.stringToUTF8(data, ptr, len); return ptr; }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any const writeToCStringPtr = (mod: any, str: string, ptr: any) => { const allocated = writeToCString(mod, str); mod.setValue(ptr, allocated, '*'); return allocated; }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any const readFromCString = (mod: any, pointer: Pointer): string => mod.UTF8ToString(pointer); export function cutFirstLine(src: string) { @@ -50,8 +55,8 @@ type CompileResult = { export async function funcCompile(args: { entries: string[], sources: { path: string, content: string }[], logger: TactLogger }): Promise { // Parameters - let files: string[] = args.entries; - let configStr = JSON.stringify({ + const files: string[] = args.entries; + const configStr = JSON.stringify({ sources: files, optLevel: 2 // compileConfig.optLevel || 2 }); @@ -69,16 +74,18 @@ export async function funcCompile(args: { entries: string[], sources: { path: st }; // Create module - let logs: string[] = [] - let mod = await CompilerModule({ wasmBinary: WasmBinary, printErr: (e: any) => { logs.push(e); } }); + const logs: string[] = [] + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const mod = await CompilerModule({ wasmBinary: WasmBinary, printErr: (e: any) => { logs.push(e); } }); // Execute try { // Write config - let configPointer = trackPointer(writeToCString(mod, configStr)); + const configPointer = trackPointer(writeToCString(mod, configStr)); // FS emulation callback + // eslint-disable-next-line @typescript-eslint/no-explicit-any const callbackPtr = trackFunctionPointer(mod.addFunction((_kind: any, _data: any, contents: any, error: any) => { const kind: string = readFromCString(mod, _kind); const data: string = readFromCString(mod, _data); @@ -86,12 +93,13 @@ export async function funcCompile(args: { entries: string[], sources: { path: st allocatedPointers.push(writeToCStringPtr(mod, data, contents)); } else if (kind === 'source') { try { - let fl = args.sources.find((v) => v.path === data); + const fl = args.sources.find((v) => v.path === data); if (!fl) { throw Error('File not found: ' + data) } allocatedPointers.push(writeToCStringPtr(mod, fl.content, contents)); } catch (err) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any const e = err as any; allocatedPointers.push(writeToCStringPtr(mod, 'message' in e ? e.message : e.toString(), error)); } @@ -101,11 +109,11 @@ export async function funcCompile(args: { entries: string[], sources: { path: st }, 'viiii')); // Execute - let resultPointer = trackPointer(mod._func_compile(configPointer, callbackPtr)); - let retJson = readFromCString(mod, resultPointer); - let result = JSON.parse(retJson) as CompileResult; + const resultPointer = trackPointer(mod._func_compile(configPointer, callbackPtr)); + const retJson = readFromCString(mod, resultPointer); + const result = JSON.parse(retJson) as CompileResult; - let msg = logs.join('\n'); + const msg = logs.join('\n'); if (result.status === 'error') { return { @@ -128,10 +136,10 @@ export async function funcCompile(args: { entries: string[], sources: { path: st args.logger.error(errorToString(e)); throw Error('Unexpected compiler response'); } finally { - for (let i of allocatedFunctions) { + for (const i of allocatedFunctions) { mod.removeFunction(i); } - for (let i of allocatedPointers) { + for (const i of allocatedPointers) { mod._free(i); } } diff --git a/src/generator/Writer.ts b/src/generator/Writer.ts index ffb2cce9d..13f145693 100644 --- a/src/generator/Writer.ts +++ b/src/generator/Writer.ts @@ -2,7 +2,6 @@ import { CompilerContext } from "../context"; import { trimIndent } from "../utils/text"; import { topologicalSort } from "../utils/utils"; import { Writer } from "../utils/Writer"; -import { createPadded } from "./emitter/createPadded"; type Flag = 'inline' | 'impure'; @@ -54,7 +53,7 @@ export class WriterContext { } clone() { - let res = new WriterContext(this.ctx, this.#name); + const res = new WriterContext(this.ctx, this.#name); res.#functions = new Map(this.#functions); res.#nextId = this.#nextId; // res.#headers = [...this.#headers]; @@ -69,14 +68,14 @@ export class WriterContext { extract(debug: boolean = false) { // Check dependencies - let missing = new Map(); - for (let f of this.#functions.values()) { - for (let d of f.depends) { + const missing = new Map(); + for (const f of this.#functions.values()) { + for (const d of f.depends) { if (!this.#functions.has(d)) { if (!missing.has(d)) { missing.set(d, [f.name]); } else { - missing.set(d, [...missing.get(d)!!, f.name]); + missing.set(d, [...missing.get(d)!, f.name]); } } @@ -91,11 +90,11 @@ export class WriterContext { // Remove unused if (!debug) { - let used = new Set(); - let visit = (name: string) => { + const used = new Set(); + const visit = (name: string) => { used.add(name); - let f = this.#functions.get(name)!!; - for (let d of f.depends) { + const f = this.#functions.get(name)!; + for (const d of f.depends) { visit(d); } } @@ -104,7 +103,7 @@ export class WriterContext { } // Sort functions - let sorted = topologicalSort(all, (f) => Array.from(f.depends).map((v) => this.#functions.get(v)!!)); + const sorted = topologicalSort(all, (f) => Array.from(f.depends).map((v) => this.#functions.get(v)!)); return sorted; } @@ -119,7 +118,7 @@ export class WriterContext { this.context('stdlib'); this.#pendingCode = { kind: 'skip' }; }); - }; + } fun(name: string, handler: () => void) { @@ -138,15 +137,15 @@ export class WriterContext { // Nesting check // - if (!!this.#pendingName) { - let w = this.#pendingWriter; - let d = this.#pendingDepends; - let n = this.#pendingName; - let s = this.#pendingSignature; - let f = this.#pendingFlags; - let c = this.#pendingCode; - let cc = this.#pendingComment; - let cs = this.#pendingContext; + if (this.#pendingName) { + const w = this.#pendingWriter; + const d = this.#pendingDepends; + const n = this.#pendingName; + const s = this.#pendingSignature; + const f = this.#pendingFlags; + const c = this.#pendingCode; + const cc = this.#pendingComment; + const cs = this.#pendingContext; this.#pendingDepends = null; this.#pendingWriter = null; this.#pendingName = null; @@ -178,12 +177,12 @@ export class WriterContext { this.#pendingComment = null; this.#pendingContext = null; handler(); - let depends = this.#pendingDepends; - let signature = this.#pendingSignature!; - let flags = this.#pendingFlags; - let code = this.#pendingCode; - let comment = this.#pendingComment; - let context = this.#pendingContext; + const depends = this.#pendingDepends; + const signature = this.#pendingSignature!; + const flags = this.#pendingFlags; + const code = this.#pendingCode; + const comment = this.#pendingComment; + const context = this.#pendingContext; if (!signature && name !== '$main') { throw new Error(`Function ${name} signature not set`); } @@ -228,7 +227,7 @@ export class WriterContext { kind: 'generic', code: this.#pendingWriter!.end() } - }; + } main(handler: () => void) { this.fun('$main', () => { @@ -236,7 +235,7 @@ export class WriterContext { handler(); }); }); - }; + } signature(sig: string) { if (this.#pendingName) { @@ -256,7 +255,7 @@ export class WriterContext { used(name: string) { if (this.#pendingName !== name) { - this.#pendingDepends!!.add(name); + this.#pendingDepends!.add(name); } return name; } diff --git a/src/generator/createABI.ts b/src/generator/createABI.ts index f88f06444..1dace15cc 100644 --- a/src/generator/createABI.ts +++ b/src/generator/createABI.ts @@ -1,17 +1,17 @@ import { ABIGetter, ABIReceiver, ABIType, ContractABI } from "@ton/core"; import { contractErrors } from "../abi/errors"; import { CompilerContext } from "../context"; -import { getSupportedIntefaces } from "../types/getSupportedInterfaces"; +import { getSupportedInterfaces } from "../types/getSupportedInterfaces"; import { createABITypeRefFromTypeRef } from "../types/resolveABITypeRef"; import { getAllTypes } from "../types/resolveDescriptors"; import { getAllErrors } from "../types/resolveErrors"; export function createABI(ctx: CompilerContext, name: string): ContractABI { - let allTypes = Object.values(getAllTypes(ctx)); + const allTypes = Object.values(getAllTypes(ctx)); // Contract - let contract = allTypes.find((v) => v.name === name)!; + const contract = allTypes.find((v) => v.name === name)!; if (!contract) { throw Error(`Contract ${name} not found`); } @@ -20,8 +20,8 @@ export function createABI(ctx: CompilerContext, name: string): ContractABI { } // Structs - let types: ABIType[] = []; - for (let t of allTypes) { + const types: ABIType[] = []; + for (const t of allTypes) { if (t.kind === 'struct') { types.push({ name: t.name, @@ -32,8 +32,8 @@ export function createABI(ctx: CompilerContext, name: string): ContractABI { } // // Receivers - let receivers: ABIReceiver[] = []; - for (let r of Object.values(contract.receivers)) { + const receivers: ABIReceiver[] = []; + for (const r of Object.values(contract.receivers)) { if (r.selector.kind === 'internal-binary') { receivers.push({ receiver: 'internal', @@ -112,8 +112,8 @@ export function createABI(ctx: CompilerContext, name: string): ContractABI { } // Getters - let getters: ABIGetter[] = []; - for (let f of contract.functions.values()) { + const getters: ABIGetter[] = []; + for (const f of contract.functions.values()) { if (f.isGetter) { getters.push({ name: f.name, @@ -124,7 +124,7 @@ export function createABI(ctx: CompilerContext, name: string): ContractABI { } // Errors - let errors: { [key: string]: { message: string } } = {}; + const errors: { [key: string]: { message: string } } = {}; errors['2'] = { message: 'Stack undeflow' }; errors['3'] = { message: 'Stack overflow' }; errors['4'] = { message: 'Integer overflow' }; @@ -139,16 +139,16 @@ export function createABI(ctx: CompilerContext, name: string): ContractABI { errors['34'] = { message: 'Action is invalid or not supported' }; errors['37'] = { message: 'Not enough TON' }; errors['38'] = { message: 'Not enough extra-currencies' }; - for (let e of Object.values(contractErrors)) { + for (const e of Object.values(contractErrors)) { errors[e.id] = { message: e.message }; } - let codeErrors = getAllErrors(ctx); - for (let c of codeErrors) { + const codeErrors = getAllErrors(ctx); + for (const c of codeErrors) { errors[c.id + ''] = { message: c.value }; } // Interfaces - let interfaces = ['org.ton.introspection.v0', ...getSupportedIntefaces(contract, ctx)]; + const interfaces = ['org.ton.introspection.v0', ...getSupportedInterfaces(contract, ctx)]; return { name: contract.name, @@ -157,5 +157,5 @@ export function createABI(ctx: CompilerContext, name: string): ContractABI { getters, errors, interfaces - } as any; + } as object; } \ No newline at end of file diff --git a/src/generator/emitter/emit.ts b/src/generator/emitter/emit.ts index ff1634981..4ac0e08de 100644 --- a/src/generator/emitter/emit.ts +++ b/src/generator/emitter/emit.ts @@ -16,7 +16,7 @@ export function emit(args: { // Emit functions if (args.functions) { - for (let f of args.functions) { + for (const f of args.functions) { if (f.name === '$main') { continue; } else { @@ -24,7 +24,7 @@ export function emit(args: { res += '\n\n'; } if (f.comment) { - for (let s of f.comment.split('\n')) { + for (const s of f.comment.split('\n')) { res += `;; ${s}\n`; } } @@ -54,7 +54,7 @@ export function emit(args: { } // Emit main - let m = args.functions.find((v) => v.name === '$main'); + const m = args.functions.find((v) => v.name === '$main'); if (m) { if (m.code.kind !== 'generic') { throw new Error(`Main function should have generic body`); diff --git a/src/generator/intrinsics/tryExpressionIntrinsics.ts b/src/generator/intrinsics/tryExpressionIntrinsics.ts index 626861154..1714d3701 100644 --- a/src/generator/intrinsics/tryExpressionIntrinsics.ts +++ b/src/generator/intrinsics/tryExpressionIntrinsics.ts @@ -2,13 +2,13 @@ import { ASTExpression } from "../../grammar/ast"; import { resolveConstantValue } from "../../types/resolveConstantValue"; import { getExpType } from "../../types/resolveExpression"; import { WriterContext } from "../Writer"; -import { writeComment, writeString } from "../writers/writeConstant"; +import { writeComment } from "../writers/writeConstant"; export function tryExpressionIntrinsics(exp: ASTExpression, ctx: WriterContext): string | null { // Calls instrinsics if (exp.kind === 'op_call') { - let sourceType = getExpType(ctx.ctx, exp.src); + const sourceType = getExpType(ctx.ctx, exp.src); if (sourceType.kind === 'ref' && sourceType.name === 'String' && !sourceType.optional) { // @@ -20,7 +20,7 @@ export function tryExpressionIntrinsics(exp: ASTExpression, ctx: WriterContext): // Try to resolve constant value try { - let res = resolveConstantValue(sourceType, exp.src, ctx.ctx); + const res = resolveConstantValue(sourceType, exp.src, ctx.ctx); if (typeof res !== 'string') { throw new Error('Expected string'); } @@ -31,7 +31,7 @@ export function tryExpressionIntrinsics(exp: ASTExpression, ctx: WriterContext): // Render if constant if (constString !== null) { - let id = writeComment(constString, ctx); + const id = writeComment(constString, ctx); ctx.used(id); return `${id}()`; } diff --git a/src/generator/writeProgram.ts b/src/generator/writeProgram.ts index f9b238043..b41836ae8 100644 --- a/src/generator/writeProgram.ts +++ b/src/generator/writeProgram.ts @@ -21,8 +21,8 @@ export async function writeProgram(ctx: CompilerContext, abiSrc: ContractABI, ba // Load ABI (required for generator) // - let abi = JSON.stringify(abiSrc); - let abiLink = await calculateIPFSlink(Buffer.from(abi)); + const abi = JSON.stringify(abiSrc); + const abiLink = await calculateIPFSlink(Buffer.from(abi)); // // Render contract @@ -50,7 +50,7 @@ export async function writeProgram(ctx: CompilerContext, abiSrc: ContractABI, ba headers.push(`;;`); headers.push(``); // const sortedHeaders = [...functions].sort((a, b) => a.name.localeCompare(b.name)); - for (let f of functions) { + for (const f of functions) { if (f.code.kind === 'generic' && f.signature) { headers.push(`;; ${f.name}`); let sig = f.signature; @@ -87,7 +87,7 @@ export async function writeProgram(ctx: CompilerContext, abiSrc: ContractABI, ba imported.push('stdlib'); } - let stdlib = emit({ + const stdlib = emit({ header: stdlibHeader, functions: stdlibFunctions }); @@ -101,7 +101,7 @@ export async function writeProgram(ctx: CompilerContext, abiSrc: ContractABI, ba // native // - let nativeSources = getRawAST(ctx).funcSources; + const nativeSources = getRawAST(ctx).funcSources; if (nativeSources.length > 0) { imported.push('native'); files.push({ @@ -127,11 +127,11 @@ export async function writeProgram(ctx: CompilerContext, abiSrc: ContractABI, ba // storage // - let emitedTypes: string[] = []; - let types = getSortedTypes(ctx); - for (let t of types) { + const emitedTypes: string[] = []; + const types = getSortedTypes(ctx); + for (const t of types) { - let ffs: WrittenFunction[] = []; + const ffs: WrittenFunction[] = []; if (t.kind === 'struct' || t.kind === 'contract' || t.kind == 'trait') { const typeFunctions = tryExtractModule(functions, 'type:' + t.name, imported); if (typeFunctions) { @@ -148,7 +148,7 @@ export async function writeProgram(ctx: CompilerContext, abiSrc: ContractABI, ba } if (ffs.length > 0) { - let header: string[] = []; + const header: string[] = []; header.push(';;'); header.push(`;; Type: ${t.name}`); if (t.header !== null) { @@ -191,7 +191,7 @@ export async function writeProgram(ctx: CompilerContext, abiSrc: ContractABI, ba header.push('#pragma allow-post-modification;'); header.push('#pragma compute-asm-ltr;'); header.push(''); - for (let i of files.map((v) => `#include "${v.name}";`)) { + for (const i of files.map((v) => `#include "${v.name}";`)) { header.push(i); } header.push(''); @@ -218,13 +218,13 @@ export async function writeProgram(ctx: CompilerContext, abiSrc: ContractABI, ba function tryExtractModule(functions: WrittenFunction[], context: string | null, imported: string[]): WrittenFunction[] | null { // Put to map - let maps = new Map(); - for (let f of functions) { + const maps = new Map(); + for (const f of functions) { maps.set(f.name, f); } // Extract functions of a context - let ctxFunctions: WrittenFunction[] = functions + const ctxFunctions: WrittenFunction[] = functions .filter((v) => v.code.kind !== 'skip') .filter((v) => { if (context) { @@ -271,11 +271,11 @@ function writeAll(ctx: CompilerContext, wctx: WriterContext, name: string, abiLi writeStdlib(wctx); // Serializators - let sortedTypes = getSortedTypes(ctx); - for (let t of sortedTypes) { + const sortedTypes = getSortedTypes(ctx); + for (const t of sortedTypes) { if (t.kind === 'contract' || t.kind === 'struct') { - let allocation = getAllocation(ctx, t.name); - let allocationBounced = getAllocation(ctx, toBounced(t.name)); + const allocation = getAllocation(ctx, t.name); + const allocationBounced = getAllocation(ctx, toBounced(t.name)); writeSerializer(t.name, t.kind === 'contract', allocation, t.origin, wctx); writeOptionalSerializer(t.name, t.origin, wctx); writeParser(t.name, t.kind === 'contract', allocation, t.origin, wctx); @@ -285,46 +285,46 @@ function writeAll(ctx: CompilerContext, wctx: WriterContext, name: string, abiLi } // Accessors - for (let t of allTypes) { + for (const t of allTypes) { if (t.kind === 'contract' || t.kind === 'struct') { writeAccessors(t, t.origin, wctx); } } // Init serializers - for (let t of sortedTypes) { + for (const t of sortedTypes) { if (t.kind === 'contract' && t.init) { - let allocation = getAllocation(ctx, initId(t.name)); + const allocation = getAllocation(ctx, initId(t.name)); writeSerializer(initId(t.name), true, allocation, t.origin, wctx); writeParser(initId(t.name), false, allocation, t.origin, wctx); } } // Storage Functions - for (let t of sortedTypes) { + for (const t of sortedTypes) { if (t.kind === 'contract') { writeStorageOps(t, t.origin, wctx); } } // Static functions - let sf = getAllStaticFunctions(ctx); - for (let k in sf) { - let f = sf[k]; + const sf = getAllStaticFunctions(ctx); + for (const k in sf) { + const f = sf[k]; writeFunction(f, wctx); } // Extensions - for (let c of allTypes) { + for (const c of allTypes) { if (c.kind !== 'contract' && c.kind !== 'trait') { // We are rendering contract functions separately - for (let f of c.functions.values()) { + for (const f of c.functions.values()) { writeFunction(f, wctx); } } } // Contract functions - for (let c of contracts) { + for (const c of contracts) { // Init if (c.init) { @@ -332,7 +332,7 @@ function writeAll(ctx: CompilerContext, wctx: WriterContext, name: string, abiLi } // Functions - for (let f of c.functions.values()) { + for (const f of c.functions.values()) { writeFunction(f, wctx); } } diff --git a/src/generator/writeReport.ts b/src/generator/writeReport.ts index 4886ec98a..6d549322c 100644 --- a/src/generator/writeReport.ts +++ b/src/generator/writeReport.ts @@ -5,8 +5,8 @@ import { getType } from "../types/resolveDescriptors"; import { Writer } from "../utils/Writer"; export function writeReport(ctx: CompilerContext, pkg: PackageFileFormat) { - let w = new Writer(); - let abi = JSON.parse(pkg.abi) as ContractABI; + const w = new Writer(); + const abi = JSON.parse(pkg.abi) as ContractABI; w.write(` # TACT Compilation Report Contract: ${pkg.name} @@ -18,8 +18,8 @@ export function writeReport(ctx: CompilerContext, pkg: PackageFileFormat) { w.write(`# Types`); w.write('Total Types: ' + abi.types!.length); w.append(); - for (let t of abi.types!) { - let tt = getType(ctx, t.name); + for (const t of abi.types!) { + const tt = getType(ctx, t.name); w.write(`## ${t.name}`); w.write(`TLB: \`${tt.tlb!}\``); w.write(`Signature: \`${tt.signature!}\``); @@ -30,9 +30,9 @@ export function writeReport(ctx: CompilerContext, pkg: PackageFileFormat) { w.write(`# Get Methods`); w.write('Total Get Methods: ' + abi.getters!.length); w.append(); - for (let t of abi.getters!) { + for (const t of abi.getters!) { w.write(`## ${t.name}`); - for (let arg of t.arguments!) { + for (const arg of t.arguments!) { w.write(`Argument: ${arg.name}`); } w.append(); @@ -40,7 +40,7 @@ export function writeReport(ctx: CompilerContext, pkg: PackageFileFormat) { // Error Codes w.write(`# Error Codes`); - for (let t in abi.errors!) { + for (const t in abi.errors!) { w.write(`${t}: ${abi.errors![parseInt(t, 10)].message}`); } diff --git a/src/generator/writers/cast.ts b/src/generator/writers/cast.ts index 2373cd2b5..b742ce3b5 100644 --- a/src/generator/writers/cast.ts +++ b/src/generator/writers/cast.ts @@ -9,7 +9,7 @@ export function cast(from: TypeRef, to: TypeRef, expression: string, ctx: Writer throw Error('Impossible'); } if (!from.optional && to.optional) { - let type = getType(ctx.ctx, from.name); + const type = getType(ctx.ctx, from.name); if (type.kind === 'struct') { return `${ops.typeAsOptional(type.name, ctx)}(${expression})`; } diff --git a/src/generator/writers/ops.ts b/src/generator/writers/ops.ts index 3f9ac5f8a..0fd2b4132 100644 --- a/src/generator/writers/ops.ts +++ b/src/generator/writers/ops.ts @@ -2,7 +2,7 @@ import { WriterContext } from "../Writer"; function used(name: string, ctx: WriterContext) { - let c = ctx.currentContext(); + const c = ctx.currentContext(); if (c) { ctx.used(name); } diff --git a/src/generator/writers/resolveFuncTupledType.ts b/src/generator/writers/resolveFuncTupledType.ts index 34267e1fa..effd6ffec 100644 --- a/src/generator/writers/resolveFuncTupledType.ts +++ b/src/generator/writers/resolveFuncTupledType.ts @@ -2,16 +2,16 @@ import { getType } from "../../types/resolveDescriptors"; import { TypeDescription, TypeRef } from "../../types/types"; import { WriterContext } from "../Writer"; -export function resolveFuncTupledType(descriptor: TypeRef | TypeDescription | string, ctx: WriterContext, optional: boolean = false): string { +export function resolveFuncTupledType(descriptor: TypeRef | TypeDescription | string, ctx: WriterContext): string { // String if (typeof descriptor === 'string') { - return resolveFuncTupledType(getType(ctx.ctx, descriptor), ctx, false); + return resolveFuncTupledType(getType(ctx.ctx, descriptor), ctx); } // TypeRef if (descriptor.kind === 'ref') { - return resolveFuncTupledType(getType(ctx.ctx, descriptor.name), ctx, descriptor.optional); + return resolveFuncTupledType(getType(ctx.ctx, descriptor.name), ctx); } if (descriptor.kind === 'map') { return 'cell'; diff --git a/src/generator/writers/resolveFuncType.spec.ts b/src/generator/writers/resolveFuncType.spec.ts index 3da49ab10..2fe1c4892 100644 --- a/src/generator/writers/resolveFuncType.spec.ts +++ b/src/generator/writers/resolveFuncType.spec.ts @@ -53,7 +53,7 @@ describe('resolveFuncType', () => { it('should process primitive types', () => { let ctx = openContext(new CompilerContext(), [{ code: primitiveCode, path: '', origin: 'user' }], []); ctx = resolveDescriptors(ctx); - let wctx = new WriterContext(ctx, 'Contract1'); + const wctx = new WriterContext(ctx, 'Contract1'); expect(resolveFuncType({ kind: 'ref', name: 'Int', optional: false }, wctx)).toBe('int'); expect(resolveFuncType({ kind: 'ref', name: 'Bool', optional: false }, wctx)).toBe('int'); expect(resolveFuncType({ kind: 'ref', name: 'Cell', optional: false }, wctx)).toBe('cell'); @@ -69,7 +69,7 @@ describe('resolveFuncType', () => { it('should process contract and struct types', () => { let ctx = openContext(new CompilerContext(), [{ code: primitiveCode, path: '', origin: 'user' }], []); ctx = resolveDescriptors(ctx); - let wctx = new WriterContext(ctx, 'Contract1'); + const wctx = new WriterContext(ctx, 'Contract1'); expect(resolveFuncType({ kind: 'ref', name: 'Struct1', optional: false }, wctx)).toBe('(int, int)'); expect(resolveFuncType({ kind: 'ref', name: 'Struct2', optional: false }, wctx)).toBe('(int)'); expect(resolveFuncType({ kind: 'ref', name: 'Contract1', optional: false }, wctx)).toBe('(int, int)'); diff --git a/src/generator/writers/resolveFuncTypeFromAbi.ts b/src/generator/writers/resolveFuncTypeFromAbi.ts index 9ca0ea1cd..218ebcf15 100644 --- a/src/generator/writers/resolveFuncTypeFromAbi.ts +++ b/src/generator/writers/resolveFuncTypeFromAbi.ts @@ -6,8 +6,8 @@ export function resolveFuncTypeFromAbi(fields: ABITypeRef[], ctx: WriterContext) if (fields.length === 0) { return 'tuple'; } - let res: string[] = []; - for (let f of fields) { + const res: string[] = []; + for (const f of fields) { if (f.kind === 'dict') { res.push('cell'); } else if (f.kind === 'simple') { @@ -26,14 +26,14 @@ export function resolveFuncTypeFromAbi(fields: ABITypeRef[], ctx: WriterContext) } else if (f.type === 'string') { res.push('slice'); } else { - let t = getType(ctx.ctx, f.type); + const t = getType(ctx.ctx, f.type); if (t.kind !== 'struct') { throw Error('Unsupported type: ' + t.kind); } if (f.optional || t.fields.length === 0) { res.push('tuple'); } else { - let loaded = t.fields.map((v) => v.abi.type); + const loaded = t.fields.map((v) => v.abi.type); res.push(resolveFuncTypeFromAbi(loaded, ctx)); } } diff --git a/src/generator/writers/resolveFuncTypeFromAbiUnpack.ts b/src/generator/writers/resolveFuncTypeFromAbiUnpack.ts index 7f2327f9c..d945a365a 100644 --- a/src/generator/writers/resolveFuncTypeFromAbiUnpack.ts +++ b/src/generator/writers/resolveFuncTypeFromAbiUnpack.ts @@ -6,8 +6,8 @@ export function resolveFuncTypeFromAbiUnpack(name: string, fields: { name: strin if (fields.length === 0) { return `${name}`; } - let res: string[] = []; - for (let f of fields) { + const res: string[] = []; + for (const f of fields) { if (f.type.kind === 'dict') { res.push(`${name}'${f.name}`); } else if (f.type.kind === 'simple') { @@ -26,11 +26,11 @@ export function resolveFuncTypeFromAbiUnpack(name: string, fields: { name: strin } else if (f.type.type === 'string') { res.push(`${name}'${f.name}`); } else { - let t = getType(ctx.ctx, f.type.type); + const t = getType(ctx.ctx, f.type.type); if (f.type.optional || t.fields.length === 0) { res.push(`${name}'${f.name}`); } else { - let loaded = t.fields.map((v) => v.abi); + const loaded = t.fields.map((v) => v.abi); res.push(resolveFuncTypeFromAbiUnpack(`${name}'${f.name}`, loaded, ctx)); } } diff --git a/src/generator/writers/writeAccessors.ts b/src/generator/writers/writeAccessors.ts index e0b43a971..9a42fd1d7 100644 --- a/src/generator/writers/writeAccessors.ts +++ b/src/generator/writers/writeAccessors.ts @@ -12,7 +12,7 @@ import { resolveFuncTypeUnpack } from "./resolveFuncTypeUnpack"; export function writeAccessors(type: TypeDescription, origin: TypeOrigin, ctx: WriterContext) { // Getters - for (let f of type.fields) { + for (const f of type.fields) { ctx.fun(ops.typeField(type.name, f.name, ctx), () => { ctx.signature(`_ ${ops.typeField(type.name, f.name, ctx)}(${resolveFuncType(type, ctx)} v)`); ctx.flag('inline'); @@ -38,10 +38,10 @@ export function writeAccessors(type: TypeDescription, origin: TypeOrigin, ctx: W ctx.context('type:' + type.name); ctx.body(() => { ctx.append(`throw_if(${contractErrors.null.id}, null?(v));`) - let flatPack = resolveFuncFlatPack(type, 'vvv', ctx); - let flatTypes = resolveFuncFlatTypes(type, ctx); + const flatPack = resolveFuncFlatPack(type, 'vvv', ctx); + const flatTypes = resolveFuncFlatTypes(type, ctx); if (flatPack.length !== flatTypes.length) throw Error('Flat pack and flat types length mismatch'); - let pairs = flatPack.map((v, i) => `${flatTypes[i]} ${v}`); + const pairs = flatPack.map((v, i) => `${flatTypes[i]} ${v}`); ctx.used(`__tact_tuple_destroy_${flatPack.length}`); ctx.append(`var (${pairs.join(', ')}) = __tact_tuple_destroy_${flatPack.length}(v);`); ctx.append(`return ${resolveFuncTypeUnpack(type, 'vvv', ctx)};`); @@ -55,7 +55,7 @@ export function writeAccessors(type: TypeDescription, origin: TypeOrigin, ctx: W ctx.context('type:' + type.name); ctx.body(() => { ctx.append(`var ${resolveFuncTypeUnpack(type, 'v', ctx)} = v;`); - let flatPack = resolveFuncFlatPack(type, 'v', ctx); + const flatPack = resolveFuncFlatPack(type, 'v', ctx); ctx.used(`__tact_tuple_create_${flatPack.length}`); ctx.append(`return __tact_tuple_create_${flatPack.length}(${flatPack.join(', ')});`); }); @@ -71,10 +71,10 @@ export function writeAccessors(type: TypeDescription, origin: TypeOrigin, ctx: W ctx.context('type:' + type.name); ctx.body(() => { ctx.append(`var (${type.fields.map((v) => `v'${v.name}`).join(', ')}) = v;`); - let vars: string[] = []; - for (let f of type.fields) { + const vars: string[] = []; + for (const f of type.fields) { if (f.type.kind === 'ref') { - let t = getType(ctx.ctx, f.type.name); + const t = getType(ctx.ctx, f.type.name); if (t.kind === 'struct') { if (f.type.optional) { vars.push(`${ops.typeToOptTuple(f.type.name, ctx)}(v'${f.name})`); @@ -107,11 +107,11 @@ export function writeAccessors(type: TypeDescription, origin: TypeOrigin, ctx: W ctx.context('type:' + type.name); ctx.body(() => { // Resolve vars - let vars: string[] = []; - let out: string[] = []; - for (let f of type.fields) { + const vars: string[] = []; + const out: string[] = []; + for (const f of type.fields) { if (f.type.kind === 'ref') { - let t = getType(ctx.ctx, f.type.name); + const t = getType(ctx.ctx, f.type.name); if (t.kind === 'struct') { vars.push(`tuple v'${f.name}`); if (f.type.optional) { @@ -160,10 +160,10 @@ export function writeAccessors(type: TypeDescription, origin: TypeOrigin, ctx: W ctx.context('type:' + type.name); ctx.body(() => { ctx.append(`var (${type.fields.map((v) => `v'${v.name}`).join(', ')}) = v; `); - let vars: string[] = []; - for (let f of type.fields) { + const vars: string[] = []; + for (const f of type.fields) { if (f.type.kind === 'ref') { - let t = getType(ctx.ctx, f.type.name); + const t = getType(ctx.ctx, f.type.name); if (t.kind === 'struct') { if (f.type.optional) { vars.push(`${ops.typeToOptTuple(f.type.name, ctx)}(v'${f.name})`); diff --git a/src/generator/writers/writeConstant.ts b/src/generator/writers/writeConstant.ts index 0b47bc5d9..0decb728f 100644 --- a/src/generator/writers/writeConstant.ts +++ b/src/generator/writers/writeConstant.ts @@ -2,17 +2,17 @@ import { Address, beginCell, Cell } from "@ton/core"; import { WriterContext } from "../Writer"; export function writeString(str: string, ctx: WriterContext) { - let cell = beginCell().storeStringTail(str).endCell(); + const cell = beginCell().storeStringTail(str).endCell(); return writeRawSlice('string', `String "${str}"`, cell, ctx); } export function writeStringCell(str: string, ctx: WriterContext) { - let cell = beginCell().storeStringTail(str).endCell(); + const cell = beginCell().storeStringTail(str).endCell(); return writeRawCell('string', `String "${str}"`, cell, ctx); } export function writeComment(str: string, ctx: WriterContext) { - let cell = beginCell().storeUint(0, 32).storeStringTail(str).endCell(); + const cell = beginCell().storeUint(0, 32).storeStringTail(str).endCell(); return writeRawCell('comment', `Comment "${str}"`, cell, ctx); } @@ -25,9 +25,9 @@ export function writeCell(cell: Cell, ctx: WriterContext) { } function writeRawSlice(prefix: string, comment: string, cell: Cell, ctx: WriterContext) { - let h = cell.hash().toString('hex'); - let t = cell.toBoc({ idx: false }).toString('hex'); - let k = 'slice:' + prefix + ':' + h; + const h = cell.hash().toString('hex'); + const t = cell.toBoc({ idx: false }).toString('hex'); + const k = 'slice:' + prefix + ':' + h; if (ctx.isRendered(k)) { return `__gen_slice_${prefix}_${h}`; } @@ -42,9 +42,9 @@ function writeRawSlice(prefix: string, comment: string, cell: Cell, ctx: WriterC } function writeRawCell(prefix: string, comment: string, cell: Cell, ctx: WriterContext) { - let h = cell.hash().toString('hex'); - let t = cell.toBoc({ idx: false }).toString('hex'); - let k = 'cell:' + prefix + ':' + h; + const h = cell.hash().toString('hex'); + const t = cell.toBoc({ idx: false }).toString('hex'); + const k = 'cell:' + prefix + ':' + h; if (ctx.isRendered(k)) { return `__gen_cell_${prefix}_${h}`; } diff --git a/src/generator/writers/writeContract.ts b/src/generator/writers/writeContract.ts index 116f95633..afe7365d7 100644 --- a/src/generator/writers/writeContract.ts +++ b/src/generator/writers/writeContract.ts @@ -1,8 +1,8 @@ import { contractErrors } from "../../abi/errors"; -import { enabledInline, enabledMaterchain } from "../../config/features"; +import { enabledInline, enabledMasterchain } from "../../config/features"; import { InitDescription, TypeDescription, TypeOrigin } from "../../types/types"; import { WriterContext } from "../Writer"; -import { fn, id, initId } from "./id"; +import { id, initId } from "./id"; import { ops } from "./ops"; import { resolveFuncPrimitive } from "./resolveFuncPrimitive"; import { resolveFuncType } from "./resolveFuncType"; @@ -42,7 +42,7 @@ export function writeStorageOps(type: TypeDescription, origin: TypeOrigin, ctx: ctx.inIndent(() => { // Allow only workchain deployments - if (!enabledMaterchain(ctx.ctx)) { + if (!enabledMasterchain(ctx.ctx)) { ctx.write(`;; Allow only workchain deployments`); ctx.write(`throw_unless(${contractErrors.masterchainNotEnabled.id}, my_address().preload_uint(11) == 1024);`); } @@ -96,14 +96,14 @@ export function writeInit(t: TypeDescription, init: InitDescription, ctx: Writer ctx.flag('impure'); ctx.body(() => { // Unpack args - for (let a of init.args) { + for (const a of init.args) { if (!resolveFuncPrimitive(a.type, ctx)) { ctx.append(`var (${resolveFuncTypeUnpack(a.type, id(a.name), ctx)}) = ${id(a.name)};`); } } // Generate self initial tensor - let initValues: string[] = []; + const initValues: string[] = []; for (let i = 0; i < t.fields.length; i++) { let init = 'null()'; if (t.fields[i].default !== undefined) { @@ -118,8 +118,8 @@ export function writeInit(t: TypeDescription, init: InitDescription, ctx: Writer } // Generate statements - let returns = resolveFuncTypeUnpack(t, id('self'), ctx); - for (let s of init.ast.statements) { + const returns = resolveFuncTypeUnpack(t, id('self'), ctx); + for (const s of init.ast.statements) { writeStatement(s, returns, null, ctx); } @@ -150,7 +150,7 @@ export function writeInit(t: TypeDescription, init: InitDescription, ctx: Writer `); // Copy contracts code - for (let c of t.dependsOn) { + for (const c of t.dependsOn) { ctx.append(); ctx.write(` ;; Contract Code: ${c.name} @@ -165,7 +165,7 @@ export function writeInit(t: TypeDescription, init: InitDescription, ctx: Writer ctx.append(`builder b = begin_cell();`); ctx.append(`b = b.store_ref(begin_cell().store_dict(contracts).end_cell());`); ctx.append(`b = b.store_int(false, 1);`); - let args = t.init!.args.length > 0 ? ['b', '(' + t.init!.args.map((a) => id(a.name)).join(', ') + ')'].join(', ') : 'b, null()'; + const args = t.init!.args.length > 0 ? ['b', '(' + t.init!.args.map((a) => id(a.name)).join(', ') + ')'].join(', ') : 'b, null()'; ctx.append(`b = ${ops.writer(initId(t.name), ctx)}(${args});`); ctx.append(`return (mine, b.end_cell());`); }); @@ -184,7 +184,7 @@ export function writeMainContract(type: TypeDescription, abiLink: string, ctx: W ctx.append(``); // Write receivers - for (let r of Object.values(type.receivers)) { + for (const r of Object.values(type.receivers)) { writeReceiver(type, r, ctx); } @@ -195,7 +195,7 @@ export function writeMainContract(type: TypeDescription, abiLink: string, ctx: W ctx.append(``); // Getters - for (let f of type.functions.values()) { + for (const f of type.functions.values()) { if (f.isGetter) { writeGetter(f, ctx) } diff --git a/src/generator/writers/writeExpression.spec.ts b/src/generator/writers/writeExpression.spec.ts index b0149bb02..8353045cc 100644 --- a/src/generator/writers/writeExpression.spec.ts +++ b/src/generator/writers/writeExpression.spec.ts @@ -72,7 +72,7 @@ describe('writeExpression', () => { let ctx = openContext(new CompilerContext(), [{ code: code, path: '', origin: 'user' }], []); ctx = resolveDescriptors(ctx); ctx = resolveStatements(ctx); - let main = getStaticFunction(ctx, 'main'); + const main = getStaticFunction(ctx, 'main'); if (main.ast.kind !== 'def_function') { throw Error('Unexpected function kind'); } @@ -81,7 +81,7 @@ describe('writeExpression', () => { if (s.kind !== 'statement_let') { throw Error('Unexpected statement kind'); } - let wctx = new WriterContext(ctx, 'Contract1'); + const wctx = new WriterContext(ctx, 'Contract1'); wctx.fun('$main', () => { wctx.body(() => { expect(writeExpression(s.expression, wctx)).toBe(golden[i]); diff --git a/src/generator/writers/writeExpression.ts b/src/generator/writers/writeExpression.ts index a8b70305c..e0eff15b5 100644 --- a/src/generator/writers/writeExpression.ts +++ b/src/generator/writers/writeExpression.ts @@ -27,7 +27,7 @@ function tryExtractPath(f: ASTExpression): string[] | null { return [f.value]; } if (f.kind === 'op_field') { - let p = tryExtractPath(f.src); + const p = tryExtractPath(f.src); if (p) { return [...p, f.name]; } else { @@ -40,8 +40,8 @@ function tryExtractPath(f: ASTExpression): string[] | null { function writeStructConstructor(type: TypeDescription, args: string[], ctx: WriterContext) { // Check for duplicates - let name = ops.typeContsturctor(type.name, args, ctx); - let renderKey = '$constructor$' + type.name + '$' + args.join(','); + const name = ops.typeContsturctor(type.name, args, ctx); + const renderKey = '$constructor$' + type.name + '$' + args.join(','); if (ctx.isRendered(renderKey)) { return name; } @@ -55,8 +55,8 @@ function writeStructConstructor(type: TypeDescription, args: string[], ctx: Writ ctx.context('type:' + type.name); ctx.body(() => { // Create expressions - let expressions = type.fields.map((v) => { - let arg = args.find((v2) => v2 === v.name); + const expressions = type.fields.map((v) => { + const arg = args.find((v2) => v2 === v.name); if (arg) { return arg; } else if (v.default !== undefined) { @@ -77,7 +77,7 @@ export function writeValue(s: bigint | string | boolean | Address | Cell | null, return s.toString(10); } if (typeof s === 'string') { - let id = writeString(s, ctx); + const id = writeString(s, ctx); ctx.used(id); return `${id}()`; } @@ -85,12 +85,12 @@ export function writeValue(s: bigint | string | boolean | Address | Cell | null, return s ? 'true' : 'false'; } if (Address.isAddress(s)) { - let res = writeAddress(s, ctx); + const res = writeAddress(s, ctx); ctx.used(res); return res + '()'; } if (s instanceof Cell) { - let res = writeCell(s, ctx); + const res = writeCell(s, ctx); ctx.used(res); return `${res}()`; } @@ -106,7 +106,7 @@ export function writeExpression(f: ASTExpression, ctx: WriterContext): string { // Try intrinsics // - let intrinsic = tryExpressionIntrinsics(f, ctx); + const intrinsic = tryExpressionIntrinsics(f, ctx); if (intrinsic) { return intrinsic; } @@ -132,7 +132,7 @@ export function writeExpression(f: ASTExpression, ctx: WriterContext): string { // if (f.kind === 'string') { - let id = writeString(f.value, ctx); + const id = writeString(f.value, ctx); ctx.used(id); return `${id}()`; } @@ -150,18 +150,18 @@ export function writeExpression(f: ASTExpression, ctx: WriterContext): string { // if (f.kind === 'id') { - let t = getExpType(ctx.ctx, f); + const t = getExpType(ctx.ctx, f); // Handle packed type if (t.kind === 'ref') { - let tt = getType(ctx.ctx, t.name); + const tt = getType(ctx.ctx, t.name); if (tt.kind === 'contract' || tt.kind === 'struct') { return resolveFuncTypeUnpack(t, id(f.value), ctx); } } if (t.kind === 'ref_bounced') { - let tt = getType(ctx.ctx, t.name); + const tt = getType(ctx.ctx, t.name); if (tt.kind === 'struct') { return resolveFuncTypeUnpack(t, id(f.value), ctx, false, true); } @@ -169,7 +169,7 @@ export function writeExpression(f: ASTExpression, ctx: WriterContext): string { // Handle constant if (hasStaticConstant(ctx.ctx, f.value)) { - let c = getStaticConstant(ctx.ctx, f.value); + const c = getStaticConstant(ctx.ctx, f.value); return writeValue(c.value!, ctx); } @@ -207,8 +207,8 @@ export function writeExpression(f: ASTExpression, ctx: WriterContext): string { } // Special case for address - let lt = getExpType(ctx.ctx, f.left); - let rt = getExpType(ctx.ctx, f.right); + const lt = getExpType(ctx.ctx, f.left); + const rt = getExpType(ctx.ctx, f.right); // Case for addresses equality if ( @@ -244,7 +244,7 @@ export function writeExpression(f: ASTExpression, ctx: WriterContext): string { lt.name === 'Cell' && rt.name === 'Cell' ) { - let op = f.op === '==' ? 'eq' : 'neq'; + const op = f.op === '==' ? 'eq' : 'neq'; if (lt.optional && rt.optional) { ctx.used(`__tact_cell_${op}_nullable`); return `__tact_cell_${op}_nullable(${writeExpression(f.left, ctx)}, ${writeExpression(f.right, ctx)})`; @@ -268,7 +268,7 @@ export function writeExpression(f: ASTExpression, ctx: WriterContext): string { lt.name === rt.name && (lt.name === 'Slice' || lt.name === 'String') ) { - let op = f.op === '==' ? 'eq' : 'neq'; + const op = f.op === '==' ? 'eq' : 'neq'; if (lt.optional && rt.optional) { ctx.used(`__tact_slice_${op}_nullable`); return `__tact_slice_${op}_nullable(${writeExpression(f.left, ctx)}, ${writeExpression(f.right, ctx)})`; @@ -287,7 +287,7 @@ export function writeExpression(f: ASTExpression, ctx: WriterContext): string { // Case for maps eqality if (lt.kind === 'map' && rt.kind === 'map') { - let op = f.op === '==' ? 'eq' : 'neq'; + const op = f.op === '==' ? 'eq' : 'neq'; ctx.used(`__tact_cell_${op}_nullable`); return `__tact_cell_${op}_nullable(${writeExpression(f.left, ctx)}, ${writeExpression(f.right, ctx)})`; } @@ -298,14 +298,14 @@ export function writeExpression(f: ASTExpression, ctx: WriterContext): string { || (lt.name !== 'Int' && lt.name !== 'Bool') || (rt.name !== 'Int' && rt.name !== 'Bool') ) { - let file = f.ref.file; - let line, column = f.ref.interval.getLineAndColumn(); - throw Error(`(Internal Compiler Error) Invalid types for binary operation: ${file}:${line}:${column}`); // Should be unreachable + const file = f.ref.file; + const loc_info = f.ref.interval.getLineAndColumn(); + throw Error(`(Internal Compiler Error) Invalid types for binary operation: ${file}:${loc_info.lineNum}:${loc_info.colNum}`); // Should be unreachable } // Case for ints equality if (f.op === '==' || f.op === '!=') { - let op = f.op === '==' ? 'eq' : 'neq'; + const op = f.op === '==' ? 'eq' : 'neq'; if (lt.optional && rt.optional) { ctx.used(`__tact_int_${op}_nullable`); return `__tact_int_${op}_nullable(${writeExpression(f.left, ctx)}, ${writeExpression(f.right, ctx)})`; @@ -391,9 +391,9 @@ export function writeExpression(f: ASTExpression, ctx: WriterContext): string { // NOTE: Assert function that ensures that the value is not null if (f.op === '!!') { - let t = getExpType(ctx.ctx, f.right); + const t = getExpType(ctx.ctx, f.right); if (t.kind === 'ref') { - let tt = getType(ctx.ctx, t.name); + const tt = getType(ctx.ctx, t.name); if (tt.kind === 'struct') { return `${ops.typeNotNull(tt.name, ctx)}(${writeExpression(f.right, ctx)})`; } @@ -414,11 +414,11 @@ export function writeExpression(f: ASTExpression, ctx: WriterContext): string { if (f.kind === 'op_field') { // Resolve the type of the expression - let src = getExpType(ctx.ctx, f.src); + const src = getExpType(ctx.ctx, f.src); if (src === null || ((src.kind !== 'ref' || src.optional) && (src.kind !== 'ref_bounced'))) { throwError(`Cannot access field of non-struct type: ${printTypeRef(src)}`, f.ref); } - let srcT = getType(ctx.ctx, src.name); + const srcT = getType(ctx.ctx, src.name); // Resolve field let fields: FieldDescription[]; @@ -428,8 +428,8 @@ export function writeExpression(f: ASTExpression, ctx: WriterContext): string { fields = fields.slice(0, srcT.partialFieldCount); } - let field = fields.find((v) => v.name === f.name)!; - let cst = srcT.constants.find((v) => v.name === f.name)!; + const field = fields.find((v) => v.name === f.name)!; + const cst = srcT.constants.find((v) => v.name === f.name)!; if (!field && !cst) { throwError(`Cannot find field "${f.name}" in struct "${srcT.name}"`, f.ref); } @@ -437,18 +437,18 @@ export function writeExpression(f: ASTExpression, ctx: WriterContext): string { if (field) { // Trying to resolve field as a path - let path = tryExtractPath(f); + const path = tryExtractPath(f); if (path) { // Prepare path - let convertedPath: string[] = []; + const convertedPath: string[] = []; convertedPath.push(id(path[0])); convertedPath.push(...path.slice(1)); - let idd = convertedPath.join(`'`); + const idd = convertedPath.join(`'`); // Special case for structs if (field.type.kind === 'ref') { - let ft = getType(ctx.ctx, field.type.name); + const ft = getType(ctx.ctx, field.type.name); if (ft.kind === 'struct' || ft.kind === 'contract') { return resolveFuncTypeUnpack(field.type, idd, ctx); } @@ -478,7 +478,7 @@ export function writeExpression(f: ASTExpression, ctx: WriterContext): string { f.ref); } - let sf = getStaticFunction(ctx.ctx, f.name); + const sf = getStaticFunction(ctx.ctx, f.name); let n = ops.global(f.name); if (sf.ast.kind === 'def_native_function') { n = sf.ast.nativeName; @@ -496,14 +496,14 @@ export function writeExpression(f: ASTExpression, ctx: WriterContext): string { // if (f.kind === 'op_new') { - let src = getType(ctx.ctx, f.type); + const src = getType(ctx.ctx, f.type); // Write a constructor - let id = writeStructConstructor(src, f.args.map((v) => v.name), ctx); + const id = writeStructConstructor(src, f.args.map((v) => v.name), ctx); ctx.used(id); // Write an expression - let expressions = f.args.map((v) => writeCastedExpression(v.exp, src.fields.find((v2) => v2.name === v.name)!.type, ctx), ctx); + const expressions = f.args.map((v) => writeCastedExpression(v.exp, src.fields.find((v2) => v2.name === v.name)!.type, ctx), ctx); return `${id}(${expressions.join(', ')})`; } @@ -514,7 +514,7 @@ export function writeExpression(f: ASTExpression, ctx: WriterContext): string { if (f.kind === 'op_call') { // Resolve source type - let src = getExpType(ctx.ctx, f.src); + const src = getExpType(ctx.ctx, f.src); if (src === null) { throwError(`Cannot call function of non - direct type: ${printTypeRef(src)} `, f.ref); } @@ -527,18 +527,18 @@ export function writeExpression(f: ASTExpression, ctx: WriterContext): string { } // Render function call - let t = getType(ctx.ctx, src.name); + const t = getType(ctx.ctx, src.name); // Check struct ABI if (t.kind === 'struct') { - let abi = StructFunctions[f.name]; + const abi = StructFunctions[f.name]; if (abi) { return abi.generate(ctx, [src, ...f.args.map((v) => getExpType(ctx.ctx, v))], [f.src, ...f.args], f.ref); } } // Resolve function - let ff = t.functions.get(f.name)!; + const ff = t.functions.get(f.name)!; let name = ops.extension(src.name, f.name); if (ff.ast.kind === 'def_function') { ctx.used(name); @@ -556,9 +556,9 @@ export function writeExpression(f: ASTExpression, ctx: WriterContext): string { // func would convert (int) type to just int and break mutating functions if (ff.isMutating) { if (f.args.length === 1) { - let t = getExpType(ctx.ctx, f.args[0]); + const t = getExpType(ctx.ctx, f.args[0]); if (t.kind === 'ref') { - let tt = getType(ctx.ctx, t.name); + const tt = getType(ctx.ctx, t.name); if ((tt.kind === 'contract' || tt.kind === 'struct') && (ff.args[0].type.kind === 'ref') && (!ff.args[0].type.optional)) { renderedArguments = [`${ops.typeTensorCast(tt.name, ctx)}(${renderedArguments[0]})`]; } @@ -567,7 +567,7 @@ export function writeExpression(f: ASTExpression, ctx: WriterContext): string { } // Render - let s = writeExpression(f.src, ctx); + const s = writeExpression(f.src, ctx); if (ff.isMutating) { return `${s}~${name}(${renderedArguments.join(', ')})`; } else { @@ -577,7 +577,7 @@ export function writeExpression(f: ASTExpression, ctx: WriterContext): string { // Map types if (src.kind === 'map') { - let abf = MapFunctions[f.name]; + const abf = MapFunctions[f.name]; if (!abf) { throwError(`Map function "${f.name}" not found`, f.ref); } @@ -596,7 +596,7 @@ export function writeExpression(f: ASTExpression, ctx: WriterContext): string { // if (f.kind === 'init_of') { - let type = getType(ctx.ctx, f.name); + const type = getType(ctx.ctx, f.name); return `${ops.contractInitChild(f.name, ctx)}(${['__tact_context_sys', ...f.args.map((a, i) => writeCastedExpression(a, type.init!.args[i].type, ctx))].join(', ')})`; } diff --git a/src/generator/writers/writeFunction.ts b/src/generator/writers/writeFunction.ts index 945d8af8d..7bcfdc4ff 100644 --- a/src/generator/writers/writeFunction.ts +++ b/src/generator/writers/writeFunction.ts @@ -8,20 +8,20 @@ import { WriterContext } from "../Writer"; import { resolveFuncPrimitive } from "./resolveFuncPrimitive"; import { resolveFuncType } from "./resolveFuncType"; import { resolveFuncTypeUnpack } from "./resolveFuncTypeUnpack"; -import { fn, id } from "./id"; +import { id } from "./id"; import { writeExpression } from "./writeExpression"; import { cast } from "./cast"; import { resolveFuncTupledType } from "./resolveFuncTupledType"; import { ops } from "./ops"; export function writeCastedExpression(expression: ASTExpression, to: TypeRef, ctx: WriterContext) { - let expr = getExpType(ctx.ctx, expression); + const expr = getExpType(ctx.ctx, expression); return cast(expr, to, writeExpression(expression, ctx), ctx); // Cast for nullable } export function unwrapExternal(targetName: string, sourceName: string, type: TypeRef, ctx: WriterContext) { if (type.kind === 'ref') { - let t = getType(ctx.ctx, type.name); + const t = getType(ctx.ctx, type.name); if (t.kind === 'struct') { if (type.optional) { ctx.append(`${resolveFuncType(type, ctx)} ${targetName} = ${ops.typeFromOptTuple(t.name, ctx)}(${sourceName});`); @@ -46,7 +46,7 @@ export function writeStatement(f: ASTStatement, self: string | null, returns: Ty if (f.expression) { // Format expression - let result = writeCastedExpression(f.expression, returns!, ctx); + const result = writeCastedExpression(f.expression, returns!, ctx); // Return if (self) { @@ -65,9 +65,9 @@ export function writeStatement(f: ASTStatement, self: string | null, returns: Ty } else if (f.kind === 'statement_let') { // Contract/struct case - let t = resolveTypeRef(ctx.ctx, f.type); + const t = resolveTypeRef(ctx.ctx, f.type); if (t.kind === 'ref') { - let tt = getType(ctx.ctx, t.name); + const tt = getType(ctx.ctx, t.name); if (tt.kind === 'contract' || tt.kind === 'struct') { if (t.optional) { ctx.append(`tuple ${id(f.name)} = ${writeCastedExpression(f.expression, t, ctx)};`); @@ -83,12 +83,12 @@ export function writeStatement(f: ASTStatement, self: string | null, returns: Ty } else if (f.kind === 'statement_assign') { // Prepare lvalue - let path = f.path.map((v, i) => (i === 0) ? id(v.name) : v.name).join(`'`); + const path = f.path.map((v, i) => (i === 0) ? id(v.name) : v.name).join(`'`); // Contract/struct case - let t = getExpType(ctx.ctx, f.path[f.path.length - 1]); + const t = getExpType(ctx.ctx, f.path[f.path.length - 1]); if (t.kind === 'ref') { - let tt = getType(ctx.ctx, t.name); + const tt = getType(ctx.ctx, t.name); if (tt.kind === 'contract' || tt.kind === 'struct') { ctx.append(`${resolveFuncTypeUnpack(t, `${path}`, ctx)} = ${writeCastedExpression(f.expression, t, ctx)};`); return; @@ -98,21 +98,21 @@ export function writeStatement(f: ASTStatement, self: string | null, returns: Ty ctx.append(`${path} = ${writeCastedExpression(f.expression, t, ctx)};`); return; } else if (f.kind === 'statement_augmentedassign') { - let path = f.path.map((v, i) => (i === 0) ? id(v.name) : v.name).join(`'`); - let t = getExpType(ctx.ctx, f.path[f.path.length - 1]); + const path = f.path.map((v, i) => (i === 0) ? id(v.name) : v.name).join(`'`); + const t = getExpType(ctx.ctx, f.path[f.path.length - 1]); ctx.append(`${path} = ${cast(t, t, `${path} ${f.op} ${writeExpression(f.expression, ctx)}`, ctx)};`); return; } else if (f.kind === 'statement_condition') { writeCondition(f, self, false, returns, ctx); return; } else if (f.kind === 'statement_expression') { - let exp = writeExpression(f.expression, ctx); + const exp = writeExpression(f.expression, ctx); ctx.append(`${exp};`); return; } else if (f.kind === 'statement_while') { ctx.append(`while (${writeExpression(f.condition, ctx)}) {`); ctx.inIndent(() => { - for (let s of f.statements) { + for (const s of f.statements) { writeStatement(s, self, returns, ctx); } }); @@ -121,7 +121,7 @@ export function writeStatement(f: ASTStatement, self: string | null, returns: Ty } else if (f.kind === 'statement_until') { ctx.append(`do {`); ctx.inIndent(() => { - for (let s of f.statements) { + for (const s of f.statements) { writeStatement(s, self, returns, ctx); } }); @@ -130,7 +130,7 @@ export function writeStatement(f: ASTStatement, self: string | null, returns: Ty } else if (f.kind === 'statement_repeat') { ctx.append(`repeat (${writeExpression(f.condition, ctx)}) {`); ctx.inIndent(() => { - for (let s of f.statements) { + for (const s of f.statements) { writeStatement(s, self, returns, ctx); } }); @@ -144,14 +144,14 @@ export function writeStatement(f: ASTStatement, self: string | null, returns: Ty function writeCondition(f: ASTCondition, self: string | null, elseif: boolean, returns: TypeRef | null, ctx: WriterContext) { ctx.append(`${(elseif ? '} else' : '')}if (${writeExpression(f.expression, ctx)}) {`); ctx.inIndent(() => { - for (let s of f.trueStatements) { + for (const s of f.trueStatements) { writeStatement(s, self, returns, ctx); } }); if (f.falseStatements && f.falseStatements.length > 0) { ctx.append(`} else {`); ctx.inIndent(() => { - for (let s of f.falseStatements!) { + for (const s of f.falseStatements!) { writeStatement(s, self, returns, ctx); } }); @@ -172,7 +172,7 @@ export function writeFunction(f: FunctionDescription, ctx: WriterContext) { const fd = f.ast; // Resolve self - let self = f.self ? getType(ctx.ctx, f.self) : null; + const self = f.self ? getType(ctx.ctx, f.self) : null; // Write function header let returns: string = resolveFuncType(f.returns, ctx); @@ -187,12 +187,12 @@ export function writeFunction(f: FunctionDescription, ctx: WriterContext) { } // Resolve function descriptor - let name = self ? ops.extension(self.name, f.name) : ops.global(f.name); - let args: string[] = []; + const name = self ? ops.extension(self.name, f.name) : ops.global(f.name); + const args: string[] = []; if (self) { args.push(resolveFuncType(self, ctx) + ' ' + id('self')); } - for (let a of f.args) { + for (const a of f.args) { args.push(resolveFuncType(a.type, ctx) + ' ' + id(a.name)); } @@ -211,14 +211,14 @@ export function writeFunction(f: FunctionDescription, ctx: WriterContext) { if (self) { ctx.append(`var (${resolveFuncTypeUnpack(self, id('self'), ctx)}) = ${id('self')};`); } - for (let a of fd.args) { + for (const a of fd.args) { if (!resolveFuncPrimitive(resolveTypeRef(ctx.ctx, a.type), ctx)) { ctx.append(`var (${resolveFuncTypeUnpack(resolveTypeRef(ctx.ctx, a.type), id(a.name), ctx)}) = ${id(a.name)};`); } } // Process statements - for (let s of fd.statements!) { + for (const s of fd.statements!) { writeStatement(s, returnsStr, f.returns, ctx); } @@ -243,7 +243,7 @@ export function writeGetter(f: FunctionDescription, ctx: WriterContext) { ctx.inIndent(() => { // Unpack arguments - for (let arg of f.args) { + for (const arg of f.args) { unwrapExternal(id(arg.name), id('$' + arg.name), arg.type, ctx); } @@ -255,7 +255,7 @@ export function writeGetter(f: FunctionDescription, ctx: WriterContext) { // Pack if needed if (f.returns.kind === 'ref') { - let t = getType(ctx.ctx, f.returns.name); + const t = getType(ctx.ctx, f.returns.name); if (t.kind === 'struct') { if (f.returns.optional) { ctx.append(`return ${ops.typeToOptExternal(t.name, ctx)}(res);`); diff --git a/src/generator/writers/writeInterfaces.ts b/src/generator/writers/writeInterfaces.ts index 0d33e4e87..b39a1bb88 100644 --- a/src/generator/writers/writeInterfaces.ts +++ b/src/generator/writers/writeInterfaces.ts @@ -1,4 +1,4 @@ -import { getSupportedIntefaces } from "../../types/getSupportedInterfaces"; +import { getSupportedInterfaces } from "../../types/getSupportedInterfaces"; import { TypeDescription } from "../../types/types"; import { WriterContext } from "../Writer"; @@ -9,9 +9,9 @@ export function writeInterfaces(type: TypeDescription, ctx: WriterContext) { ctx.inIndent(() => { // Build interfaces list - let interfaces: string[] = []; + const interfaces: string[] = []; interfaces.push('org.ton.introspection.v0'); - interfaces.push(...getSupportedIntefaces(type, ctx.ctx)); + interfaces.push(...getSupportedInterfaces(type, ctx.ctx)); // Render interfaces for (let i = 0; i < interfaces.length; i++) { diff --git a/src/generator/writers/writeRouter.ts b/src/generator/writers/writeRouter.ts index 89908667e..e45ae9c81 100644 --- a/src/generator/writers/writeRouter.ts +++ b/src/generator/writers/writeRouter.ts @@ -1,6 +1,6 @@ import { beginCell } from "@ton/core"; -import { getType, resolveTypeRef, toBounced } from "../../types/resolveDescriptors"; -import { ReceiverDescription, ReceiverSelector, TypeDescription } from "../../types/types"; +import { getType } from "../../types/resolveDescriptors"; +import { ReceiverDescription, TypeDescription } from "../../types/types"; import { WriterContext } from "../Writer"; import { id } from "./id"; import { ops } from "./ops"; @@ -52,7 +52,7 @@ export function writeRouter(type: TypeDescription, kind: 'internal' | 'external' for (const r of bounceReceivers) { const selector = r.selector; if (selector.kind !== "bounce-binary") throw Error('Invalid selector type: ' + selector.kind); // Should not happen - let allocation = getType(ctx.ctx, selector.type); + const allocation = getType(ctx.ctx, selector.type); if (!allocation) throw Error('Invalid allocation: ' + selector.type); // Should not happen ctx.append(`;; Bounced handler for ${selector.type} message`); @@ -107,7 +107,7 @@ export function writeRouter(type: TypeDescription, kind: 'internal' | 'external' // Generic receiver if (selector.kind === (internal ? 'internal-binary' : 'external-binary')) { - let allocation = getType(ctx.ctx, selector.type); + const allocation = getType(ctx.ctx, selector.type); if (!allocation.header) { throw Error('Invalid allocation: ' + selector.type); } @@ -145,18 +145,18 @@ export function writeRouter(type: TypeDescription, kind: 'internal' | 'external' } // Text resolvers - let hasComments = !!type.receivers.find((v) => internal ? (v.selector.kind === 'internal-comment' || v.selector.kind === 'internal-comment-fallback') : (v.selector.kind === 'external-comment' || v.selector.kind === 'external-comment-fallback')); + const hasComments = !!type.receivers.find((v) => internal ? (v.selector.kind === 'internal-comment' || v.selector.kind === 'internal-comment-fallback') : (v.selector.kind === 'external-comment' || v.selector.kind === 'external-comment-fallback')); if (hasComments) { ctx.append(); ctx.append(`;; Text Receivers`); ctx.append(`if (op == 0) {`); ctx.inIndent(() => { - if (!!type.receivers.find((v) => v.selector.kind === (internal ? 'internal-comment' : 'external-comment'))) { + if (type.receivers.find((v) => v.selector.kind === (internal ? 'internal-comment' : 'external-comment'))) { ctx.append(`var text_op = slice_hash(in_msg);`); for (const r of type.receivers) { const selector = r.selector; if (selector.kind === (internal ? 'internal-comment' : 'external-comment')) { - let hash = beginCell() + const hash = beginCell() .storeUint(0, 32) .storeBuffer(Buffer.from(selector.comment, 'utf8')) .endCell() @@ -179,7 +179,7 @@ export function writeRouter(type: TypeDescription, kind: 'internal' | 'external' } // Comment fallback resolver - let fallback = type.receivers.find((v) => v.selector.kind === (internal ? 'internal-comment-fallback' : 'external-comment-fallback')); + const fallback = type.receivers.find((v) => v.selector.kind === (internal ? 'internal-comment-fallback' : 'external-comment-fallback')); if (fallback) { ctx.append(`if (slice_bits(in_msg) >= 32) {`); @@ -199,7 +199,7 @@ export function writeRouter(type: TypeDescription, kind: 'internal' | 'external' } // Fallback - let fallbackReceiver = type.receivers.find((v) => v.selector.kind === (internal ? 'internal-fallback' : 'external-fallback')); + const fallbackReceiver = type.receivers.find((v) => v.selector.kind === (internal ? 'internal-fallback' : 'external-fallback')); if (fallbackReceiver) { ctx.append(); @@ -220,13 +220,13 @@ export function writeRouter(type: TypeDescription, kind: 'internal' | 'external' export function writeReceiver(self: TypeDescription, f: ReceiverDescription, ctx: WriterContext) { const selector = f.selector; - let selfRes = resolveFuncTypeUnpack(self, id('self'), ctx); - let selfType = resolveFuncType(self, ctx); - let selfUnpack = `var ${resolveFuncTypeUnpack(self, id('self'), ctx)} = ${id('self')};`; + const selfRes = resolveFuncTypeUnpack(self, id('self'), ctx); + const selfType = resolveFuncType(self, ctx); + const selfUnpack = `var ${resolveFuncTypeUnpack(self, id('self'), ctx)} = ${id('self')};`; // Binary receiver if (selector.kind === 'internal-binary' || selector.kind === 'external-binary') { - let args = [ + const args = [ selfType + ' ' + id('self'), resolveFuncType(selector.type, ctx) + ' ' + id(selector.name) ]; @@ -235,7 +235,7 @@ export function writeReceiver(self: TypeDescription, f: ReceiverDescription, ctx ctx.append(selfUnpack); ctx.append(`var ${resolveFuncTypeUnpack(selector.type, id(selector.name), ctx)} = ${id(selector.name)};`); - for (let s of f.ast.statements) { + for (const s of f.ast.statements) { writeStatement(s, selfRes, null, ctx); } @@ -254,7 +254,7 @@ export function writeReceiver(self: TypeDescription, f: ReceiverDescription, ctx ctx.inIndent(() => { ctx.append(selfUnpack); - for (let s of f.ast.statements) { + for (const s of f.ast.statements) { writeStatement(s, selfRes, null, ctx); } @@ -269,7 +269,7 @@ export function writeReceiver(self: TypeDescription, f: ReceiverDescription, ctx // Comment receiver if (selector.kind === 'internal-comment' || selector.kind === 'external-comment') { - let hash = beginCell() + const hash = beginCell() .storeUint(0, 32) .storeBuffer(Buffer.from(selector.comment, 'utf8')) .endCell() @@ -279,7 +279,7 @@ export function writeReceiver(self: TypeDescription, f: ReceiverDescription, ctx ctx.inIndent(() => { ctx.append(selfUnpack); - for (let s of f.ast.statements) { + for (const s of f.ast.statements) { writeStatement(s, selfRes, null, ctx); } @@ -299,7 +299,7 @@ export function writeReceiver(self: TypeDescription, f: ReceiverDescription, ctx ctx.inIndent(() => { ctx.append(selfUnpack); - for (let s of f.ast.statements) { + for (const s of f.ast.statements) { writeStatement(s, selfRes, null, ctx); } @@ -318,7 +318,7 @@ export function writeReceiver(self: TypeDescription, f: ReceiverDescription, ctx ctx.inIndent(() => { ctx.append(selfUnpack); - for (let s of f.ast.statements) { + for (const s of f.ast.statements) { writeStatement(s, selfRes, null, ctx); } @@ -337,7 +337,7 @@ export function writeReceiver(self: TypeDescription, f: ReceiverDescription, ctx ctx.inIndent(() => { ctx.append(selfUnpack); - for (let s of f.ast.statements) { + for (const s of f.ast.statements) { writeStatement(s, selfRes, null, ctx); } @@ -351,7 +351,7 @@ export function writeReceiver(self: TypeDescription, f: ReceiverDescription, ctx } if (selector.kind === 'bounce-binary') { - let args = [ + const args = [ selfType + ' ' + id('self'), resolveFuncType(selector.type, ctx, false, selector.bounced) + ' ' + id(selector.name) ]; @@ -360,7 +360,7 @@ export function writeReceiver(self: TypeDescription, f: ReceiverDescription, ctx ctx.append(selfUnpack); ctx.append(`var ${resolveFuncTypeUnpack(selector.type, id(selector.name), ctx, false, selector.bounced)} = ${id(selector.name)};`); - for (let s of f.ast.statements) { + for (const s of f.ast.statements) { writeStatement(s, selfRes, null, ctx); } diff --git a/src/generator/writers/writeSerialization.spec.ts b/src/generator/writers/writeSerialization.spec.ts index da5b23ece..c65926ea4 100644 --- a/src/generator/writers/writeSerialization.spec.ts +++ b/src/generator/writers/writeSerialization.spec.ts @@ -52,21 +52,21 @@ describe('writeSerialization', () => { beforeEach(() => { __DANGER_resetNodeId(); }); - for (let s of ['A', 'B', 'C']) { + for (const s of ['A', 'B', 'C']) { it('should write serializer for ' + s, () => { let ctx = openContext(new CompilerContext(), [{ code, path: '', origin: 'user' }], []); ctx = resolveDescriptors(ctx); ctx = resolveAllocations(ctx); - let wctx = new WriterContext(ctx, s); + const wctx = new WriterContext(ctx, s); writeStdlib(wctx); writeSerializer(getType(ctx, s).name, false, getAllocation(ctx, s), 'user', wctx); - for (let t of Object.values(getAllTypes(ctx))) { + for (const t of Object.values(getAllTypes(ctx))) { if (t.kind === 'contract' || t.kind === 'struct') { writeAccessors(t, 'user', wctx); } } writeParser(getType(ctx, s).name, false, getAllocation(ctx, s), 'user', wctx); - let extracted = wctx.extract(true); + const extracted = wctx.extract(true); expect(extracted).toMatchSnapshot(); }); } diff --git a/src/generator/writers/writeSerialization.ts b/src/generator/writers/writeSerialization.ts index eb97b4338..8a3d05ac7 100644 --- a/src/generator/writers/writeSerialization.ts +++ b/src/generator/writers/writeSerialization.ts @@ -15,7 +15,7 @@ const SMALL_STRUCT_MAX_FIELDS = 5; // export function writeSerializer(name: string, forceInline: boolean, allocation: StorageAllocation, origin: TypeOrigin, ctx: WriterContext) { - let isSmall = allocation.ops.length <= SMALL_STRUCT_MAX_FIELDS; + const isSmall = allocation.ops.length <= SMALL_STRUCT_MAX_FIELDS; // Write to builder ctx.fun(ops.writer(name, ctx), () => { @@ -66,7 +66,7 @@ export function writeOptionalSerializer(name: string, origin: TypeOrigin, ctx: W function writeSerializerCell(cell: AllocationCell, gen: number, ctx: WriterContext) { // Write fields - for (let f of cell.ops) { + for (const f of cell.ops) { writeSerializerField(f, gen, ctx); } @@ -202,7 +202,7 @@ function writeSerializerField(f: AllocationOperation, gen: number, ctx: WriterCo if (op.optional) { ctx.append(`build_${gen} = ~ null?(${fieldName}) ? build_${gen}.store_int(true, 1).${ops.writer(op.type, ctx)}(${ops.typeNotNull(op.type, ctx)}(${fieldName})) : build_${gen}.store_int(false, 1);`); } else { - let ff = getType(ctx.ctx, op.type).fields.map((f) => f.abi); + const ff = getType(ctx.ctx, op.type).fields.map((f) => f.abi); ctx.append(`build_${gen} = ${ops.writer(op.type, ctx)}(build_${gen}, ${resolveFuncTypeFromAbiUnpack(fieldName, ff, ctx)});`); } return; @@ -216,7 +216,7 @@ function writeSerializerField(f: AllocationOperation, gen: number, ctx: WriterCo // export function writeParser(name: string, forceInline: boolean, allocation: StorageAllocation, origin: TypeOrigin, ctx: WriterContext) { - let isSmall = allocation.ops.length <= SMALL_STRUCT_MAX_FIELDS; + const isSmall = allocation.ops.length <= SMALL_STRUCT_MAX_FIELDS; ctx.fun(ops.reader(name, ctx), () => { ctx.signature(`(slice, (${resolveFuncTypeFromAbi(allocation.ops.map((v) => v.type), ctx)})) ${ops.reader(name, ctx)}(slice sc_0)`); @@ -245,7 +245,7 @@ export function writeParser(name: string, forceInline: boolean, allocation: Stor } export function writeBouncedParser(name: string, forceInline: boolean, allocation: StorageAllocation, origin: TypeOrigin, ctx: WriterContext) { - let isSmall = allocation.ops.length <= SMALL_STRUCT_MAX_FIELDS; + const isSmall = allocation.ops.length <= SMALL_STRUCT_MAX_FIELDS; ctx.fun(ops.readerBounced(name, ctx), () => { ctx.signature(`(slice, (${resolveFuncTypeFromAbi(allocation.ops.map((v) => v.type), ctx)})) ${ops.readerBounced(name, ctx)}(slice sc_0)`); @@ -293,7 +293,7 @@ export function writeOptionalParser(name: string, origin: TypeOrigin, ctx: Write function writeCellParser(cell: AllocationCell, gen: number, ctx: WriterContext): number { // Write current fields - for (let f of cell.ops) { + for (const f of cell.ops) { writeFieldParser(f, gen, ctx); } diff --git a/src/generator/writers/writeStdlib.ts b/src/generator/writers/writeStdlib.ts index 439bb06cf..c1b2c6096 100644 --- a/src/generator/writers/writeStdlib.ts +++ b/src/generator/writers/writeStdlib.ts @@ -1,5 +1,5 @@ import { contractErrors } from "../../abi/errors"; -import { enabledMaterchain } from "../../config/features"; +import { enabledMasterchain } from "../../config/features"; import { WriterContext } from "../Writer"; export function writeStdlib(ctx: WriterContext) { @@ -28,7 +28,7 @@ export function writeStdlib(ctx: WriterContext) { var h = address.preload_uint(11); `); - if (enabledMaterchain(ctx.ctx)) { + if (enabledMasterchain(ctx.ctx)) { ctx.write(` throw_unless(${contractErrors.invalidAddress.id}, (h == 1024) | (h == 1279)); `); @@ -984,7 +984,7 @@ export function writeStdlib(ctx: WriterContext) { for (let i = 1; i < 64; i++) { ctx.fun(`__tact_tuple_create_${i}`, () => { - let args: string[] = []; + const args: string[] = []; for (let j = 0; j < i; j++) { args.push(`X${j}`); } @@ -993,7 +993,7 @@ export function writeStdlib(ctx: WriterContext) { ctx.asm(`asm "${i} TUPLE"`); }); ctx.fun(`__tact_tuple_destroy_${i}`, () => { - let args: string[] = []; + const args: string[] = []; for (let j = 0; j < i; j++) { args.push(`X${j}`); } diff --git a/src/grammar/ast.ts b/src/grammar/ast.ts index dfc75103f..ad3e278bc 100644 --- a/src/grammar/ast.ts +++ b/src/grammar/ast.ts @@ -9,7 +9,7 @@ export class ASTRef { throw Error('Cannot merge 0 refs'); } let r = refs[0].#interval; - let file = refs[0].#file; + const file = refs[0].#file; for (let i = 1; i < refs.length; i++) { r = r.coverageWith(r, refs[i].#interval); } @@ -436,6 +436,7 @@ export type ASTNode = ASTExpression | ASTProgram | ASTStruct | ASTField | ASTCon export type ASTExpression = ASTOpBinary | ASTOpUnary | ASTOpField | ASTNumber | ASTID | ASTBoolean | ASTOpCall | ASTOpCallStatic | ASTOpNew | ASTNull | ASTLvalueRef | ASTInitOf | ASTString | ASTConditional; export type ASTType = ASTPrimitive | ASTStruct | ASTContract | ASTTrait; +// eslint-disable-next-line @typescript-eslint/no-explicit-any type DistributiveOmit = T extends any ? Omit : never; @@ -455,7 +456,7 @@ let currentFile: string | null = null; export function inFile(path: string, callback: () => T) { currentFile = path; - let r = callback(); + const r = callback(); currentFile = null; return r; } @@ -470,7 +471,7 @@ export function createRef(s: RawNode, ...extra: RawNode[]): ASTRef { export function throwError(message: string, ref: ASTRef): never { if (ref.file) { - let lc = (ref.interval as any).getLineAndColumn() as { lineNum: number, colNum: number }; + const lc = ref.interval.getLineAndColumn() as { lineNum: number, colNum: number }; throw new TactSyntaxError(ref.file + ':' + lc.lineNum + ':' + lc.colNum + ': ' + message + '\n' + ref.interval.getLineAndColumnMessage(), ref); } else { throw new TactSyntaxError(message + ref.interval.getLineAndColumnMessage(), ref); @@ -485,22 +486,22 @@ export function traverse(node: ASTNode, callback: (node: ASTNode) => void) { // if (node.kind === 'program') { - for (let e of node.entries) { + for (const e of node.entries) { traverse(e, callback); } } if (node.kind === 'def_contract') { - for (let e of node.declarations) { + for (const e of node.declarations) { traverse(e, callback); } } if (node.kind === 'def_struct') { - for (let e of node.fields) { + for (const e of node.fields) { traverse(e, callback); } } if (node.kind === 'def_trait') { - for (let e of node.declarations) { + for (const e of node.declarations) { traverse(e, callback); } } @@ -510,30 +511,30 @@ export function traverse(node: ASTNode, callback: (node: ASTNode) => void) { // if (node.kind === 'def_function') { - for (let e of node.args) { + for (const e of node.args) { traverse(e, callback); } if (node.statements) { - for (let e of node.statements) { + for (const e of node.statements) { traverse(e, callback); } } } if (node.kind === 'def_init_function') { - for (let e of node.args) { + for (const e of node.args) { traverse(e, callback); } - for (let e of node.statements) { + for (const e of node.statements) { traverse(e, callback); } } if (node.kind === 'def_receive') { - for (let e of node.statements) { + for (const e of node.statements) { traverse(e, callback); } } if (node.kind === 'def_native_function') { - for (let e of node.args) { + for (const e of node.args) { traverse(e, callback); } } @@ -565,24 +566,24 @@ export function traverse(node: ASTNode, callback: (node: ASTNode) => void) { traverse(node.expression, callback); } if (node.kind === 'statement_assign') { - for (let e of node.path) { + for (const e of node.path) { traverse(e, callback); } traverse(node.expression, callback); } if (node.kind === 'statement_augmentedassign') { - for (let e of node.path) { + for (const e of node.path) { traverse(e, callback); } traverse(node.expression, callback); } if (node.kind === 'statement_condition') { traverse(node.expression, callback); - for (let e of node.trueStatements) { + for (const e of node.trueStatements) { traverse(e, callback); } if (node.falseStatements) { - for (let e of node.falseStatements) { + for (const e of node.falseStatements) { traverse(e, callback); } } @@ -592,19 +593,19 @@ export function traverse(node: ASTNode, callback: (node: ASTNode) => void) { } if (node.kind === 'statement_while') { traverse(node.condition, callback); - for (let e of node.statements) { + for (const e of node.statements) { traverse(e, callback); } } if (node.kind === 'statement_until') { traverse(node.condition, callback); - for (let e of node.statements) { + for (const e of node.statements) { traverse(e, callback); } } if (node.kind === 'statement_repeat') { traverse(node.condition, callback); - for (let e of node.statements) { + for (const e of node.statements) { traverse(e, callback); } } @@ -620,17 +621,17 @@ export function traverse(node: ASTNode, callback: (node: ASTNode) => void) { } if (node.kind === 'op_call') { traverse(node.src, callback); - for (let e of node.args) { + for (const e of node.args) { traverse(e, callback); } } if (node.kind === 'op_static_call') { - for (let e of node.args) { + for (const e of node.args) { traverse(e, callback); } } if (node.kind === 'op_new') { - for (let e of node.args) { + for (const e of node.args) { traverse(e, callback); } } diff --git a/src/grammar/checkConstAttributes.ts b/src/grammar/checkConstAttributes.ts index 9f3a36729..5e1d45b17 100644 --- a/src/grammar/checkConstAttributes.ts +++ b/src/grammar/checkConstAttributes.ts @@ -1,8 +1,8 @@ import { ASTConstantAttribute, ASTRef, throwError } from "./ast"; export function checkConstAttributes(isAbstract: boolean, attributes: ASTConstantAttribute[], ref: ASTRef) { - let k = new Set(); - for (let a of attributes) { + const k = new Set(); + for (const a of attributes) { if (k.has(a.type)) { throwError(`Duplicate function attribute ${a.type}`, a.ref); } diff --git a/src/grammar/checkFunctionAttributes.ts b/src/grammar/checkFunctionAttributes.ts index 37ac4fa9d..7dd339e10 100644 --- a/src/grammar/checkFunctionAttributes.ts +++ b/src/grammar/checkFunctionAttributes.ts @@ -1,8 +1,8 @@ import { ASTFunctionAttribute, ASTRef, throwError } from "./ast"; export function checkFunctionAttributes(isAbstract: boolean, attrs: ASTFunctionAttribute[], ref: ASTRef) { - let k = new Set(); - for (let a of attrs) { + const k = new Set(); + for (const a of attrs) { if (k.has(a.type)) { throwError(`Duplicate function attribute ${a.type}`, a.ref); } diff --git a/src/grammar/clone.ts b/src/grammar/clone.ts index f967dc685..a8a452cf2 100644 --- a/src/grammar/clone.ts +++ b/src/grammar/clone.ts @@ -1,4 +1,4 @@ -import { ASTNode, cloneASTNode, createNode } from "./ast"; +import { ASTNode, cloneASTNode } from "./ast"; export function cloneNode(src: T): T { if (src.kind === 'boolean') { diff --git a/src/grammar/grammar.spec.ts b/src/grammar/grammar.spec.ts index 64029e489..04c62d32d 100644 --- a/src/grammar/grammar.spec.ts +++ b/src/grammar/grammar.spec.ts @@ -13,13 +13,13 @@ describe('grammar', () => { __DANGER_resetNodeId(); }); - for (let r of loadCases(__dirname + "/test/")) { + for (const r of loadCases(__dirname + "/test/")) { it('should parse ' + r.name, () => { expect(parse(r.code, '', 'user')).toMatchSnapshot(); }); } - for (let r of loadCases(__dirname + "/test-failed/")) { + for (const r of loadCases(__dirname + "/test-failed/")) { it('should fail ' + r.name, () => { expect(() => parse(r.code, '', 'user')).toThrowErrorMatchingSnapshot(); }); diff --git a/src/grammar/grammar.ts b/src/grammar/grammar.ts index 0aac5826b..e5d62213f 100644 --- a/src/grammar/grammar.ts +++ b/src/grammar/grammar.ts @@ -24,8 +24,8 @@ semantics.addOperation('resolve_program', { // Resolve program items semantics.addOperation('resolve_program_item', { - ProgramImport(arg0, arg1, arg2) { - let pp = arg1.resolve_expression() as ASTString; + ProgramImport(_arg0, arg1, _arg2) { + const pp = arg1.resolve_expression() as ASTString; if (pp.value.indexOf('\\') >= 0) { throwError('Import path can\'t contain "\\"', createRef(arg1)); } @@ -35,7 +35,7 @@ semantics.addOperation('resolve_program_item', { ref: createRef(this) }); }, - Primitive(arg0, arg1, arg2) { + Primitive(_arg0, arg1, _arg2) { checkVariableName(arg1.sourceString, createRef(arg1)); return createNode({ kind: 'primitive', @@ -44,7 +44,7 @@ semantics.addOperation('resolve_program_item', { ref: createRef(this) }); }, - Struct_originary(arg0, arg1, arg2, arg3, arg4) { + Struct_originary(_arg0, arg1, _arg2, arg3, _arg4) { checkVariableName(arg1.sourceString, createRef(arg1)); return createNode({ kind: 'def_struct', @@ -56,7 +56,7 @@ semantics.addOperation('resolve_program_item', { ref: createRef(this) }) }, - Struct_message(arg0, arg1, arg2, arg3, arg4) { + Struct_message(_arg0, arg1, _arg2, arg3, _arg4) { checkVariableName(arg1.sourceString, createRef(arg1)); return createNode({ kind: 'def_struct', @@ -68,7 +68,7 @@ semantics.addOperation('resolve_program_item', { ref: createRef(this) }) }, - Struct_messageWithId(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) { + Struct_messageWithId(_arg0, arg1, arg2, _arg3, arg4, _arg5, arg6, _arg7) { checkVariableName(arg1.sourceString, createRef(arg1)); return createNode({ kind: 'def_struct', @@ -80,51 +80,51 @@ semantics.addOperation('resolve_program_item', { ref: createRef(this) }) }, - Contract_simple(arg0, arg1, arg2, arg3, arg4, arg5) { + Contract_simple(arg0, _arg1, arg2, _arg3, arg4, _arg5) { checkVariableName(arg2.sourceString, createRef(arg2)); return createNode({ kind: 'def_contract', origin: ctx!.origin, name: arg2.sourceString, - attributes: arg0.children.map((v: any) => v.resolve_contract_attributes()), + attributes: arg0.children.map((v) => v.resolve_contract_attributes()), declarations: arg4.children.map((v) => v.resolve_declaration()), traits: [], ref: createRef(this) }) }, - Contract_withTraits(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) { + Contract_withTraits(arg0, _arg1, arg2, _arg3, arg4, _arg5, arg6, _arg7) { checkVariableName(arg2.sourceString, createRef(arg2)); return createNode({ kind: 'def_contract', origin: ctx!.origin, name: arg2.sourceString, - attributes: arg0.children.map((v: any) => v.resolve_contract_attributes()), + attributes: arg0.children.map((v) => v.resolve_contract_attributes()), declarations: arg6.children.map((v) => v.resolve_declaration()), - traits: arg4.asIteration().children.map((v: any) => v.resolve_expression()), + traits: arg4.asIteration().children.map((v) => v.resolve_expression()), ref: createRef(this) }) }, - Trait_originary(arg0, arg1, arg2, arg3, arg4, arg5) { + Trait_originary(arg0, _arg1, arg2, _arg3, arg4, _arg5) { checkVariableName(arg2.sourceString, createRef(arg2)); return createNode({ kind: 'def_trait', origin: ctx!.origin, name: arg2.sourceString, - attributes: arg0.children.map((v: any) => v.resolve_contract_attributes()), + attributes: arg0.children.map((v) => v.resolve_contract_attributes()), declarations: arg4.children.map((v) => v.resolve_declaration()), traits: [], ref: createRef(this) }) }, - Trait_withTraits(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) { + Trait_withTraits(arg0, _arg1, arg2, _arg3, arg4, _arg5, arg6, _arg7) { checkVariableName(arg2.sourceString, createRef(arg2)); return createNode({ kind: 'def_trait', origin: ctx!.origin, name: arg2.sourceString, - attributes: arg0.children.map((v: any) => v.resolve_contract_attributes()), + attributes: arg0.children.map((v) => v.resolve_contract_attributes()), declarations: arg6.children.map((v) => v.resolve_declaration()), - traits: arg4.asIteration().children.map((v: any) => v.resolve_expression()), + traits: arg4.asIteration().children.map((v) => v.resolve_expression()), ref: createRef(this) }) }, @@ -134,8 +134,8 @@ semantics.addOperation('resolve_program_item', { NativeFunction(arg0) { return arg0.resolve_declaration(); }, - Constant_withValue(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) { - const attributes = arg0.children.map((v: any) => v.resolve_const_attributes()) as ASTConstantAttribute[]; + Constant_withValue(arg0, _arg1, arg2, _arg3, arg4, _arg5, arg6, _arg7) { + const attributes = arg0.children.map((v) => v.resolve_const_attributes()) as ASTConstantAttribute[]; checkConstAttributes(false, attributes, createRef(this)); return createNode({ kind: 'def_constant', @@ -146,8 +146,8 @@ semantics.addOperation('resolve_program_item', { ref: createRef(this) }) }, - Constant_withEmpty(arg0, arg1, arg2, arg3, arg4, arg5) { - const attributes = arg0.children.map((v: any) => v.resolve_const_attributes()) as ASTConstantAttribute[]; + Constant_withEmpty(arg0, _arg1, arg2, _arg3, arg4, _arg5) { + const attributes = arg0.children.map((v) => v.resolve_const_attributes()) as ASTConstantAttribute[]; checkConstAttributes(true, attributes, createRef(this)); return createNode({ kind: 'def_constant', @@ -162,52 +162,52 @@ semantics.addOperation('resolve_program_item', { // Resolve attributes semantics.addOperation('resolve_attributes', { - FunctionAttribute_getter(arg0) { + FunctionAttribute_getter(_arg0) { return { type: 'get', ref: createRef(this) }; }, - FunctionAttribute_extends(arg0) { + FunctionAttribute_extends(_arg0) { return { type: 'extends', ref: createRef(this) }; }, - FunctionAttribute_mutates(arg0) { + FunctionAttribute_mutates(_arg0) { return { type: 'mutates', ref: createRef(this) }; }, - FunctionAttribute_override(arg0) { + FunctionAttribute_override(_arg0) { return { type: 'overrides', ref: createRef(this) }; }, - FunctionAttribute_inline(arg0) { + FunctionAttribute_inline(_arg0) { return { type: 'inline', ref: createRef(this) }; }, - FunctionAttribute_virtual(arg0) { + FunctionAttribute_virtual(_arg0) { return { type: 'virtual', ref: createRef(this) }; }, - FunctionAttribute_abstract(arg0) { + FunctionAttribute_abstract(_arg0) { return { type: 'abstract', ref: createRef(this) }; }, }); // Resolve const attributes semantics.addOperation('resolve_const_attributes', { - ConstantAttribute_override(arg0) { + ConstantAttribute_override(_arg0) { return { type: 'overrides', ref: createRef(this) }; }, - ConstantAttribute_virtual(arg0) { + ConstantAttribute_virtual(_arg0) { return { type: 'virtual', ref: createRef(this) }; }, - ConstantAttribute_abstract(arg0) { + ConstantAttribute_abstract(_arg0) { return { type: 'abstract', ref: createRef(this) }; }, }); // Resolve contract semantics.addOperation('resolve_contract_attributes', { - ContractAttribute_interface(arg0, arg1, arg2, arg3) { + ContractAttribute_interface(_arg0, _arg1, arg2, _arg3) { return { type: 'interface', name: arg2.resolve_expression(), ref: createRef(this) }; } }); // Struct and class declarations semantics.addOperation('resolve_declaration', { - Field_default(arg0, arg1, arg2, arg3) { + Field_default(arg0, _arg1, arg2, _arg3) { return createNode({ kind: 'def_field', name: arg0.sourceString, @@ -217,8 +217,8 @@ semantics.addOperation('resolve_declaration', { ref: createRef(this) }) }, - Field_defaultWithInit(arg0, arg1, arg2, arg3, arg4, arg5) { - let tr = (arg2.resolve_expression() as ASTTypeRef); + Field_defaultWithInit(arg0, _arg1, arg2, _arg3, arg4, _arg5) { + const tr = (arg2.resolve_expression() as ASTTypeRef); return createNode({ kind: 'def_field', name: arg0.sourceString, @@ -228,7 +228,7 @@ semantics.addOperation('resolve_declaration', { ref: createRef(this) }) }, - Field_withSerialization(arg0, arg1, arg2, arg3, arg4, arg5) { + Field_withSerialization(arg0, _arg1, arg2, _arg3, arg4, _arg5) { return createNode({ kind: 'def_field', name: arg0.sourceString, @@ -238,8 +238,8 @@ semantics.addOperation('resolve_declaration', { ref: createRef(this) }) }, - Field_withSerializationAndInit(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) { - let tr = (arg2.resolve_expression() as ASTTypeRef); + Field_withSerializationAndInit(arg0, _arg1, arg2, _arg3, arg4, _arg5, arg6, _arg7) { + const tr = (arg2.resolve_expression() as ASTTypeRef); return createNode({ kind: 'def_field', name: arg0.sourceString, @@ -249,8 +249,8 @@ semantics.addOperation('resolve_declaration', { ref: createRef(this) }) }, - Constant_withValue(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) { - const attributes = arg0.children.map((v: any) => v.resolve_const_attributes()) as ASTConstantAttribute[]; + Constant_withValue(arg0, _arg1, arg2, _arg3, arg4, _arg5, arg6, _arg7) { + const attributes = arg0.children.map((v) => v.resolve_const_attributes()) as ASTConstantAttribute[]; checkConstAttributes(false, attributes, createRef(this)); return createNode({ kind: 'def_constant', @@ -261,8 +261,8 @@ semantics.addOperation('resolve_declaration', { ref: createRef(this) }) }, - Constant_withEmpty(arg0, arg1, arg2, arg3, arg4, arg5) { - const attributes = arg0.children.map((v: any) => v.resolve_const_attributes()) as ASTConstantAttribute[]; + Constant_withEmpty(arg0, _arg1, arg2, _arg3, arg4, _) { + const attributes = arg0.children.map((v) => v.resolve_const_attributes()) as ASTConstantAttribute[]; checkConstAttributes(true, attributes, createRef(this)); return createNode({ kind: 'def_constant', @@ -273,7 +273,7 @@ semantics.addOperation('resolve_declaration', { ref: createRef(this) }) }, - FunctionArg(arg0, arg1, arg2) { + FunctionArg(arg0, _arg1, arg2) { checkVariableName(arg0.sourceString, createRef(arg0)); return createNode({ kind: 'def_argument', @@ -282,8 +282,8 @@ semantics.addOperation('resolve_declaration', { ref: createRef(this) }) }, - Function_withType(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) { - let attributes = arg0.children.map((v: any) => v.resolve_attributes()) as ASTFunctionAttribute[]; + Function_withType(arg0, _arg1, arg2, _arg3, arg4, _arg5, _arg6, arg7, _arg8, arg9, _) { + const attributes = arg0.children.map((v) => v.resolve_attributes()) as ASTFunctionAttribute[]; checkVariableName(arg2.sourceString, createRef(arg2)); checkFunctionAttributes(false, attributes, createRef(this)); return createNode({ @@ -292,13 +292,13 @@ semantics.addOperation('resolve_declaration', { attributes, name: arg2.sourceString, return: arg7.resolve_expression(), - args: arg4.asIteration().children.map((v: any) => v.resolve_declaration()), - statements: arg9.children.map((v: any) => v.resolve_statement()), + args: arg4.asIteration().children.map((v) => v.resolve_declaration()), + statements: arg9.children.map((v) => v.resolve_statement()), ref: createRef(this) }) }, - Function_withVoid(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) { - let attributes = arg0.children.map((v: any) => v.resolve_attributes()) as ASTFunctionAttribute[]; + Function_withVoid(arg0, _arg1, arg2, _arg3, arg4, _arg5, _arg6, arg7, _) { + const attributes = arg0.children.map((v) => v.resolve_attributes()) as ASTFunctionAttribute[]; checkVariableName(arg2.sourceString, createRef(arg2)); checkFunctionAttributes(false, attributes, createRef(this)); return createNode({ @@ -307,13 +307,13 @@ semantics.addOperation('resolve_declaration', { attributes, name: arg2.sourceString, return: null, - args: arg4.asIteration().children.map((v: any) => v.resolve_declaration()), - statements: arg7.children.map((v: any) => v.resolve_statement()), + args: arg4.asIteration().children.map((v) => v.resolve_declaration()), + statements: arg7.children.map((v) => v.resolve_statement()), ref: createRef(this) }) }, - Function_abstractVoid(arg0, arg1, arg2, arg3, arg4, arg5, arg6) { - let attributes = arg0.children.map((v: any) => v.resolve_attributes()) as ASTFunctionAttribute[]; + Function_abstractVoid(arg0, _arg1, arg2, _arg3, arg4, _arg5, _arg6) { + const attributes = arg0.children.map((v) => v.resolve_attributes()) as ASTFunctionAttribute[]; checkVariableName(arg2.sourceString, createRef(arg2)); checkFunctionAttributes(true, attributes, createRef(this)); return createNode({ @@ -322,13 +322,13 @@ semantics.addOperation('resolve_declaration', { attributes, name: arg2.sourceString, return: null, - args: arg4.asIteration().children.map((v: any) => v.resolve_declaration()), + args: arg4.asIteration().children.map((v) => v.resolve_declaration()), statements: null, ref: createRef(this) }) }, - Function_abstractType(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) { - let attributes = arg0.children.map((v: any) => v.resolve_attributes()) as ASTFunctionAttribute[]; + Function_abstractType(arg0, _arg1, arg2, _arg3, arg4, _arg5, _arg6, arg7, _arg8) { + const attributes = arg0.children.map((v) => v.resolve_attributes()) as ASTFunctionAttribute[]; checkVariableName(arg2.sourceString, createRef(arg2)); checkFunctionAttributes(true, attributes, createRef(this)); return createNode({ @@ -337,90 +337,90 @@ semantics.addOperation('resolve_declaration', { attributes, name: arg2.sourceString, return: arg7.resolve_expression(), - args: arg4.asIteration().children.map((v: any) => v.resolve_declaration()), + args: arg4.asIteration().children.map((v) => v.resolve_declaration()), statements: null, ref: createRef(this) }) }, - NativeFunction_withType(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12) { + NativeFunction_withType(_arg0, _arg1, arg2, _arg3, arg4, arg5, arg6, _arg7, arg8, _arg9, _arg10, arg11, _arg12) { checkVariableName(arg5.sourceString, createRef(arg5)); return createNode({ kind: 'def_native_function', origin: ctx!.origin, - attributes: arg4.children.map((v: any) => v.resolve_attributes()), + attributes: arg4.children.map((v) => v.resolve_attributes()), name: arg6.sourceString, nativeName: arg2.sourceString, return: arg11.resolve_expression(), - args: arg8.asIteration().children.map((v: any) => v.resolve_declaration()), + args: arg8.asIteration().children.map((v) => v.resolve_declaration()), ref: createRef(this) }) }, - NativeFunction_withVoid(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) { + NativeFunction_withVoid(_arg0, _arg1, arg2, _arg3, arg4, arg5, arg6, _arg7, arg8, _arg9, _arg10) { checkVariableName(arg5.sourceString, createRef(arg5)); return createNode({ kind: 'def_native_function', origin: ctx!.origin, - attributes: arg4.children.map((v: any) => v.resolve_attributes()), + attributes: arg4.children.map((v) => v.resolve_attributes()), name: arg6.sourceString, nativeName: arg2.sourceString, return: null, - args: arg8.asIteration().children.map((v: any) => v.resolve_declaration()), + args: arg8.asIteration().children.map((v) => v.resolve_declaration()), ref: createRef(this) }) }, - ContractInit(arg0, arg1, arg2, arg3, arg4, arg5, arg6) { + ContractInit(_arg0, _arg1, arg2, _arg3, _arg4, arg5, _arg6) { return createNode({ kind: 'def_init_function', - args: arg2.asIteration().children.map((v: any) => v.resolve_declaration()), - statements: arg5.children.map((v: any) => v.resolve_statement()), + args: arg2.asIteration().children.map((v) => v.resolve_declaration()), + statements: arg5.children.map((v) => v.resolve_statement()), ref: createRef(this) }) }, - ReceiveFunction_simple(arg0, arg1, arg2, arg3, arg4, arg5, arg6) { + ReceiveFunction_simple(_arg0, _arg1, arg2, _arg3, _arg4, arg5, _arg6) { return createNode({ kind: 'def_receive', selector: { kind: 'internal-simple', arg: arg2.resolve_declaration() }, - statements: arg5.children.map((v: any) => v.resolve_statement()), + statements: arg5.children.map((v) => v.resolve_statement()), ref: createRef(this) }) }, - ReceiveFunction_empty(arg0, arg1, arg2, arg3, arg4, arg5) { + ReceiveFunction_empty(_arg0, _arg1, _arg2, _arg3, arg4, _arg5) { return createNode({ kind: 'def_receive', selector: { kind: 'internal-fallback' }, - statements: arg4.children.map((v: any) => v.resolve_statement()), + statements: arg4.children.map((v) => v.resolve_statement()), ref: createRef(this) }) }, - ReceiveFunction_comment(arg0, arg1, arg2, arg3, arg4, arg5, arg6) { + ReceiveFunction_comment(_arg0, _arg1, arg2, _arg3, _arg4, arg5, _arg6) { return createNode({ kind: 'def_receive', selector: { kind: 'internal-comment', comment: arg2.resolve_expression() }, - statements: arg5.children.map((v: any) => v.resolve_statement()), + statements: arg5.children.map((v) => v.resolve_statement()), ref: createRef(this) }) }, - ReceiveFunction_bounced(arg0, arg1, arg2, arg3, arg4, arg5, arg6) { + ReceiveFunction_bounced(_arg0, _arg1, arg2, _arg3, _arg4, arg5, _arg6) { return createNode({ kind: 'def_receive', selector: { kind: 'bounce', arg: arg2.resolve_declaration() }, - statements: arg5.children.map((v: any) => v.resolve_statement()), + statements: arg5.children.map((v) => v.resolve_statement()), ref: createRef(this) }) }, - ReceiveFunction_externalSimple(arg0, arg1, arg2, arg3, arg4, arg5, arg6) { + ReceiveFunction_externalSimple(_arg0, _arg1, arg2, _arg3, _arg4, arg5, _arg6) { return createNode({ kind: 'def_receive', selector: { kind: 'external-simple', arg: arg2.resolve_declaration() }, - statements: arg5.children.map((v: any) => v.resolve_statement()), + statements: arg5.children.map((v) => v.resolve_statement()), ref: createRef(this) }) }, - ReceiveFunction_externalComment(arg0, arg1, arg2, arg3, arg4, arg5, arg6) { + ReceiveFunction_externalComment(_arg0, _arg1, arg2, _arg3, _arg4, arg5, _arg6) { return createNode({ kind: 'def_receive', selector: { kind: 'external-comment', comment: arg2.resolve_expression() }, - statements: arg5.children.map((v: any) => v.resolve_statement()), + statements: arg5.children.map((v) => v.resolve_statement()), ref: createRef(this) }) }, @@ -428,7 +428,7 @@ semantics.addOperation('resolve_declaration', { // Statements semantics.addOperation('resolve_statement', { - StatementLet(arg0, arg1, arg2, arg3, arg4, arg5, arg6) { + StatementLet(_arg0, arg1, _arg2, arg3, _arg4, arg5, _arg6) { checkVariableName(arg1.sourceString, createRef(arg1)); return createNode({ @@ -439,28 +439,28 @@ semantics.addOperation('resolve_statement', { ref: createRef(this) }) }, - StatementReturn_withExpression(arg0, arg1, arg2) { + StatementReturn_withExpression(_arg0, arg1, _arg2) { return createNode({ kind: 'statement_return', expression: arg1.resolve_expression(), ref: createRef(this) }) }, - StatementReturn_withoutExpression(arg0, arg1) { + StatementReturn_withoutExpression(_arg0, _arg1) { return createNode({ kind: 'statement_return', expression: null, ref: createRef(this) }) }, - StatementExpression(arg0, arg1) { + StatementExpression(arg0, _arg1) { return createNode({ kind: 'statement_expression', expression: arg0.resolve_expression(), ref: createRef(this) }) }, - StatementAssign(arg0, arg1, arg2, arg3) { + StatementAssign(arg0, _arg1, arg2, _arg3) { return createNode({ kind: 'statement_assign', path: arg0.resolve_lvalue(), @@ -468,7 +468,7 @@ semantics.addOperation('resolve_statement', { ref: createRef(this) }) }, - StatementAugmentedAssignAdd(arg0, arg1, arg2, arg3) { + StatementAugmentedAssignAdd(arg0, _arg1, arg2, _arg3) { return createNode({ kind: 'statement_augmentedassign', path: arg0.resolve_lvalue(), @@ -477,7 +477,7 @@ semantics.addOperation('resolve_statement', { ref: createRef(this) }) }, - StatementAugmentedAssignSub(arg0, arg1, arg2, arg3) { + StatementAugmentedAssignSub(arg0, _arg1, arg2, _arg3) { return createNode({ kind: 'statement_augmentedassign', path: arg0.resolve_lvalue(), @@ -486,7 +486,7 @@ semantics.addOperation('resolve_statement', { ref: createRef(this) }) }, - StatementAugmentedAssignMul(arg0, arg1, arg2, arg3) { + StatementAugmentedAssignMul(arg0, _arg1, arg2, _arg3) { return createNode({ kind: 'statement_augmentedassign', path: arg0.resolve_lvalue(), @@ -495,7 +495,7 @@ semantics.addOperation('resolve_statement', { ref: createRef(this) }) }, - StatementAugmentedAssignDiv(arg0, arg1, arg2, arg3) { + StatementAugmentedAssignDiv(arg0, _arg1, arg2, _arg3) { return createNode({ kind: 'statement_augmentedassign', path: arg0.resolve_lvalue(), @@ -504,7 +504,7 @@ semantics.addOperation('resolve_statement', { ref: createRef(this) }) }, - StatementAugmentedAssignRem(arg0, arg1, arg2, arg3) { + StatementAugmentedAssignRem(arg0, _arg1, arg2, _arg3) { return createNode({ kind: 'statement_augmentedassign', path: arg0.resolve_lvalue(), @@ -513,57 +513,57 @@ semantics.addOperation('resolve_statement', { ref: createRef(this) }) }, - StatementCondition_simple(arg0, arg1, arg2, arg3, arg4) { + StatementCondition_simple(_arg0, arg1, _arg2, arg3, _arg4) { return createNode({ kind: 'statement_condition', expression: arg1.resolve_expression(), - trueStatements: arg3.children.map((v: any) => v.resolve_statement()), + trueStatements: arg3.children.map((v) => v.resolve_statement()), falseStatements: null, elseif: null, ref: createRef(this) }) }, - StatementCondition_withElse(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) { + StatementCondition_withElse(_arg0, arg1, _arg2, arg3, _arg4, _arg5, _arg6, arg7, _arg8) { return createNode({ kind: 'statement_condition', expression: arg1.resolve_expression(), - trueStatements: arg3.children.map((v: any) => v.resolve_statement()), - falseStatements: arg7.children.map((v: any) => v.resolve_statement()), + trueStatements: arg3.children.map((v) => v.resolve_statement()), + falseStatements: arg7.children.map((v) => v.resolve_statement()), elseif: null, ref: createRef(this) }) }, - StatementCondition_withElseIf(arg0, arg1, arg2, arg3, arg4, arg5, arg6) { + StatementCondition_withElseIf(_arg0, arg1, _arg2, arg3, _arg4, _arg5, arg6) { return createNode({ kind: 'statement_condition', expression: arg1.resolve_expression(), - trueStatements: arg3.children.map((v: any) => v.resolve_statement()), + trueStatements: arg3.children.map((v) => v.resolve_statement()), falseStatements: null, elseif: arg6.resolve_statement(), ref: createRef(this) }) }, - StatementWhile(arg0, arg1, arg2, arg3, arg4, arg5, arg6) { + StatementWhile(_arg0, _arg1, arg2, _arg3, _arg4, arg5, _arg6) { return createNode({ kind: 'statement_while', condition: arg2.resolve_expression(), - statements: arg5.children.map((v: any) => v.resolve_statement()), + statements: arg5.children.map((v) => v.resolve_statement()), ref: createRef(this) }) }, - StatementRepeat(arg0, arg1, arg2, arg3, arg4, arg5, arg6) { + StatementRepeat(_arg0, _arg1, arg2, _arg3, _arg4, arg5, _arg6) { return createNode({ kind: 'statement_repeat', condition: arg2.resolve_expression(), - statements: arg5.children.map((v: any) => v.resolve_statement()), + statements: arg5.children.map((v) => v.resolve_statement()), ref: createRef(this) }) }, - StatementUntil(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) { + StatementUntil(_arg0, _arg1, arg2, _arg3, _arg4, _arg5, arg6, _arg7, _arg8) { return createNode({ kind: 'statement_until', condition: arg6.resolve_expression(), - statements: arg2.children.map((v: any) => v.resolve_statement()), + statements: arg2.children.map((v) => v.resolve_statement()), ref: createRef(this) }) }, @@ -603,21 +603,21 @@ semantics.addOperation('resolve_expression', { funcId(arg0, arg1) { return createNode({ kind: 'id', value: arg0.sourceString + arg1.sourceString, ref: createRef(this) }); }, - null(arg0) { + null(_arg0) { return createNode({ kind: 'null', ref: createRef(this) }); }, - stringLiteral(arg0, arg1, arg2) { + stringLiteral(_arg0, arg1, _arg2) { return createNode({ kind: 'string', value: arg1.sourceString, ref: createRef(this) }); }, // TypeRefs - Type_optional(arg0, arg1) { + Type_optional(arg0, _arg1) { return createNode({ kind: 'type_ref_simple', name: arg0.sourceString, optional: true, ref: createRef(this) }); }, Type_required(arg0) { return createNode({ kind: 'type_ref_simple', name: arg0.sourceString, optional: false, ref: createRef(this) }); }, - Type_map(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) { + Type_map(_arg0, _arg1, arg2, _arg3, arg4, _arg5, arg6, _arg7, arg8, _arg9) { return createNode({ kind: 'type_ref_map', @@ -628,117 +628,118 @@ semantics.addOperation('resolve_expression', { ref: createRef(this) }); }, - Type_bounced(arg0, arg1, arg2, arg3) { + Type_bounced(_arg0, _arg1, arg2, _arg3) { return createNode({ kind: 'type_ref_bounced', name: arg2.sourceString, ref: createRef(this) }); }, // Binary - ExpressionAdd_add(arg0, arg1, arg2) { + ExpressionAdd_add(arg0, _arg1, arg2) { return createNode({ kind: 'op_binary', op: '+', left: arg0.resolve_expression(), right: arg2.resolve_expression(), ref: createRef(this) }); }, - ExpressionAdd_sub(arg0, arg1, arg2) { + ExpressionAdd_sub(arg0, _arg1, arg2) { return createNode({ kind: 'op_binary', op: '-', left: arg0.resolve_expression(), right: arg2.resolve_expression(), ref: createRef(this) }); }, - ExpressionMul_div(arg0, arg1, arg2) { + ExpressionMul_div(arg0, _arg1, arg2) { return createNode({ kind: 'op_binary', op: '/', left: arg0.resolve_expression(), right: arg2.resolve_expression(), ref: createRef(this) }); }, - ExpressionMul_mul(arg0, arg1, arg2) { + ExpressionMul_mul(arg0, _arg1, arg2) { return createNode({ kind: 'op_binary', op: '*', left: arg0.resolve_expression(), right: arg2.resolve_expression(), ref: createRef(this) }); }, - ExpressionMul_rem(arg0, arg1, arg2) { + ExpressionMul_rem(arg0, _arg1, arg2) { return createNode({ kind: 'op_binary', op: '%', left: arg0.resolve_expression(), right: arg2.resolve_expression(), ref: createRef(this) }); }, - ExpressionCompare_eq(arg0, arg1, arg2) { + ExpressionCompare_eq(arg0, _arg1, arg2) { return createNode({ kind: 'op_binary', op: '==', left: arg0.resolve_expression(), right: arg2.resolve_expression(), ref: createRef(this) }); }, - ExpressionCompare_not(arg0, arg1, arg2) { + ExpressionCompare_not(arg0, _arg1, arg2) { return createNode({ kind: 'op_binary', op: '!=', left: arg0.resolve_expression(), right: arg2.resolve_expression(), ref: createRef(this) }); }, - ExpressionCompare_gt(arg0, arg1, arg2) { + ExpressionCompare_gt(arg0, _arg1, arg2) { return createNode({ kind: 'op_binary', op: '>', left: arg0.resolve_expression(), right: arg2.resolve_expression(), ref: createRef(this) }); }, - ExpressionCompare_gte(arg0, arg1, arg2) { + ExpressionCompare_gte(arg0, _arg1, arg2) { return createNode({ kind: 'op_binary', op: '>=', left: arg0.resolve_expression(), right: arg2.resolve_expression(), ref: createRef(this) }); }, - ExpressionCompare_lt(arg0, arg1, arg2) { + ExpressionCompare_lt(arg0, _arg1, arg2) { return createNode({ kind: 'op_binary', op: '<', left: arg0.resolve_expression(), right: arg2.resolve_expression(), ref: createRef(this) }); }, - ExpressionCompare_lte(arg0, arg1, arg2) { + ExpressionCompare_lte(arg0, _arg1, arg2) { return createNode({ kind: 'op_binary', op: '<=', left: arg0.resolve_expression(), right: arg2.resolve_expression(), ref: createRef(this) }); }, - ExpressionOr_or(arg0, arg1, arg2) { + ExpressionOr_or(arg0, _arg1, arg2) { return createNode({ kind: 'op_binary', op: '||', left: arg0.resolve_expression(), right: arg2.resolve_expression(), ref: createRef(this) }); }, - ExpressionAnd_and(arg0, arg1, arg2) { + ExpressionAnd_and(arg0, _arg1, arg2) { return createNode({ kind: 'op_binary', op: '&&', left: arg0.resolve_expression(), right: arg2.resolve_expression(), ref: createRef(this) }); }, - ExpressionBinary_shr(arg0, arg1, arg2) { + ExpressionBinary_shr(arg0, _arg1, arg2) { return createNode({ kind: 'op_binary', op: '>>', left: arg0.resolve_expression(), right: arg2.resolve_expression(), ref: createRef(this) }); }, - ExpressionBinary_shl(arg0, arg1, arg2) { + ExpressionBinary_shl(arg0, _arg1, arg2) { return createNode({ kind: 'op_binary', op: '<<', left: arg0.resolve_expression(), right: arg2.resolve_expression(), ref: createRef(this) }); }, - ExpressionBinary_bin_and(arg0, arg1, arg2) { + ExpressionBinary_bin_and(arg0, _arg1, arg2) { return createNode({ kind: 'op_binary', op: '&', left: arg0.resolve_expression(), right: arg2.resolve_expression(), ref: createRef(this) }); }, - ExpressionBinary_bin_or(arg0, arg1, arg2) { + ExpressionBinary_bin_or(arg0, _arg1, arg2) { return createNode({ kind: 'op_binary', op: '|', left: arg0.resolve_expression(), right: arg2.resolve_expression(), ref: createRef(this) }); }, // Unary - ExpressionUnary_add(arg0, arg1) { + ExpressionUnary_add(_arg0, arg1) { return createNode({ kind: 'op_unary', op: '+', right: arg1.resolve_expression(), ref: createRef(this) }); }, - ExpressionUnary_neg(arg0, arg1) { + ExpressionUnary_neg(_arg0, arg1) { return createNode({ kind: 'op_unary', op: '-', right: arg1.resolve_expression(), ref: createRef(this) }); }, - ExpressionUnary_not(arg0, arg1) { + ExpressionUnary_not(_arg0, arg1) { return createNode({ kind: 'op_unary', op: '!', right: arg1.resolve_expression(), ref: createRef(this) }); }, - ExpressionBracket(arg0, arg1, arg2) { + ExpressionBracket(_arg0, arg1, _arg2) { return arg1.resolve_expression(); }, - ExpressionUnarySuffix_notNull(arg0, arg1) { + ExpressionUnarySuffix_notNull(arg0, _arg1) { return createNode({ kind: 'op_unary', op: '!!', right: arg0.resolve_expression(), ref: createRef(this) }); }, // Access - ExpressionField(arg0, arg1, arg2) { + ExpressionField(arg0, _arg1, arg2) { return createNode({ kind: 'op_field', src: arg0.resolve_expression(), name: arg2.sourceString, ref: createRef(this) }); }, - ExpressionCall(arg0, arg1, arg2, arg3, arg4, arg5) { - return createNode({ kind: 'op_call', src: arg0.resolve_expression(), name: arg2.sourceString, args: arg4.asIteration().children.map((v: any) => v.resolve_expression()), ref: createRef(this) }); + ExpressionCall(arg0, _arg1, arg2, _arg3, arg4, _arg5) { + return createNode({ kind: 'op_call', src: arg0.resolve_expression(), name: arg2.sourceString, args: arg4.asIteration().children.map((v) => v.resolve_expression()), ref: createRef(this) }); }, - ExpressionStaticCall(arg0, arg1, arg2, arg3) { - return createNode({ kind: 'op_static_call', name: arg0.sourceString, args: arg2.asIteration().children.map((v: any) => v.resolve_expression()), ref: createRef(this) }); + ExpressionStaticCall(arg0, _arg1, arg2, _arg3) { + return createNode({ kind: 'op_static_call', name: arg0.sourceString, args: arg2.asIteration().children.map((v) => v.resolve_expression()), ref: createRef(this) }); }, - ExpressionNew(arg0, arg1, arg2, arg3) { - return createNode({ kind: 'op_new', type: arg0.sourceString, args: arg2.asIteration().children.map((v: any) => v.resolve_expression()), ref: createRef(this) }); + ExpressionNew(arg0, _arg1, arg2, _arg3) { + return createNode({ kind: 'op_new', type: arg0.sourceString, args: arg2.asIteration().children.map((v) => v.resolve_expression()), ref: createRef(this) }); }, - NewParameter(arg0, arg1, arg2) { + NewParameter(arg0, _arg1, arg2) { return createNode({ kind: 'new_parameter', name: arg0.sourceString, exp: arg2.resolve_expression(), ref: createRef(this) }); }, - ExpressionInitOf(arg0, arg1, arg2, arg3, arg4) { - return createNode({ kind: 'init_of', name: arg1.sourceString, args: arg3.asIteration().children.map((v: any) => v.resolve_expression()), ref: createRef(this) }); + ExpressionInitOf(_arg0, arg1, _arg2, arg3, _arg4) { + return createNode({ kind: 'init_of', name: arg1.sourceString, args: arg3.asIteration().children.map((v) => v.resolve_expression()), ref: createRef(this) }); }, // Ternary conditional - ExpressionConditional_ternary(arg0, arg1, arg2, arg3, arg4) { + ExpressionConditional_ternary(arg0, _arg1, arg2, _arg3, arg4) { return createNode({ kind: 'conditional', condition: arg0.resolve_expression(), thenBranch: arg2.resolve_expression(), elseBranch: arg4.resolve_expression(), ref: createRef(this) }); }, }); function throwMatchError(matchResult: MatchResult, path: string): never { - let interval = (matchResult as any).getInterval(); - let lc = interval.getLineAndColumn() as { lineNum: number, colNum: number }; - let msg = interval.getLineAndColumnMessage(); - let message = path + ':' + lc.lineNum + ':' + lc.colNum + ': Syntax error: expected ' + (matchResult as any).getExpectedText() + ' \n' + msg; + const interval = matchResult.getInterval(); + const lc = interval.getLineAndColumn() as { lineNum: number, colNum: number }; + const msg = interval.getLineAndColumnMessage(); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const message = path + ':' + lc.lineNum + ':' + lc.colNum + ': Syntax error: expected ' + (matchResult as any).getExpectedText() + ' \n' + msg; throw new TactSyntaxError(message, new ASTRef(interval, path)); } export function parse(src: string, path: string, origin: TypeOrigin): ASTProgram { return inFile(path, () => { - let matchResult = rawGrammar.match(src); + const matchResult = rawGrammar.match(src); if (matchResult.failed()) { throwMatchError(matchResult, path); } @@ -752,10 +753,10 @@ export function parse(src: string, path: string, origin: TypeOrigin): ASTProgram } export function parseImports(src: string, path: string, origin: TypeOrigin): string[] { - let r = parse(src, path, origin); - let imports: string[] = []; + const r = parse(src, path, origin); + const imports: string[] = []; let hasExpression = false; - for (let e of r.entries) { + for (const e of r.entries) { if (e.kind === 'program_import') { if (hasExpression) { throwError('Import must be at the top of the file', e.ref); diff --git a/src/grammar/store.ts b/src/grammar/store.ts index 49bc9e568..fc1f95798 100644 --- a/src/grammar/store.ts +++ b/src/grammar/store.ts @@ -14,7 +14,7 @@ type ASTStore = { const store = createContextStore(); export function getRawAST(ctx: CompilerContext) { - let r = store.get(ctx, 'types'); + const r = store.get(ctx, 'types'); if (!r) { throw Error('No AST found in context'); } @@ -25,12 +25,12 @@ export function openContext(ctx: CompilerContext, sources: { code: string, path: string, origin: TypeOrigin }[], funcSources: { code: string, path: string }[] ) { - let asts = sources.map(source => parse(source.code, source.path, source.origin)); - let types: ASTType[] = []; - let functions: (ASTNativeFunction | ASTFunction)[] = []; - let constants: ASTConstant[] = []; - for (let a of asts) { - for (let e of a.entries) { + const asts = sources.map(source => parse(source.code, source.path, source.origin)); + const types: ASTType[] = []; + const functions: (ASTNativeFunction | ASTFunction)[] = []; + const constants: ASTConstant[] = []; + for (const a of asts) { + for (const e of a.entries) { if (e.kind === 'def_struct' || e.kind === 'def_contract' || e.kind === 'def_trait' || e.kind === 'primitive') { types.push(e); } else if (e.kind === 'def_function' || e.kind === 'def_native_function') { diff --git a/src/imports/parseImportPath.spec.ts b/src/imports/parseImportPath.spec.ts index 99442b89c..f5b1bc2c9 100644 --- a/src/imports/parseImportPath.spec.ts +++ b/src/imports/parseImportPath.spec.ts @@ -2,19 +2,19 @@ import { parseImportPath } from './parseImportPath'; describe('parseImportPath', () => { it('should reject non-relative imports', () => { - let res = parseImportPath('some_name'); + const res = parseImportPath('some_name'); expect(res).toBeNull(); }); it('should reject non-file imports', () => { - let res = parseImportPath('./some_name/'); + const res = parseImportPath('./some_name/'); expect(res).toBeNull(); }); it('should parse single imports', () => { - let res = parseImportPath('./import'); + const res = parseImportPath('./import'); expect(res).toMatchObject(['import']); }); it('should parse multiple imports', () => { - let res = parseImportPath('./import/second'); + const res = parseImportPath('./import/second'); expect(res).toMatchObject(['import', 'second']); }); }); \ No newline at end of file diff --git a/src/imports/parseImportPath.ts b/src/imports/parseImportPath.ts index 83b78a1e4..874154ad3 100644 --- a/src/imports/parseImportPath.ts +++ b/src/imports/parseImportPath.ts @@ -1,4 +1,3 @@ -import path from "path"; import normalize from "path-normalize"; export function parseImportPath(src: string) { diff --git a/src/imports/resolveImports.spec.ts b/src/imports/resolveImports.spec.ts index 01e4fcb63..8772f916d 100644 --- a/src/imports/resolveImports.spec.ts +++ b/src/imports/resolveImports.spec.ts @@ -4,9 +4,9 @@ import path from 'path'; describe('resolveImports', () => { it('should resolve imports', () => { - let project = createNodeFileSystem(path.resolve(__dirname, '__testdata', 'project')); - let stdlib = createNodeFileSystem(path.resolve(__dirname, '__testdata', 'stdlib')); - let resolved = resolveImports({ + const project = createNodeFileSystem(path.resolve(__dirname, '__testdata', 'project')); + const stdlib = createNodeFileSystem(path.resolve(__dirname, '__testdata', 'stdlib')); + const resolved = resolveImports({ project, stdlib, entrypoint: './main.tact' diff --git a/src/imports/resolveImports.ts b/src/imports/resolveImports.ts index e63b708a9..8f09f31f4 100644 --- a/src/imports/resolveImports.ts +++ b/src/imports/resolveImports.ts @@ -53,8 +53,8 @@ export function resolveImports(args: { entrypoint: string, project: VirtualFileS } // Load code - let vfs = resolved.source === 'project' ? args.project : args.stdlib; - let code: string = vfs.readFile(resolved.path).toString(); + const vfs = resolved.source === 'project' ? args.project : args.stdlib; + const code: string = vfs.readFile(resolved.path).toString(); // Add to imports if (resolved.kind === 'func') { @@ -73,7 +73,7 @@ export function resolveImports(args: { entrypoint: string, project: VirtualFileS processImports(stdlibTact, stdlibTactPath, 'stdlib'); processImports(code, codePath, 'user'); while (pending.length > 0) { - let p = pending.shift()!; + const p = pending.shift()!; importedTact.push(p); processImports(p.code, p.path, p.origin); } diff --git a/src/imports/resolveLibrary.ts b/src/imports/resolveLibrary.ts index 977886346..b0f24aae6 100644 --- a/src/imports/resolveLibrary.ts +++ b/src/imports/resolveLibrary.ts @@ -23,12 +23,12 @@ export function resolveLibrary(args: ResolveLibraryArgs): ResolveLibraryResult { // NOTE: We are handling stdlib resolving here, because we need to enforce the stdlib import before anything else // to avoid hijacking the stdlib imports if (args.name.startsWith('@stdlib/')) { - let libraryName = args.name.substring('@stdlib/'.length); - let libraryPath = parseImportPath('./' + libraryName + '.tact'); + const libraryName = args.name.substring('@stdlib/'.length); + const libraryPath = parseImportPath('./' + libraryName + '.tact'); if (!libraryPath) { return { ok: false }; } - let tactFile = args.stdlib.resolve('libs', ...libraryPath); + const tactFile = args.stdlib.resolve('libs', ...libraryPath); if (args.stdlib.exists(tactFile)) { return { ok: true, path: tactFile, source: 'stdlib', kind: 'tact' }; } else { @@ -48,21 +48,21 @@ export function resolveLibrary(args: ResolveLibraryArgs): ResolveLibraryResult { } else { return { ok: false }; } - let workingDirectory = args.path.slice(vfs.root.length); + const workingDirectory = args.path.slice(vfs.root.length); // Resolving relative file let importName = args.name; - let kind: 'tact' | 'func' = importName.endsWith('.fc') ? 'func' : 'tact'; + const kind: 'tact' | 'func' = importName.endsWith('.fc') ? 'func' : 'tact'; if (!importName.endsWith('.tact') && !importName.endsWith('.fc')) { importName = importName + '.tact'; } // Resolve import - let parsedImport = parseImportPath(importName); + const parsedImport = parseImportPath(importName); if (!parsedImport) { return { ok: false }; } - let resolvedPath = vfs.resolve(workingDirectory, '..', ...parsedImport); + const resolvedPath = vfs.resolve(workingDirectory, '..', ...parsedImport); if (vfs.exists(resolvedPath)) { return { ok: true, path: resolvedPath, source, kind }; } diff --git a/src/imports/stdlib.ts b/src/imports/stdlib.ts index 9f91e7f94..2431a8481 100644 --- a/src/imports/stdlib.ts +++ b/src/imports/stdlib.ts @@ -1,4 +1,4 @@ -let files: { [key: string]: string } = {}; +const files: { [key: string]: string } = {}; files['libs/config.tact'] = 'ZnVuIGdldENvbmZpZ0FkZHJlc3MoKTogQWRkcmVzcyB7CiAgICBsZXQgY2VsbDogQ2VsbCA9IGdldENvbmZpZ1BhcmFtKDApISE7CiAgICBsZXQgc2M6IFNsaWNlID0g' + 'Y2VsbC5iZWdpblBhcnNlKCk7CiAgICByZXR1cm4gbmV3QWRkcmVzcygtMSwgc2MubG9hZFVpbnQoMjU2KSk7Cn0KCmZ1biBnZXRFbGVjdG9yQWRkcmVzcygpOiBBZGRy' + diff --git a/src/node.ts b/src/node.ts index 465f2d1f6..b3e248c3e 100644 --- a/src/node.ts +++ b/src/node.ts @@ -8,8 +8,8 @@ import { consoleLogger } from './logger'; export async function run(args: { configPath: string, projectNames?: string[] }) { // Load config - let resolvedPath = path.resolve(args.configPath); - let rootPath = path.dirname(resolvedPath); + const resolvedPath = path.resolve(args.configPath); + const rootPath = path.dirname(resolvedPath); let config: Config; if (!fs.existsSync(resolvedPath)) { console.warn('Unable to find config file at ' + resolvedPath); @@ -28,7 +28,7 @@ export async function run(args: { configPath: string, projectNames?: string[] }) if (args.projectNames && args.projectNames.length > 0) { // Check that all proejct names are valid - for (let pp of args.projectNames) { + for (const pp of args.projectNames) { if (!projects.find((v) => v.name === pp)) { console.warn('Unable to find project ' + pp); return false; @@ -45,11 +45,11 @@ export async function run(args: { configPath: string, projectNames?: string[] }) // Compile let success = true; - let project = createNodeFileSystem(rootPath, false); - let stdlib = createNodeFileSystem(path.resolve(__dirname, '..', 'stdlib'), false); // Improves developer experience - for (let config of projects) { + const project = createNodeFileSystem(rootPath, false); + const stdlib = createNodeFileSystem(path.resolve(__dirname, '..', 'stdlib'), false); // Improves developer experience + for (const config of projects) { console.log('💼 Compiling project ' + config.name + '...'); - let built = await build({ config, project, stdlib, logger: consoleLogger }); + const built = await build({ config, project, stdlib, logger: consoleLogger }); success = success && built; } return success; diff --git a/src/packaging/packageCode.ts b/src/packaging/packageCode.ts index 46a2371aa..90fd712e1 100644 --- a/src/packaging/packageCode.ts +++ b/src/packaging/packageCode.ts @@ -1,6 +1,6 @@ import { fileFormat, PackageFileFormat } from "./fileFormat"; export function packageCode(pkg: PackageFileFormat) { - let parsed = fileFormat.parse(pkg); + const parsed = fileFormat.parse(pkg); return JSON.stringify(parsed); } \ No newline at end of file diff --git a/src/pipeline/build.ts b/src/pipeline/build.ts index fefd2af68..addc409c2 100644 --- a/src/pipeline/build.ts +++ b/src/pipeline/build.ts @@ -34,7 +34,7 @@ export async function build(args: { // Configure context let ctx: CompilerContext = new CompilerContext({ shared: {} }); - let cfg: string = JSON.stringify({ + const cfg: string = JSON.stringify({ entrypoint: config.path, options: (config.options || {}) }); @@ -68,7 +68,7 @@ export async function build(args: { // Compile contracts let ok = true; - let built: { + const built: { [key: string]: { codeBoc: Buffer, // codeFunc: string, @@ -77,13 +77,13 @@ export async function build(args: { abi: string } } = {}; - for (let contract of getContracts(ctx)) { - let pathAbi = project.resolve(config.output, config.name + '_' + contract + ".abi"); + for (const contract of getContracts(ctx)) { + const pathAbi = project.resolve(config.output, config.name + '_' + contract + ".abi"); - let pathCodeBoc = project.resolve(config.output, config.name + '_' + contract + ".code.boc"); - let pathCodeFif = project.resolve(config.output, config.name + '_' + contract + ".code.fif"); - let pathCodeFifDec = project.resolve(config.output, config.name + '_' + contract + ".code.rev.fif"); + const pathCodeBoc = project.resolve(config.output, config.name + '_' + contract + ".code.boc"); + const pathCodeFif = project.resolve(config.output, config.name + '_' + contract + ".code.fif"); + const pathCodeFifDec = project.resolve(config.output, config.name + '_' + contract + ".code.rev.fif"); let codeFc: { path: string, content: string }[]; let codeEntrypoint: string; @@ -91,9 +91,9 @@ export async function build(args: { logger.log(' > ' + contract + ': tact compiler'); let abi: string; try { - let res = await compile(ctx, contract, config.name + '_' + contract); - for (let files of res.output.files) { - let ffc = project.resolve(config.output, files.name); + const res = await compile(ctx, contract, config.name + '_' + contract); + for (const files of res.output.files) { + const ffc = project.resolve(config.output, files.name); project.writeFile(ffc, files.code); } project.writeFile(pathAbi, res.output.abi); @@ -111,11 +111,11 @@ export async function build(args: { logger.log(' > ' + contract + ': func compiler'); let codeBoc: Buffer; try { - let stdlibPath = stdlib.resolve('stdlib.fc'); - let stdlibCode = stdlib.readFile(stdlibPath).toString(); - let stdlibExPath = stdlib.resolve('stdlib_ex.fc'); - let stdlibExCode = stdlib.readFile(stdlibExPath).toString(); - let c = await funcCompile({ + const stdlibPath = stdlib.resolve('stdlib.fc'); + const stdlibCode = stdlib.readFile(stdlibPath).toString(); + const stdlibExPath = stdlib.resolve('stdlib_ex.fc'); + const stdlibExCode = stdlib.readFile(stdlibExPath).toString(); + const c = await funcCompile({ entries: [ stdlibPath, stdlibExPath, @@ -176,11 +176,11 @@ export async function build(args: { // Package logger.log(' > Packaging'); - let contracts = getContracts(ctx); - let packages: PackageFileFormat[] = []; - for (let contract of contracts) { + const contracts = getContracts(ctx); + const packages: PackageFileFormat[] = []; + for (const contract of contracts) { logger.log(' > ' + contract); - let artifacts = built[contract]; + const artifacts = built[contract]; if (!artifacts) { logger.error(' > ' + contract + ': no artifacts found'); return false; @@ -190,8 +190,8 @@ export async function build(args: { const depends = Dictionary.empty(Dictionary.Keys.Uint(16), Dictionary.Values.Cell()); const ct = getType(ctx, contract); depends.set(ct.uid, Cell.fromBoc(built[ct.name].codeBoc)[0]); // Mine - for (let c of ct.dependsOn) { - let cd = built[c.name]; + for (const c of ct.dependsOn) { + const cd = built[c.name]; if (!cd) { logger.error(' > ' + cd + ': no artifacts found'); return false; @@ -201,16 +201,16 @@ export async function build(args: { const systemCell = beginCell().storeDict(depends).endCell(); // Collect sources - let sources: { [key: string]: string } = {}; - let rawAst = getRawAST(ctx); - for (let source of [...rawAst.funcSources, ...rawAst.sources]) { + const sources: { [key: string]: string } = {}; + const rawAst = getRawAST(ctx); + for (const source of [...rawAst.funcSources, ...rawAst.sources]) { if (source.path.startsWith(project.root) && !source.path.startsWith(stdlib.root)) { sources[source.path.slice(project.root.length)] = Buffer.from(source.code).toString('base64'); } } // Package - let pkg: PackageFileFormat = { + const pkg: PackageFileFormat = { name: contract, abi: artifacts.abi, code: artifacts.codeBoc.toString('base64'), @@ -233,22 +233,22 @@ export async function build(args: { parameters: cfg } }; - let pkgData = packageCode(pkg); - let pathPkg = project.resolve(config.output, config.name + '_' + contract + ".pkg"); + const pkgData = packageCode(pkg); + const pathPkg = project.resolve(config.output, config.name + '_' + contract + ".pkg"); project.writeFile(pathPkg, pkgData); packages.push(pkg); } // Bindings logger.log(' > Bindings'); - for (let pkg of packages) { + for (const pkg of packages) { logger.log(' > ' + pkg.name); if (pkg.init.deployment.kind !== 'system-cell') { logger.error(' > ' + pkg.name + ': unsupported deployment kind ' + pkg.init.deployment.kind); return false; } try { - let bindingsServer = writeTypescript(JSON.parse(pkg.abi), { + const bindingsServer = writeTypescript(JSON.parse(pkg.abi), { code: pkg.code, prefix: pkg.init.prefix, system: pkg.init.deployment.system, @@ -264,11 +264,11 @@ export async function build(args: { // Reports logger.log(' > Reports'); - for (let pkg of packages) { + for (const pkg of packages) { logger.log(' > ' + pkg.name); try { - let report = writeReport(ctx, pkg); - let pathBindings = project.resolve(config.output, config.name + '_' + pkg.name + ".md"); + const report = writeReport(ctx, pkg); + const pathBindings = project.resolve(config.output, config.name + '_' + pkg.name + ".md"); project.writeFile(pathBindings, report); } catch (e) { logger.error('Report generation crashed'); diff --git a/src/pipeline/compile.ts b/src/pipeline/compile.ts index 548ad48a9..4c7ff7a88 100644 --- a/src/pipeline/compile.ts +++ b/src/pipeline/compile.ts @@ -3,8 +3,8 @@ import { createABI } from "../generator/createABI"; import { writeProgram } from "../generator/writeProgram"; export async function compile(ctx: CompilerContext, name: string, basename: string) { - let abi = createABI(ctx, name); - let output = await writeProgram(ctx, abi, basename); - let cOutput = output; + const abi = createABI(ctx, name); + const output = await writeProgram(ctx, abi, basename); + const cOutput = output; return { output: cOutput, ctx }; } \ No newline at end of file diff --git a/src/pipeline/precompile.ts b/src/pipeline/precompile.ts index b6946d579..23d217738 100644 --- a/src/pipeline/precompile.ts +++ b/src/pipeline/precompile.ts @@ -11,7 +11,7 @@ import { VirtualFileSystem } from "../vfs/VirtualFileSystem"; export function precompile(ctx: CompilerContext, project: VirtualFileSystem, stdlib: VirtualFileSystem, entrypoint: string) { // Load all sources - let imported = resolveImports({ entrypoint, project, stdlib }); + const imported = resolveImports({ entrypoint, project, stdlib }); // Perform initial compiler steps ctx = openContext(ctx, imported.tact, imported.func); diff --git a/src/storage/allocator.ts b/src/storage/allocator.ts index 88670e0d9..470fef44a 100644 --- a/src/storage/allocator.ts +++ b/src/storage/allocator.ts @@ -152,7 +152,7 @@ export function getAllocationOperationFromField(src: ABITypeRef, structLoader: ( } // Struct types - let size = structLoader(src.type); + const size = structLoader(src.type); if (src.format === 'ref') { return { kind: 'struct', type: src.type, ref: true, optional: src.optional ? src.optional : false, size }; } else if (src.format !== undefined && src.format !== null) { @@ -175,13 +175,13 @@ export function getAllocationOperationFromField(src: ABITypeRef, structLoader: ( function allocateSegment(ops: AllocationOperation[], bits: number, refs: number): AllocationCell { - let fields: AllocationOperation[] = []; + const fields: AllocationOperation[] = []; let next: AllocationCell | null = null; - let used: { bits: number, refs: number } = { bits: 0, refs: 0 }; + const used: { bits: number, refs: number } = { bits: 0, refs: 0 }; for (let i = 0; i < ops.length; i++) { - let op = ops[i]; - let size = getOperationSize(op.op); + const op = ops[i]; + const size = getOperationSize(op.op); // Check if we can fit this operation if (size.bits > bits || size.refs > refs) { diff --git a/src/storage/operation.ts b/src/storage/operation.ts index 81c217fcd..f1cc26644 100644 --- a/src/storage/operation.ts +++ b/src/storage/operation.ts @@ -1,5 +1,4 @@ import { ABITypeRef } from "@ton/core"; -import { TypeRef } from "../types/types"; export type AllocationCell = { ops: AllocationOperation[], diff --git a/src/storage/resolveAllocation.ts b/src/storage/resolveAllocation.ts index 415429883..67b0cb530 100644 --- a/src/storage/resolveAllocation.ts +++ b/src/storage/resolveAllocation.ts @@ -8,10 +8,10 @@ import { allocate, getAllocationOperationFromField } from "./allocator"; import { createABITypeRefFromTypeRef } from "../types/resolveABITypeRef"; import { initId } from "../generator/writers/id"; -let store = createContextStore(); +const store = createContextStore(); export function getAllocation(ctx: CompilerContext, name: string) { - let t = store.get(ctx, name); + const t = store.get(ctx, name); if (!t) { throw Error('Allocation for ' + name + ' not found'); } @@ -23,15 +23,15 @@ export function getAllocations(ctx: CompilerContext) { } export function getSortedTypes(ctx: CompilerContext) { - let types = Object.values(getAllTypes(ctx)).filter((v) => v.kind === 'struct' || v.kind === 'contract'); + const types = Object.values(getAllTypes(ctx)).filter((v) => v.kind === 'struct' || v.kind === 'contract'); let structs = types.filter(t => t.kind === 'struct'); - let refs = (src: TypeDescription) => { - let res: TypeDescription[] = [] - let t = new Set(); - for (let f of src.fields) { - let r = f.type; + const refs = (src: TypeDescription) => { + const res: TypeDescription[] = [] + const t = new Set(); + for (const f of src.fields) { + const r = f.type; if (r.kind === 'ref') { - let tp = getType(ctx, r.name); + const tp = getType(ctx, r.name); if (tp.kind === 'struct') { if (!t.has(tp.name)) { t.add(r.name); @@ -50,10 +50,10 @@ export function getSortedTypes(ctx: CompilerContext) { export function resolveAllocations(ctx: CompilerContext) { // Load topological order of structs and contracts - let types = getSortedTypes(ctx); + const types = getSortedTypes(ctx); // Generate allocations - for (let s of types) { + for (const s of types) { // Reserve bits let reserveBits = 0; @@ -70,9 +70,9 @@ export function resolveAllocations(ctx: CompilerContext) { } // Convert fields - let ops: AllocationOperation[] = []; - let partialOps: AllocationOperation[] = []; - for (let [i, f] of s.fields.entries()) { + const ops: AllocationOperation[] = []; + const partialOps: AllocationOperation[] = []; + for (const [i, f] of s.fields.entries()) { const op = { name: f.name, type: f.abi.type, @@ -85,11 +85,11 @@ export function resolveAllocations(ctx: CompilerContext) { } // Perform allocation - let root = allocate({ ops, reserved: { bits: reserveBits, refs: reserveRefs } }); - let partialRoot = allocate({ ops: partialOps, reserved: { bits: reserveBits, refs: reserveRefs } }); + const root = allocate({ ops, reserved: { bits: reserveBits, refs: reserveRefs } }); + const partialRoot = allocate({ ops: partialOps, reserved: { bits: reserveBits, refs: reserveRefs } }); // Store allocation - let allocation: StorageAllocation = { + const allocation: StorageAllocation = { ops, root, header, @@ -99,7 +99,7 @@ export function resolveAllocations(ctx: CompilerContext) { } }; - let partialAllocation: StorageAllocation = { + const partialAllocation: StorageAllocation = { ops: partialOps, root: partialRoot, header, @@ -114,7 +114,7 @@ export function resolveAllocations(ctx: CompilerContext) { } // Generate init allocations - for (let s of types) { + for (const s of types) { if (s.kind === 'contract' && s.init) { // Reserve bits and refs @@ -128,9 +128,9 @@ export function resolveAllocations(ctx: CompilerContext) { reserveRefs++; // Resolve opts - let ops: AllocationOperation[] = []; - for (let f of s.init.args) { - let abiType = createABITypeRefFromTypeRef(f.type, f.ref); + const ops: AllocationOperation[] = []; + for (const f of s.init.args) { + const abiType = createABITypeRefFromTypeRef(f.type, f.ref); ops.push({ name: f.name, type: abiType, @@ -139,10 +139,10 @@ export function resolveAllocations(ctx: CompilerContext) { } // Perform allocation - let root = allocate({ ops, reserved: { bits: reserveBits, refs: reserveRefs } }); // Better allocation? + const root = allocate({ ops, reserved: { bits: reserveBits, refs: reserveRefs } }); // Better allocation? // Store allocation - let allocation: StorageAllocation = { + const allocation: StorageAllocation = { ops, root, header: null, diff --git a/src/test/bugs.spec.ts b/src/test/bugs.spec.ts index af330d4d2..9fc6ccfc9 100644 --- a/src/test/bugs.spec.ts +++ b/src/test/bugs.spec.ts @@ -1,5 +1,5 @@ import { beginCell, toNano } from '@ton/core'; -import { ContractSystem, Verbosity } from '@tact-lang/emulator'; +import { ContractSystem } from '@tact-lang/emulator'; import { __DANGER_resetNodeId } from '../grammar/ast'; import { SampleJetton } from './bugs/output/bugs_SampleJetton'; import { JettonDefaultWallet } from './bugs/output/bugs_JettonDefaultWallet'; @@ -11,16 +11,14 @@ describe('bugs', () => { it('should deploy contract correctly', async () => { // Init - let system = await ContractSystem.create(); - let treasure = system.treasure('treasure'); - let contract = system.open(await SampleJetton.fromInit(treasure.address, beginCell().endCell(), toNano('100'))); - let target = system.open(await JettonDefaultWallet.fromInit(contract.address, treasure.address)); - let logger = system.log(target.address); - let tracker = system.track(target.address); + const system = await ContractSystem.create(); + const treasure = system.treasure('treasure'); + const contract = system.open(await SampleJetton.fromInit(treasure.address, beginCell().endCell(), toNano('100'))); + const target = system.open(await JettonDefaultWallet.fromInit(contract.address, treasure.address)); + const tracker = system.track(target.address); await contract.send(treasure, { value: toNano('10') }, { $$type: 'Mint', receiver: treasure.address, amount: toNano('10') }); await system.run(); - // console.warn(logger.collect()); expect(tracker.collect()).toMatchSnapshot(); }); }); \ No newline at end of file diff --git a/src/test/feature-bounced-routing.spec.ts b/src/test/feature-bounced-routing.spec.ts index e367e34f0..1b6a8c341 100644 --- a/src/test/feature-bounced-routing.spec.ts +++ b/src/test/feature-bounced-routing.spec.ts @@ -1,4 +1,4 @@ -import { beginCell, toNano } from '@ton/core'; +import { toNano } from '@ton/core'; import { ContractSystem } from '@tact-lang/emulator'; import { __DANGER_resetNodeId } from '../grammar/ast'; import { SampleContract2 } from './features/output/bounced-routing_SampleContract2'; @@ -11,10 +11,10 @@ describe('feature-strings', () => { it('should bounce based on type router', async () => { // Init - let system = await ContractSystem.create(); - let treasure = system.treasure('treasure'); - let contract = system.open(await SampleContract.fromInit()); - let contract2 = system.open(await SampleContract2.fromInit()); + const system = await ContractSystem.create(); + const treasure = system.treasure('treasure'); + const contract = system.open(await SampleContract.fromInit()); + const contract2 = system.open(await SampleContract2.fromInit()); // Deploy await contract.send(treasure, { value: toNano('10') }, null); diff --git a/src/test/feature-debug.spec.ts b/src/test/feature-debug.spec.ts index f24710232..ddd6699d3 100644 --- a/src/test/feature-debug.spec.ts +++ b/src/test/feature-debug.spec.ts @@ -1,5 +1,5 @@ import { toNano } from '@ton/core'; -import { ContractSystem, Verbosity } from '@tact-lang/emulator'; +import { ContractSystem } from '@tact-lang/emulator'; import { __DANGER_resetNodeId } from '../grammar/ast'; import { Debug } from './features/output/debug_Debug'; @@ -10,10 +10,10 @@ describe('feature-debug', () => { it('should dump values correctly', async () => { // Init - let system = await ContractSystem.create(); - let treasure = system.treasure('treasure'); - let contract = system.open(await Debug.fromInit()); - let logger = system.log(contract.address); + const system = await ContractSystem.create(); + const treasure = system.treasure('treasure'); + const contract = system.open(await Debug.fromInit()); + const logger = system.log(contract.address); await contract.send(treasure, { value: toNano('10') }, { $$type: 'Deploy', queryId: 0n }); await system.run(); @@ -21,7 +21,7 @@ describe('feature-debug', () => { await contract.send(treasure, { value: toNano('10') }, 'Debug'); await system.run(); - let res = logger.collect(); + const res = logger.collect(); expect(res.indexOf('=== DEBUG LOGS ===')).toBeGreaterThan(-1); expect(res.indexOf('Hello world!')).toBeGreaterThan(-1); expect(res.indexOf('true')).toBeGreaterThan(-1); diff --git a/src/test/feature-deep.spec.ts b/src/test/feature-deep.spec.ts index 39bae6456..f29d9bb8e 100644 --- a/src/test/feature-deep.spec.ts +++ b/src/test/feature-deep.spec.ts @@ -12,23 +12,23 @@ describe('feature-random', () => { it('should chain deep sequences correctly', async () => { // Init - let system = await ContractSystem.create(); - let treasure = system.treasure('treasure'); - let contractA = system.open(await A.fromInit()); - let contractB = system.open(await B.fromInit(contractA.address)); - let contractC = system.open(await C.fromInit(contractB.address)); - let trackA = system.track(contractA.address); - let trackB = system.track(contractB.address); - let trackC = system.track(contractC.address); + const system = await ContractSystem.create(); + const treasure = system.treasure('treasure'); + const contractA = system.open(await A.fromInit()); + const contractB = system.open(await B.fromInit(contractA.address)); + const contractC = system.open(await C.fromInit(contractB.address)); + const trackA = system.track(contractA.address); + const trackB = system.track(contractB.address); + const trackC = system.track(contractC.address); expect(trackA.address.toString({ testOnly: true })).toMatchSnapshot(); expect(trackB.address.toString({ testOnly: true })).toMatchSnapshot(); expect(trackC.address.toString({ testOnly: true })).toMatchSnapshot(); await contractA.send(treasure, { value: toNano('10') }, "Message"); await system.run(); - let nextA = await contractA.getGetNext(); + const nextA = await contractA.getGetNext(); expect(nextA.code.equals(contractB.init!.code!)).toBe(true); expect(nextA.data.equals(contractB.init!.data!)).toBe(true); - let nextB = await contractB.getGetNext(); + const nextB = await contractB.getGetNext(); expect(nextB.code.equals(contractC.init!.code!)).toBe(true); expect(nextB.data.equals(contractC.init!.data!)).toBe(true); diff --git a/src/test/feature-dns.spec.ts b/src/test/feature-dns.spec.ts index 05870afd1..c7d545ae2 100644 --- a/src/test/feature-dns.spec.ts +++ b/src/test/feature-dns.spec.ts @@ -7,7 +7,7 @@ function convertToInternal(src: string) { if (src === '.') { return Buffer.alloc(1, 0); } - let parts = src.split('.').map((x) => Buffer.from(x)); + const parts = src.split('.').map((x) => Buffer.from(x)); let res = Buffer.alloc(0); for (let i = 0; i < parts.length; i++) { if (i > 0) { @@ -37,8 +37,8 @@ describe('feature-dns', () => { beforeEach(async () => { __DANGER_resetNodeId(); - let system = await ContractSystem.create(); - let treasure = system.treasure('treasure'); + const system = await ContractSystem.create(); + const treasure = system.treasure('treasure'); contract = system.open(await DNSTester.fromInit()); await contract.send(treasure, { value: toNano('10') }, { $$type: 'Deploy', queryId: 0n }); await system.run(); @@ -80,15 +80,15 @@ describe('feature-dns', () => { for (let i = 0; i < invalidNames.length; i++) { it(`should fail on invalid name: ${invalidNames[i]}`, async () => { expect(await contract.getStringToInternal(invalidNames[i])).toBe(null); - let internalAddress = convertToInternal(invalidNames[i]); + const internalAddress = convertToInternal(invalidNames[i]); expect(await contract.getDnsInternalVerify(beginCell().storeBuffer(internalAddress).endCell())).toBe(false); }); } for (let i = 0; i < validNames.length; i++) { it(`should convert valid name: ${validNames[i]}`, async () => { - let data = (await contract.getStringToInternal(validNames[i]))!; - let received = data.beginParse().loadBuffer(data.bits.length / 8).toString('hex'); + const data = (await contract.getStringToInternal(validNames[i]))!; + const received = data.beginParse().loadBuffer(data.bits.length / 8).toString('hex'); expect(received).toBe(convertToInternal(validNames[i].endsWith('.') && validNames[i] !== '.' ? validNames[i].slice(0, validNames[i].length - 1) : validNames[i]).toString('hex')); }); } @@ -96,7 +96,7 @@ describe('feature-dns', () => { for (let i = 0; i < validNames.length; i++) { if (validNames[i] !== '.') { it(`should convert valid name: ${validNames[i]}`, async () => { - let data = (await contract.getStringToInternal(validNames[i]))!; + const data = (await contract.getStringToInternal(validNames[i]))!; expect(await contract.getDnsInternalVerify(data)).toBe(true); }); } @@ -106,10 +106,10 @@ describe('feature-dns', () => { it(`should convert equal normalized names: ${equalNormalized[i][0]} ${equalNormalized[i][1]}`, async () => { let data1 = (await contract.getStringToInternal(equalNormalized[i][0]))!; data1 = await contract.getInternalNormalize(data1); - let received1 = data1.beginParse().loadBuffer(data1.bits.length / 8).toString('hex'); + const received1 = data1.beginParse().loadBuffer(data1.bits.length / 8).toString('hex'); let data2 = (await contract.getStringToInternal(equalNormalized[i][1]))!; data2 = await contract.getInternalNormalize(data2); - let received2 = data2.beginParse().loadBuffer(data2.bits.length / 8).toString('hex'); + const received2 = data2.beginParse().loadBuffer(data2.bits.length / 8).toString('hex'); expect(received1).toBe(received2); expect(received1.length).toBe(received2.length); }); @@ -118,10 +118,10 @@ describe('feature-dns', () => { it(`should convert not equal normalized names: ${notEqualNormalized[i][0]} ${notEqualNormalized[i][1]}`, async () => { let data1 = (await contract.getStringToInternal(notEqualNormalized[i][0]))!; data1 = await contract.getInternalNormalize(data1); - let received1 = data1.beginParse().loadBuffer(data1.bits.length / 8).toString('hex'); + const received1 = data1.beginParse().loadBuffer(data1.bits.length / 8).toString('hex'); let data2 = (await contract.getStringToInternal(notEqualNormalized[i][1]))!; data2 = await contract.getInternalNormalize(data2); - let received2 = data2.beginParse().loadBuffer(data2.bits.length / 8).toString('hex'); + const received2 = data2.beginParse().loadBuffer(data2.bits.length / 8).toString('hex'); expect(received1).not.toBe(received2); expect(received1.length).toBe(received2.length); }); @@ -129,8 +129,8 @@ describe('feature-dns', () => { for (let i = 0; i < validNames.length; i++) { it('should resolve name ' + validNames[i], async () => { - let internalAddress = convertToInternal(validNames[i]); - let resolved = (await contract.getDnsresolve(beginCell().storeBuffer(internalAddress).endCell(), 1n))!; + const internalAddress = convertToInternal(validNames[i]); + const resolved = (await contract.getDnsresolve(beginCell().storeBuffer(internalAddress).endCell(), 1n))!; expect(resolved.prefix).toBe(BigInt(internalAddress.length * 8)); if (validNames[i] === '.') { expect(resolved.record!.bits.length).toBe(0); @@ -145,7 +145,7 @@ describe('feature-dns', () => { for (let i = 0; i < invalidNames.length; i++) { it('should not resolve name ' + invalidNames[i], async () => { - let internalAddress = convertToInternal(invalidNames[i]); + const internalAddress = convertToInternal(invalidNames[i]); await expect(contract.getDnsresolve(beginCell().storeBuffer(internalAddress).endCell(), 1n)).rejects.toThrowError(); }); } @@ -155,8 +155,8 @@ describe('feature-dns', () => { continue; } it('should resolve name with leading zero ' + validNames[i], async () => { - let internalAddress = convertToInternal(validNames[i]); - let resolved = (await contract.getDnsresolve(beginCell().storeBuffer(Buffer.concat([Buffer.alloc(1, 0), internalAddress])).endCell(), 1n))!; + const internalAddress = convertToInternal(validNames[i]); + const resolved = (await contract.getDnsresolve(beginCell().storeBuffer(Buffer.concat([Buffer.alloc(1, 0), internalAddress])).endCell(), 1n))!; expect(resolved.prefix).toBe(BigInt(internalAddress.length * 8 + 8)); if (validNames[i] === '.') { expect(resolved.record!.bits.length).toBe(0); diff --git a/src/test/feature-instrinsics.spec.ts b/src/test/feature-instrinsics.spec.ts index 928231ec6..2341bcd18 100644 --- a/src/test/feature-instrinsics.spec.ts +++ b/src/test/feature-instrinsics.spec.ts @@ -9,9 +9,9 @@ describe('feature-instrinsics', () => { __DANGER_resetNodeId(); }); it('should return correct instinsic results', async () => { - let system = await ContractSystem.create(); - let treasure = system.treasure('treasure'); - let contract = system.open(await IntrinsicsTester.fromInit()); + const system = await ContractSystem.create(); + const treasure = system.treasure('treasure'); + const contract = system.open(await IntrinsicsTester.fromInit()); system.name(contract, 'contract'); await contract.send(treasure, { value: toNano('10') }, 'Deploy'); await system.run(); @@ -32,12 +32,12 @@ describe('feature-instrinsics', () => { expect((await contract.getGetComment()).equals(beginCell().storeUint(0, 32).storeStringTail('Hello world').endCell())).toBe(true); // Compile-time send/emit optimizations - let tracker = system.track(contract); + const tracker = system.track(contract); await contract.send(treasure, { value: toNano(1) }, 'emit_1'); await system.run(); // Check that the contract emitted the correct message - let tracked = tracker.collect(); + const tracked = tracker.collect(); expect(tracked).toMatchSnapshot(); // Check sha256 diff --git a/src/test/feature-integer-literals.spec.ts b/src/test/feature-integer-literals.spec.ts index faa204ffc..c361b42d8 100644 --- a/src/test/feature-integer-literals.spec.ts +++ b/src/test/feature-integer-literals.spec.ts @@ -9,9 +9,9 @@ describe('feature-integer-literals', () => { }); it('should implement integer literals correctly', async () => { // Init - let system = await ContractSystem.create(); - let treasure = system.treasure('treasure'); - let contract = system.open(await IntegerLiteralsTester.fromInit()); + const system = await ContractSystem.create(); + const treasure = system.treasure('treasure'); + const contract = system.open(await IntegerLiteralsTester.fromInit()); await contract.send(treasure, { value: toNano('10') }, null); await system.run(); diff --git a/src/test/feature-map.spec.ts b/src/test/feature-map.spec.ts index e2e56b667..ebee31532 100644 --- a/src/test/feature-map.spec.ts +++ b/src/test/feature-map.spec.ts @@ -13,6 +13,7 @@ function strEq(a: SomeStruct | null, b: SomeStruct | null) { } describe('feature-map', () => { + /* eslint-disable */ let globalCoverage: any; beforeAll(() => { globalCoverage = (globalThis as any).__ton_coverage__; @@ -21,6 +22,7 @@ describe('feature-map', () => { afterAll(() => { (globalThis as any).__ton_coverage__ = globalCoverage; }) + /* eslint-enable */ beforeEach(() => { __DANGER_resetNodeId(); }); @@ -29,9 +31,9 @@ describe('feature-map', () => { try { // Init contract - let system = await ContractSystem.create(); - let treasure = system.treasure('treasure'); - let contract = system.open(await MapTestContract.fromInit()); + const system = await ContractSystem.create(); + const treasure = system.treasure('treasure'); + const contract = system.open(await MapTestContract.fromInit()); await contract.send(treasure, { value: toNano('10') }, null); await system.run(); @@ -86,13 +88,13 @@ describe('feature-map', () => { expect((await contract.getAddrMap7_6()).size).toBe(0); // Keys for test - let keys: bigint[] = []; + const keys: bigint[] = []; keys.push(1n); keys.push(0n); keys.push(-1n); keys.push(10102312312312312312312n); keys.push(-10102312312312312312312n); - for (let k of keys) { + for (const k of keys) { // Check keys to be empty expect(await contract.getIntMap1Value(k)).toBeNull(); @@ -101,16 +103,16 @@ describe('feature-map', () => { expect(await contract.getIntMap4Value(k)).toBeNull(); // Set keys - let valueInt = k * 10n; - let valueBool = k < 0n; - let addr = randomAddress(0, 'addr-' + k.toString(10)); - let valueCell = beginCell().storeUint(123123, 128).endCell(); - let valueStruct: SomeStruct = { $$type: 'SomeStruct', value: 10012312n }; - let valueAddr = randomAddress(0, 'value-' + k.toString(10)); - let keySmall = k % 100n; - let keySmallAbs = (k > 0 ? k : -k) % 100n; - let valueSmall = k % 100n; - let valueSmallAbs = (k > 0 ? k : -k) % 100n; + const valueInt = k * 10n; + const valueBool = k < 0n; + const addr = randomAddress(0, 'addr-' + k.toString(10)); + const valueCell = beginCell().storeUint(123123, 128).endCell(); + const valueStruct: SomeStruct = { $$type: 'SomeStruct', value: 10012312n }; + const valueAddr = randomAddress(0, 'value-' + k.toString(10)); + const keySmall = k % 100n; + const keySmallAbs = (k > 0 ? k : -k) % 100n; + const valueSmall = k % 100n; + const valueSmallAbs = (k > 0 ? k : -k) % 100n; await contract.send(treasure, { value: toNano(1) }, { $$type: 'SetIntMap1', key: k, value: valueInt }); await contract.send(treasure, { value: toNano(1) }, { $$type: 'SetIntMap2', key: k, value: valueBool }); await contract.send(treasure, { value: toNano(1) }, { $$type: 'SetIntMap3', key: k, value: valueCell }); diff --git a/src/test/feature-masterchain.spec.ts b/src/test/feature-masterchain.spec.ts index 1c03da7fc..39af00255 100644 --- a/src/test/feature-masterchain.spec.ts +++ b/src/test/feature-masterchain.spec.ts @@ -14,37 +14,37 @@ describe('feature-masterchain', () => { // it('should deploy to the workchain', async () => { - let system = await ContractSystem.create(); - let treasure = system.treasure('treasure'); - let contract = system.open(await MasterchainTester.fromInit()); - let tracker = system.track(contract.address); + const system = await ContractSystem.create(); + const treasure = system.treasure('treasure'); + const contract = system.open(await MasterchainTester.fromInit()); + const tracker = system.track(contract.address); await contract.send(treasure, { value: toNano('10') }, "Deploy"); await system.run(); expect(tracker.collect()).toMatchSnapshot(); }); it('should deploy to the workchain when masterchain enabled', async () => { - let system = await ContractSystem.create(); - let treasure = system.treasure('treasure'); - let contract = system.open(await EnabledTester.fromInit()); - let tracker = system.track(contract.address); + const system = await ContractSystem.create(); + const treasure = system.treasure('treasure'); + const contract = system.open(await EnabledTester.fromInit()); + const tracker = system.track(contract.address); await contract.send(treasure, { value: toNano('10') }, "Deploy"); await system.run(); expect(tracker.collect()).toMatchSnapshot(); }); it('should not deploy to the workchain from masterchain', async () => { - let system = await ContractSystem.create(); - let treasure = system.treasure('treasure', -1); - let contract = system.open(await MasterchainTester.fromInit()); - let tracker = system.track(contract.address); + const system = await ContractSystem.create(); + const treasure = system.treasure('treasure', -1); + const contract = system.open(await MasterchainTester.fromInit()); + const tracker = system.track(contract.address); await contract.send(treasure, { value: toNano('10') }, "Deploy"); await system.run(); expect(tracker.collect()).toMatchSnapshot(); }); it('should deploy to the workchain from masterchain when masterchain enabled', async () => { - let system = await ContractSystem.create(); - let treasure = system.treasure('treasure', -1); - let contract = system.open(await EnabledTester.fromInit()); - let tracker = system.track(contract.address); + const system = await ContractSystem.create(); + const treasure = system.treasure('treasure', -1); + const contract = system.open(await EnabledTester.fromInit()); + const tracker = system.track(contract.address); await contract.send(treasure, { value: toNano('10') }, "Deploy"); await system.run(); expect(tracker.collect()).toMatchSnapshot(); @@ -55,36 +55,36 @@ describe('feature-masterchain', () => { // it('should create address for the workchain', async () => { - let system = await ContractSystem.create(); - let treasure = system.treasure('treasure'); - let contract = system.open(await MasterchainTester.fromInit()); + const system = await ContractSystem.create(); + const treasure = system.treasure('treasure'); + const contract = system.open(await MasterchainTester.fromInit()); await contract.send(treasure, { value: toNano('10') }, "Deploy"); await system.run(); await contract.getCreateAddress(0n, 0n); }); - it('should not create address for the materchain', async () => { - let system = await ContractSystem.create(); - let treasure = system.treasure('treasure'); - let contract = system.open(await MasterchainTester.fromInit()); + it('should not create address for the masterchain', async () => { + const system = await ContractSystem.create(); + const treasure = system.treasure('treasure'); + const contract = system.open(await MasterchainTester.fromInit()); await contract.send(treasure, { value: toNano('10') }, "Deploy"); await system.run(); await expect(contract.getCreateAddress(-1n, 0n)).rejects.toThrowError('Masterchain support is not enabled for this contract'); }); it('should create address for the masterchain when masterchain enabled', async () => { - let system = await ContractSystem.create(); - let treasure = system.treasure('treasure'); - let contract = system.open(await EnabledTester.fromInit()); + const system = await ContractSystem.create(); + const treasure = system.treasure('treasure'); + const contract = system.open(await EnabledTester.fromInit()); await contract.send(treasure, { value: toNano('10') }, "Deploy"); await system.run(); await contract.getCreateAddress(-1n, 0n); }); it('should not create address for invalid workchain', async () => { - let system = await ContractSystem.create(); - let treasure = system.treasure('treasure'); - let contract = system.open(await MasterchainTester.fromInit()); + const system = await ContractSystem.create(); + const treasure = system.treasure('treasure'); + const contract = system.open(await MasterchainTester.fromInit()); await contract.send(treasure, { value: toNano('10') }, "Deploy"); await system.run(); await expect(contract.getCreateAddress(10n, 0n)).rejects.toThrowError('Invalid address'); @@ -95,42 +95,42 @@ describe('feature-masterchain', () => { // it('should load address for the workchain', async () => { - let system = await ContractSystem.create(); - let treasure = system.treasure('treasure'); - let contract = system.open(await MasterchainTester.fromInit()); + const system = await ContractSystem.create(); + const treasure = system.treasure('treasure'); + const contract = system.open(await MasterchainTester.fromInit()); await contract.send(treasure, { value: toNano('10') }, "Deploy"); await system.run(); - let addr = new Address(0, Buffer.alloc(32, 0)); + const addr = new Address(0, Buffer.alloc(32, 0)); expect((await contract.getParseAddress(beginCell().storeAddress(addr).endCell())).equals(addr)).toBe(true); }); it('should not load address for the masterchain', async () => { - let system = await ContractSystem.create(); - let treasure = system.treasure('treasure'); - let contract = system.open(await MasterchainTester.fromInit()); + const system = await ContractSystem.create(); + const treasure = system.treasure('treasure'); + const contract = system.open(await MasterchainTester.fromInit()); await contract.send(treasure, { value: toNano('10') }, "Deploy"); await system.run(); - let addr = new Address(-1, Buffer.alloc(32, 0)); + const addr = new Address(-1, Buffer.alloc(32, 0)); expect(contract.getParseAddress(beginCell().storeAddress(addr).endCell())).rejects.toThrowError('Masterchain support is not enabled for this contract'); }); it('should load address for the workchain when masterchain enabled', async () => { - let system = await ContractSystem.create(); - let treasure = system.treasure('treasure'); - let contract = system.open(await EnabledTester.fromInit()); + const system = await ContractSystem.create(); + const treasure = system.treasure('treasure'); + const contract = system.open(await EnabledTester.fromInit()); await contract.send(treasure, { value: toNano('10') }, "Deploy"); await system.run(); - let addr = new Address(0, Buffer.alloc(32, 0)); + const addr = new Address(0, Buffer.alloc(32, 0)); expect((await contract.getParseAddress(beginCell().storeAddress(addr).endCell())).equals(addr)).toBe(true); }); it('should load address for the masterchain when masterchain enabled', async () => { - let system = await ContractSystem.create(); - let treasure = system.treasure('treasure'); - let contract = system.open(await EnabledTester.fromInit()); + const system = await ContractSystem.create(); + const treasure = system.treasure('treasure'); + const contract = system.open(await EnabledTester.fromInit()); await contract.send(treasure, { value: toNano('10') }, "Deploy"); await system.run(); - let addr = new Address(-1, Buffer.alloc(32, 0)); + const addr = new Address(-1, Buffer.alloc(32, 0)); expect((await contract.getParseAddress(beginCell().storeAddress(addr).endCell())).equals(addr)).toBe(true); }); @@ -139,42 +139,42 @@ describe('feature-masterchain', () => { // it('should handle address in get argument for the workchain', async () => { - let system = await ContractSystem.create(); - let treasure = system.treasure('treasure'); - let contract = system.open(await MasterchainTester.fromInit()); + const system = await ContractSystem.create(); + const treasure = system.treasure('treasure'); + const contract = system.open(await MasterchainTester.fromInit()); await contract.send(treasure, { value: toNano('10') }, "Deploy"); await system.run(); - let addr = new Address(0, Buffer.alloc(32, 0)); + const addr = new Address(0, Buffer.alloc(32, 0)); await contract.getSerializeAddress(addr); }); it('should not handle address in get argument for the masterchain', async () => { - let system = await ContractSystem.create(); - let treasure = system.treasure('treasure'); - let contract = system.open(await MasterchainTester.fromInit()); + const system = await ContractSystem.create(); + const treasure = system.treasure('treasure'); + const contract = system.open(await MasterchainTester.fromInit()); await contract.send(treasure, { value: toNano('10') }, "Deploy"); await system.run(); - let addr = new Address(-1, Buffer.alloc(32, 0)); + const addr = new Address(-1, Buffer.alloc(32, 0)); expect(contract.getSerializeAddress(addr)).rejects.toThrowError('Masterchain support is not enabled for this contract'); }); it('should handle address in get argument for the workchain when masterchain enabled', async () => { - let system = await ContractSystem.create(); - let treasure = system.treasure('treasure'); - let contract = system.open(await EnabledTester.fromInit()); + const system = await ContractSystem.create(); + const treasure = system.treasure('treasure'); + const contract = system.open(await EnabledTester.fromInit()); await contract.send(treasure, { value: toNano('10') }, "Deploy"); await system.run(); - let addr = new Address(0, Buffer.alloc(32, 0)); + const addr = new Address(0, Buffer.alloc(32, 0)); await contract.getSerializeAddress(addr); }); it('should handle address in get argument for the masterchain when masterchain enabled', async () => { - let system = await ContractSystem.create(); - let treasure = system.treasure('treasure'); - let contract = system.open(await EnabledTester.fromInit()); + const system = await ContractSystem.create(); + const treasure = system.treasure('treasure'); + const contract = system.open(await EnabledTester.fromInit()); await contract.send(treasure, { value: toNano('10') }, "Deploy"); await system.run(); - let addr = new Address(-1, Buffer.alloc(32, 0)); + const addr = new Address(-1, Buffer.alloc(32, 0)); await contract.getSerializeAddress(addr); }); @@ -183,45 +183,45 @@ describe('feature-masterchain', () => { // it('should handle address in get argument struct for the workchain', async () => { - let system = await ContractSystem.create(); - let treasure = system.treasure('treasure'); - let contract = system.open(await MasterchainTester.fromInit()); + const system = await ContractSystem.create(); + const treasure = system.treasure('treasure'); + const contract = system.open(await MasterchainTester.fromInit()); await contract.send(treasure, { value: toNano('10') }, "Deploy"); await system.run(); - let addr = new Address(0, Buffer.alloc(32, 0)); + const addr = new Address(0, Buffer.alloc(32, 0)); await contract.getHandleStruct({ $$type: 'TestMessage', address: addr, address2: null }); await contract.getHandleStruct({ $$type: 'TestMessage', address: addr, address2: addr }); }); it('should not handle address in get argument struct for the masterchain', async () => { - let system = await ContractSystem.create(); - let treasure = system.treasure('treasure'); - let contract = system.open(await MasterchainTester.fromInit()); + const system = await ContractSystem.create(); + const treasure = system.treasure('treasure'); + const contract = system.open(await MasterchainTester.fromInit()); await contract.send(treasure, { value: toNano('10') }, "Deploy"); await system.run(); - let addr = new Address(-1, Buffer.alloc(32, 0)); - let addr2 = new Address(0, Buffer.alloc(32, 0)); + const addr = new Address(-1, Buffer.alloc(32, 0)); + const addr2 = new Address(0, Buffer.alloc(32, 0)); expect(contract.getHandleStruct({ $$type: 'TestMessage', address: addr, address2: null })).rejects.toThrowError('Masterchain support is not enabled for this contract'); expect(contract.getHandleStruct({ $$type: 'TestMessage', address: addr2, address2: addr })).rejects.toThrowError('Masterchain support is not enabled for this contract'); }); it('should handle address in get argument struct for the workchain when masterchain enabled', async () => { - let system = await ContractSystem.create(); - let treasure = system.treasure('treasure'); - let contract = system.open(await EnabledTester.fromInit()); + const system = await ContractSystem.create(); + const treasure = system.treasure('treasure'); + const contract = system.open(await EnabledTester.fromInit()); await contract.send(treasure, { value: toNano('10') }, "Deploy"); await system.run(); - let addr = new Address(0, Buffer.alloc(32, 0)); + const addr = new Address(0, Buffer.alloc(32, 0)); await contract.getHandleStruct({ $$type: 'TestMessage', address: addr, address2: addr }); }); it('should handle address in get argument struct for the masterchain when masterchain enabled', async () => { - let system = await ContractSystem.create(); - let treasure = system.treasure('treasure'); - let contract = system.open(await EnabledTester.fromInit()); + const system = await ContractSystem.create(); + const treasure = system.treasure('treasure'); + const contract = system.open(await EnabledTester.fromInit()); await contract.send(treasure, { value: toNano('10') }, "Deploy"); await system.run(); - let addr = new Address(-1, Buffer.alloc(32, 0)); + const addr = new Address(-1, Buffer.alloc(32, 0)); await contract.getHandleStruct({ $$type: 'TestMessage', address: addr, address2: addr }); }); }); \ No newline at end of file diff --git a/src/test/feature-math.spec.ts b/src/test/feature-math.spec.ts index 5c7dbaa5f..5eb3ed23a 100644 --- a/src/test/feature-math.spec.ts +++ b/src/test/feature-math.spec.ts @@ -10,25 +10,25 @@ describe('feature-math', () => { it('should perform basic math operations correctly', async () => { // Init - let system = await ContractSystem.create(); - let treasure = system.treasure('treasure'); - let contract = system.open(await MathTester.fromInit()); - let addressA = randomAddress('a'); - let addressB = randomAddress('b'); - let cellA = beginCell().storeUint(0, 32).endCell(); - let cellB = beginCell().storeUint(1, 32).endCell(); - let sliceA = beginCell() + const system = await ContractSystem.create(); + const treasure = system.treasure('treasure'); + const contract = system.open(await MathTester.fromInit()); + const addressA = randomAddress('a'); + const addressB = randomAddress('b'); + const cellA = beginCell().storeUint(0, 32).endCell(); + const cellB = beginCell().storeUint(1, 32).endCell(); + const sliceA = beginCell() .storeBit(0) .storeRef(beginCell().storeBit(1).endCell()) .endCell(); - let sliceB = beginCell() + const sliceB = beginCell() .storeBit(1) .storeRef(beginCell().storeBit(1).endCell()) .endCell(); - let stringA = "foo"; - let stringB = "bar"; - let dictA = Dictionary.empty().set(0n, 0n); - let dictB = Dictionary.empty().set(0n, 2n); + const stringA = "foo"; + const stringB = "bar"; + const dictA = Dictionary.empty().set(0n, 0n); + const dictB = Dictionary.empty().set(0n, 2n); await contract.send(treasure, { value: toNano('10') }, { $$type: 'Deploy', queryId: 0n }); await system.run(); diff --git a/src/test/feature-optionals.spec.ts b/src/test/feature-optionals.spec.ts index b1901384e..baf91d377 100644 --- a/src/test/feature-optionals.spec.ts +++ b/src/test/feature-optionals.spec.ts @@ -108,7 +108,7 @@ describe('features', () => { __DANGER_resetNodeId(); }); - let eV = { + const eV = { $$type: 'SomeGenericStruct' as const, value1: 1n, value2: 2n, @@ -116,7 +116,7 @@ describe('features', () => { value4: 4n, value5: 5n }; - let ev2: StructWithOptionals = { + const ev2: StructWithOptionals = { $$type: 'StructWithOptionals' as const, a: 1n, b: true, @@ -124,7 +124,7 @@ describe('features', () => { d: randomAddress(0, 'address1'), e: eV, }; - let ev3: StructWithOptionals = { + const ev3: StructWithOptionals = { $$type: 'StructWithOptionals' as const, a: 1n, b: true, @@ -132,7 +132,7 @@ describe('features', () => { d: null, e: null, }; - let cases: { a: bigint | null, b: boolean | null, c: Cell | null, d: Address | null, e: SomeGenericStruct | null, f: StructWithOptionals | null }[] = []; + const cases: { a: bigint | null, b: boolean | null, c: Cell | null, d: Address | null, e: SomeGenericStruct | null, f: StructWithOptionals | null }[] = []; cases.push({ a: null, b: null, c: null, d: null, e: null, f: null }); cases.push({ a: 10n, b: true, c: null, d: randomAddress(0, 'address1'), e: eV, f: ev2 }); cases.push({ a: -10n, b: false, c: null, d: randomAddress(-1, 'address2'), e: null, f: ev2 }); @@ -141,12 +141,12 @@ describe('features', () => { for (let i = 0; i < cases.length; i++) { it('should handle case #' + i, async () => { - let cs = cases[i]; + const cs = cases[i]; // Init contract - let system = await ContractSystem.create(); - let treasure = system.treasure('treasure'); - let contract = system.open(await ContractWithOptionals.fromInit(cs.a, cs.b, cs.c, cs.d, cs.e, cs.f)); + const system = await ContractSystem.create(); + const treasure = system.treasure('treasure'); + const contract = system.open(await ContractWithOptionals.fromInit(cs.a, cs.b, cs.c, cs.d, cs.e, cs.f)); await contract.send(treasure, { value: toNano('10') }, null); await system.run(); diff --git a/src/test/feature-ordering.spec.ts b/src/test/feature-ordering.spec.ts index 341115562..a16596139 100644 --- a/src/test/feature-ordering.spec.ts +++ b/src/test/feature-ordering.spec.ts @@ -10,14 +10,14 @@ describe('feature-ordering', () => { it('should implement constructor ordering correctly', async () => { // Init - let system = await ContractSystem.create(); - let treasure = system.treasure('treasure'); - let contract = system.open(await A.fromInit(treasure.address)); + const system = await ContractSystem.create(); + const treasure = system.treasure('treasure'); + const contract = system.open(await A.fromInit(treasure.address)); await contract.send(treasure, { value: toNano('10') }, { $$type: 'Deploy', queryId: 0n }); await system.run(); // Check order - let res = await contract.getCreate(0n); + const res = await contract.getCreate(0n); expect(res.v1).toBe(3n); expect(res.v2).toBe(2n); expect(res.v3).toBe(1n); diff --git a/src/test/feature-random.spec.ts b/src/test/feature-random.spec.ts index 43195396b..1bab2ea85 100644 --- a/src/test/feature-random.spec.ts +++ b/src/test/feature-random.spec.ts @@ -10,9 +10,9 @@ describe('feature-random', () => { it('should implement random correctly', async () => { // Init - let system = await ContractSystem.create(); - let treasure = system.treasure('treasure'); - let contract = system.open(await RandomContract.fromInit()); + const system = await ContractSystem.create(); + const treasure = system.treasure('treasure'); + const contract = system.open(await RandomContract.fromInit()); await contract.send(treasure, { value: toNano('10') }, { $$type: 'Deploy', queryId: 0n }); await system.run(); diff --git a/src/test/feature-send.spec.ts b/src/test/feature-send.spec.ts index 208666785..0c85c88b5 100644 --- a/src/test/feature-send.spec.ts +++ b/src/test/feature-send.spec.ts @@ -10,10 +10,10 @@ describe('feature-send', () => { it('should send reply correctly', async () => { // Init - let system = await ContractSystem.create(); - let treasure = system.treasure('treasure'); - let contract = system.open(await SendTester.fromInit()); - let tracker = system.track(contract.address); + const system = await ContractSystem.create(); + const treasure = system.treasure('treasure'); + const contract = system.open(await SendTester.fromInit()); + const tracker = system.track(contract.address); await contract.send(treasure, { value: toNano('10') }, { $$type: 'Deploy', queryId: 0n }); await system.run(); expect(tracker.collect()).toMatchSnapshot(); @@ -25,14 +25,14 @@ describe('feature-send', () => { it('should bounce on unknown message', async () => { // Init - let system = await ContractSystem.create(); - let treasure = system.treasure('treasure'); - let contract = system.open(await SendTester.fromInit()); + const system = await ContractSystem.create(); + const treasure = system.treasure('treasure'); + const contract = system.open(await SendTester.fromInit()); await contract.send(treasure, { value: toNano('10') }, { $$type: 'Deploy', queryId: 0n }); await system.run(); // Test - let tracker = system.track(contract); + const tracker = system.track(contract); await system.provider(contract).internal(treasure, { value: toNano('10'), body: 'Unknown string' }); await system.run(); expect(tracker.collect()).toMatchSnapshot(); diff --git a/src/test/feature-serialization.spec.ts b/src/test/feature-serialization.spec.ts index 383c8daa7..9bf0fdbf0 100644 --- a/src/test/feature-serialization.spec.ts +++ b/src/test/feature-serialization.spec.ts @@ -14,7 +14,7 @@ describe('feature-serialization', () => { // Simple case // { - let cases: { a: bigint, b: bigint, c: bigint, d: bigint, e: bigint, f: bigint, g: bigint, h: bigint, i: bigint }[] = []; + const cases: { a: bigint, b: bigint, c: bigint, d: bigint, e: bigint, f: bigint, g: bigint, h: bigint, i: bigint }[] = []; cases.push({ a: 1n, b: 2n, @@ -30,12 +30,12 @@ describe('feature-serialization', () => { for (let i = 0; i < cases.length; i++) { it('should handle case #' + i, async () => { - let cs = cases[i]; + const cs = cases[i]; // Init contract - let system = await ContractSystem.create(); - let treasure = system.treasure('treasure'); - let contract = system.open(await SerializationTester.fromInit(cs.a, cs.b, cs.c, cs.d, cs.e, cs.f, cs.g, cs.h, cs.i)); + const system = await ContractSystem.create(); + const treasure = system.treasure('treasure'); + const contract = system.open(await SerializationTester.fromInit(cs.a, cs.b, cs.c, cs.d, cs.e, cs.f, cs.g, cs.h, cs.i)); await contract.send(treasure, { value: toNano('10') }, null); await system.run(); @@ -57,7 +57,7 @@ describe('feature-serialization', () => { // Cases with references // { - let cases: { a: { $$type: 'Vars', a: bigint, b: bigint, c: bigint, d: bigint, e: bigint }, b: { $$type: 'Vars', a: bigint, b: bigint, c: bigint, d: bigint, e: bigint } }[] = []; + const cases: { a: { $$type: 'Vars', a: bigint, b: bigint, c: bigint, d: bigint, e: bigint }, b: { $$type: 'Vars', a: bigint, b: bigint, c: bigint, d: bigint, e: bigint } }[] = []; cases.push({ a: { $$type: 'Vars', @@ -79,21 +79,21 @@ describe('feature-serialization', () => { for (let i = 0; i < cases.length; i++) { it('should handle case-2 #' + i, async () => { - let cs = cases[i]; + const cs = cases[i]; // Init contract - let system = await ContractSystem.create(); - let treasure = system.treasure('treasure'); - let contract = system.open(await SerializationTester2.fromInit(cs.a, cs.b)); + const system = await ContractSystem.create(); + const treasure = system.treasure('treasure'); + const contract = system.open(await SerializationTester2.fromInit(cs.a, cs.b)); await contract.send(treasure, { value: toNano('10') }, null); await system.run(); // Checl values - let a = await contract.getGetA(); - let aOpt = await contract.getGetAopt(); - let b = await contract.getGetB(); - let bOpt = await contract.getGetBopt(); - let both = await contract.getGetBoth(); + const a = await contract.getGetA(); + const aOpt = await contract.getGetAopt(); + const b = await contract.getGetB(); + const bOpt = await contract.getGetBopt(); + const both = await contract.getGetBoth(); expect(aOpt).toMatchObject(a); expect(bOpt).toMatchObject(b); expect(a.a).toBe(cs.a.a); diff --git a/src/test/feature-strings.spec.ts b/src/test/feature-strings.spec.ts index c5c8e26b7..e312e474f 100644 --- a/src/test/feature-strings.spec.ts +++ b/src/test/feature-strings.spec.ts @@ -10,9 +10,9 @@ describe('feature-strings', () => { it('should implement strings correctly', async () => { // Init - let system = await ContractSystem.create(); - let treasure = system.treasure('treasure'); - let contract = system.open(await StringsTester.fromInit()); + const system = await ContractSystem.create(); + const treasure = system.treasure('treasure'); + const contract = system.open(await StringsTester.fromInit()); await contract.send(treasure, { value: toNano('10') }, null); await system.run(); @@ -31,19 +31,19 @@ describe('feature-strings', () => { expect((await contract.getStringWithNegativeNumber())).toEqual('Hello, your balance: -123'); expect((await contract.getStringWithFloat())).toEqual('9.5'); - let base = await contract.getBase64(); + const base = await contract.getBase64(); expect(base.beginParse().loadBuffer(base.bits.length / 8).toString()).toEqual('Many hands make light work.'); - let b64cases = [ + const b64cases = [ 'SGVsbG8gV29ybGQ=', 'li7dzDacuo67Jg7mtqEm2TRuOMU=', 'FKIhdgaG5LGKiEtF1vHy4f3y700zaD6QwDS3IrNVGzNp2rY+1LFWTK6D44AyiC1n8uWz1itkYMZF0/aKDK0Yjg==', 'AA==' ]; - for (let b of b64cases) { - let s = Buffer.from(b, 'base64'); - let r = await contract.getProcessBase64(b); - let d = r.beginParse().loadBuffer(r.bits.length / 8); + for (const b of b64cases) { + const s = Buffer.from(b, 'base64'); + const r = await contract.getProcessBase64(b); + const d = r.beginParse().loadBuffer(r.bits.length / 8); expect(d.toString('hex')).toEqual(s.toString('hex')); } }); diff --git a/src/test/feature-ternary.spec.ts b/src/test/feature-ternary.spec.ts index fc5043111..5e42938e1 100644 --- a/src/test/feature-ternary.spec.ts +++ b/src/test/feature-ternary.spec.ts @@ -1,4 +1,4 @@ -import { beginCell, toNano } from '@ton/core'; +import { toNano } from '@ton/core'; import { ContractSystem } from '@tact-lang/emulator'; import { __DANGER_resetNodeId } from '../grammar/ast'; import { TernaryTester } from './features/output/ternary_TernaryTester'; @@ -10,9 +10,9 @@ describe('feature-ternary', () => { it('should implement ternary operator correctly', async () => { // Init - let system = await ContractSystem.create(); - let treasure = system.treasure('treasure'); - let contract = system.open(await TernaryTester.fromInit()); + const system = await ContractSystem.create(); + const treasure = system.treasure('treasure'); + const contract = system.open(await TernaryTester.fromInit()); await contract.send(treasure, { value: toNano('10') }, null); await system.run(); diff --git a/src/test/features/output/integer-literals_IntegerLiteralsTester.code.boc.html b/src/test/features/output/integer-literals_IntegerLiteralsTester.code.boc.html new file mode 100644 index 000000000..43f27abca --- /dev/null +++ b/src/test/features/output/integer-literals_IntegerLiteralsTester.code.boc.html @@ -0,0 +1,277 @@ + + + + + +

Code coverage

+
+                        PROGRAM{
+            ..DECLPROC recv_internal;
+            ..DECLPROC ?fun_68180;
+            ..DECLPROC ?fun_72309;
+            ..DECLPROC ?fun_76310;
+            ..DECLPROC ?fun_102042;
+            ..DECLPROC ?fun_110296;
+            ..DECLPROC supported_interfaces;
+            ..DECLPROC ?fun_114425;
+            ..DECLPROC lazy_deployment_completed;
+            ..DECLPROC ?fun_115972;
+            ..DECLPROC ?fun_116259;
+            ..DECLPROC get_abi_ipfs;
+            ..DECLPROC ?fun_124230;
+            ..DECLPROC ?fun_124513;
+            ..DECLPROC ?fun_128359;
+            ..DECLPROC ?fun_128576;
+            ..DECLPROC ?fun_ref_026cdd3ff17e82bb;
+            ..DECLPROC ?fun_ref_26dd4850c2973b9d;
+            ..DECLPROC ?fun_ref_32a8f017ec2ceafb;
+            ..DECLPROC ?fun_ref_364de9562794919e;
+            ..DECLPROC ?fun_ref_4065f3bb1951fe13;
+            ..DECLPROC ?fun_ref_4ed57fb2f9d4e6ca;
+            ..DECLPROC ?fun_ref_553f7869b01170d9;
+            ..DECLPROC ?fun_ref_5bdfe841fa412a76;
+            ..DECLPROC ?fun_ref_684a8c99db9474e5;
+            ..DECLPROC ?fun_ref_7366f20a31928e43;
+            ..DECLPROC ?fun_ref_7a4cfefa28b39727;
+            ..DECLPROC ?fun_ref_a05e0042bce184fb;
+            ..DECLPROC ?fun_ref_b5b9e67d57f2dcce;
+            ..DECLPROC ?fun_ref_c0ca23818e24f3c9;
+            ..DECLPROC ?fun_ref_f0101fa3fb0bc1f5;
+            x3..recv_internal PROC:<{
+            18x3....s0 s1 XCHG
+            118x3....CTOS
+            26x3....4 LDU
+            18x3....s0 s1 XCHG
+            18x3....1 PUSHINT
+            18x3....AND
+            18x3....-1 MULCONST
+            18x3....s0 s1 XCHG
+            26x3....LDMSGADDR
+            18x3....s0 s1 XCHG
+            18x3....s0 PUSH
+            26x3....SBITS
+            34x3....267 PUSHINT
+            18x3....EQUAL
+            34x3....136 THROWIFNOT
+            18x3....s0 PUSH
+            34x3....11 PLDU
+            18x3....s0 PUSH
+            34x3....1279 PUSHINT
+            18x3....EQUAL
+            34x3....137 THROWIF
+            26x3....10 PUSHPOW2
+            18x3....EQUAL
+            34x3....136 THROWIFNOT
+            34x3....s0 s6 s4 PUXCPU
+            18x3....s0 s3 XCHG
+            30x3....4 TUPLE
+            28x3....1 SETGLOBVAR
+            18x3....s0 s2 XCHG
+            29x3....2 SETGLOBVAR
+            126x3....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x3....ROTREV
+            126x3....?fun_ref_364de9562794919e INLINECALLDICT
+            34x3....130 THROWIFNOT
+            18x3....s0 POP
+            18x3....NEWC
+            26x3....3 GETGLOBVAR
+            18x3....s0 s1 XCHG
+            18x3....STREF
+            18x3....-1 PUSHINT
+            18x3....s0 s1 XCHG
+            26x3....1 STI
+            518x3....ENDC
+            26x3....c4 POP
+            x3..}>
+            x1..?fun_68180 PROC:<{
+            126x1....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            126x1....?fun_ref_684a8c99db9474e5 INLINECALLDICT
+            18x1....s1 POP
+            x1..}>
+            x1..?fun_72309 PROC:<{
+            126x1....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            126x1....?fun_ref_26dd4850c2973b9d INLINECALLDICT
+            18x1....s1 POP
+            x1..}>
+            x1..?fun_76310 PROC:<{
+            126x1....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            126x1....?fun_ref_7a4cfefa28b39727 INLINECALLDICT
+            18x1....s1 POP
+            x1..}>
+            x1..?fun_102042 PROC:<{
+            126x1....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            126x1....?fun_ref_553f7869b01170d9 INLINECALLDICT
+            18x1....s1 POP
+            x1..}>
+            x1..?fun_110296 PROC:<{
+            126x1....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            126x1....?fun_ref_4ed57fb2f9d4e6ca INLINECALLDICT
+            18x1....s1 POP
+            x1..}>
+            ..supported_interfaces PROC:<{
+            ....123515602279859691144772641439386770278 PUSHINT
+            ....209801025412363888721030803524359905849 PUSHINT
+            ....42980537499636128163026532310500881091 PUSHINT
+            ....36993126140238121407019133875791708966 PUSHINT
+            ....209474421377847335869795010607481022628 PUSHINT
+            ..}>
+            x1..?fun_114425 PROC:<{
+            126x1....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            126x1....?fun_ref_32a8f017ec2ceafb INLINECALLDICT
+            18x1....s1 POP
+            x1..}>
+            ..lazy_deployment_completed PROC:<{
+            ....c4 PUSH
+            ....CTOS
+            ....1 LDI
+            ....s0 s1 XCHG
+            ..}>
+            x1..?fun_115972 PROC:<{
+            126x1....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            126x1....?fun_ref_7366f20a31928e43 INLINECALLDICT
+            18x1....s1 POP
+            x1..}>
+            x1..?fun_116259 PROC:<{
+            126x1....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            126x1....?fun_ref_026cdd3ff17e82bb INLINECALLDICT
+            18x1....s1 POP
+            x1..}>
+            ..get_abi_ipfs PROC:<{
+            ....x{697066733A2F2F516D4E734D36645465466E58726D5A34334C4771715055536F32474378796432756836417532597834687672775482_} PUSHSLICE
+            ..}>
+            x1..?fun_124230 PROC:<{
+            126x1....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            126x1....?fun_ref_b5b9e67d57f2dcce INLINECALLDICT
+            18x1....s1 POP
+            x1..}>
+            x1..?fun_124513 PROC:<{
+            126x1....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            126x1....?fun_ref_5bdfe841fa412a76 INLINECALLDICT
+            18x1....s1 POP
+            x1..}>
+            x1..?fun_128359 PROC:<{
+            126x1....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            126x1....?fun_ref_f0101fa3fb0bc1f5 INLINECALLDICT
+            18x1....s1 POP
+            x1..}>
+            x1..?fun_128576 PROC:<{
+            126x1....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            126x1....?fun_ref_4065f3bb1951fe13 INLINECALLDICT
+            18x1....s1 POP
+            x1..}>
+            x1..?fun_ref_026cdd3ff17e82bb PROCREF:<{
+            26x1....42 PUSHINT
+            x1..}>
+            x1..?fun_ref_26dd4850c2973b9d PROCREF:<{
+            34x1....-291 PUSHINT
+            x1..}>
+            x1..?fun_ref_32a8f017ec2ceafb PROCREF:<{
+            26x1....-123 PUSHINT
+            x1..}>
+            x4..?fun_ref_364de9562794919e PROCREF:<{
+            18x4....s0 s1 XCHG
+            18x4....<{
+            ......s0 POP
+            ......-1 PUSHINT
+            18x4....}> PUSHCONT
+            18x4....IFJMP
+            18x4....0 PUSHINT
+            18x4....s1 PUSH
+            26x4....SBITS
+            26x4....31 GTINT
+            18x4....<{
+            ......s0 POP
+            ......s0 PUSH
+            ......32 PLDU
+            18x4....}> PUSHCONT
+            18x4....IF
+            26x4....0 EQINT
+            18x4....s0 s1 XCHG
+            26x4....SBITS
+            26x4....33 LESSINT
+            18x4....AND
+            18x4....<{
+            18x4......-1 PUSHINT
+            18x4....}> PUSHCONT
+            18x4....IFJMP
+            ....0 PUSHINT
+            x4..}>
+            x1..?fun_ref_4065f3bb1951fe13 PROCREF:<{
+            26x1....-42 PUSHINT
+            x1..}>
+            x1..?fun_ref_4ed57fb2f9d4e6ca PROCREF:<{
+            23x1....1012300000 PUSHINT
+            x1..}>
+            x1..?fun_ref_553f7869b01170d9 PROCREF:<{
+            26x1....123 PUSHINT
+            x1..}>
+            x1..?fun_ref_5bdfe841fa412a76 PROCREF:<{
+            34x1....672 PUSHINT
+            x1..}>
+            x1..?fun_ref_684a8c99db9474e5 PROCREF:<{
+            23x1....69024612352 PUSHINT
+            x1..}>
+            x1..?fun_ref_7366f20a31928e43 PROCREF:<{
+            26x1....83 PUSHINT
+            x1..}>
+            x1..?fun_ref_7a4cfefa28b39727 PROCREF:<{
+            34x1....291 PUSHINT
+            x1..}>
+            x475..?fun_ref_a05e0042bce184fb PROCREF:<{
+            26x475....c4 PUSH
+            118x475....CTOS
+            18x475....LDREF
+            18x475....s0 s1 XCHG
+            30x475....3 SETGLOBVAR
+            26x475....1 LDI
+            18x475....s0 POP
+            18x475....<{
+            18x402......NULL
+            18x475....}> PUSHCONT
+            18x475....IFJMP
+            26x73....MYADDR
+            34x73....11 PLDU
+            26x73....10 PUSHPOW2
+            18x73....EQUAL
+            34x73....137 THROWIFNOT
+            126x73....?fun_ref_c0ca23818e24f3c9 INLINECALLDICT
+            x475..}>
+            x1..?fun_ref_b5b9e67d57f2dcce PROCREF:<{
+            23x1....136937472 PUSHINT
+            x1..}>
+            x82..?fun_ref_c0ca23818e24f3c9 PROCREF:<{
+            18x82....NULL
+            x82..}>
+            x1..?fun_ref_f0101fa3fb0bc1f5 PROCREF:<{
+            26x1....-83 PUSHINT
+            x1..}>
+            }END>c
+        
+ + \ No newline at end of file diff --git a/src/test/features/output/math_MathTester.code.boc.html b/src/test/features/output/math_MathTester.code.boc.html new file mode 100644 index 000000000..1454ce8a7 --- /dev/null +++ b/src/test/features/output/math_MathTester.code.boc.html @@ -0,0 +1,1760 @@ + + + + + +

Code coverage

+
+                        PROGRAM{
+            ..DECLPROC recv_internal;
+            ..DECLPROC ?fun_67104;
+            ..DECLPROC ?fun_68387;
+            ..DECLPROC ?fun_69278;
+            ..DECLPROC ?fun_71169;
+            ..DECLPROC ?fun_72450;
+            ..DECLPROC ?fun_73407;
+            ..DECLPROC ?fun_75056;
+            ..DECLPROC ?fun_77532;
+            ..DECLPROC ?fun_79121;
+            ..DECLPROC ?fun_80400;
+            ..DECLPROC ?fun_80704;
+            ..DECLPROC ?fun_81661;
+            ..DECLPROC ?fun_81709;
+            ..DECLPROC ?fun_83393;
+            ..DECLPROC ?fun_83863;
+            ..DECLPROC ?fun_84903;
+            ..DECLPROC ?fun_85125;
+            ..DECLPROC ?fun_85530;
+            ..DECLPROC ?fun_88966;
+            ..DECLPROC ?fun_89158;
+            ..DECLPROC ?fun_89358;
+            ..DECLPROC ?fun_90178;
+            ..DECLPROC ?fun_93157;
+            ..DECLPROC ?fun_93221;
+            ..DECLPROC ?fun_94307;
+            ..DECLPROC ?fun_97220;
+            ..DECLPROC ?fun_97284;
+            ..DECLPROC ?fun_98700;
+            ..DECLPROC ?fun_99260;
+            ..DECLPROC ?fun_99450;
+            ..DECLPROC ?fun_99590;
+            ..DECLPROC ?fun_100136;
+            ..DECLPROC ?fun_102829;
+            ..DECLPROC ?fun_103515;
+            ..DECLPROC ?fun_103719;
+            ..DECLPROC ?fun_104201;
+            ..DECLPROC ?fun_106958;
+            ..DECLPROC ?fun_107576;
+            ..DECLPROC ?fun_108394;
+            ..DECLPROC ?fun_108636;
+            ..DECLPROC ?fun_109161;
+            ..DECLPROC ?fun_110321;
+            ..DECLPROC ?fun_111087;
+            ..DECLPROC ?fun_111641;
+            ..DECLPROC ?fun_111973;
+            ..DECLPROC ?fun_112459;
+            ..DECLPROC ?fun_113224;
+            ..DECLPROC supported_interfaces;
+            ..DECLPROC ?fun_114791;
+            ..DECLPROC ?fun_114952;
+            ..DECLPROC lazy_deployment_completed;
+            ..DECLPROC ?fun_115966;
+            ..DECLPROC ?fun_116652;
+            ..DECLPROC ?fun_119081;
+            ..DECLPROC ?fun_120031;
+            ..DECLPROC ?fun_120717;
+            ..DECLPROC ?fun_120881;
+            ..DECLPROC get_abi_ipfs;
+            ..DECLPROC ?fun_123210;
+            ..DECLPROC ?fun_124092;
+            ..DECLPROC ?fun_124910;
+            ..DECLPROC ?fun_125000;
+            ..DECLPROC ?fun_126476;
+            ..DECLPROC ?fun_127339;
+            ..DECLPROC ?fun_128157;
+            ..DECLPROC ?fun_128975;
+            ..DECLPROC ?fun_129050;
+            ..DECLPROC ?fun_ref_06b3879f92816ea8;
+            ..DECLPROC ?fun_ref_0bddee3e66194d71;
+            ..DECLPROC ?fun_ref_1665824c3631042e;
+            ..DECLPROC ?fun_ref_1a5aedf76777daf0;
+            ..DECLPROC ?fun_ref_1dd4b06caa854cc5;
+            ..DECLPROC ?fun_ref_1e8474cb72f85f98;
+            ..DECLPROC ?fun_ref_251a304e2f13da63;
+            ..DECLPROC ?fun_ref_25d3dcb88f5e1c81;
+            ..DECLPROC ?fun_ref_278488dac308342b;
+            ..DECLPROC ?fun_ref_2de3f30de2cef910;
+            ..DECLPROC ?fun_ref_2e8105a0f1ba34b1;
+            ..DECLPROC ?fun_ref_2f14994fd76434ab;
+            ..DECLPROC ?fun_ref_39d09f18c03b037a;
+            ..DECLPROC ?fun_ref_3df1ed9c149f3ddc;
+            ..DECLPROC ?fun_ref_4473d19174b70b6c;
+            ..DECLPROC ?fun_ref_45e06f8a133863ea;
+            ..DECLPROC ?fun_ref_49c7034f83091de6;
+            ..DECLPROC ?fun_ref_5026e72acd3f4702;
+            ..DECLPROC ?fun_ref_502827ca8e8185dc;
+            ..DECLPROC ?fun_ref_52ebac4ebc285034;
+            ..DECLPROC ?fun_ref_5c56423ce8e9ee73;
+            ..DECLPROC ?fun_ref_7299352e77d5a022;
+            ..DECLPROC ?fun_ref_81da9ce5747a9d33;
+            ..DECLPROC ?fun_ref_8b1b2058f0ba717f;
+            ..DECLPROC ?fun_ref_8ffaafaa854bd141;
+            ..DECLPROC ?fun_ref_943f0cebd640e361;
+            ..DECLPROC ?fun_ref_977c111ff228eb82;
+            ..DECLPROC ?fun_ref_9855e2156586b67c;
+            ..DECLPROC ?fun_ref_9a0c5e8798cc0509;
+            ..DECLPROC ?fun_ref_a05e0042bce184fb;
+            ..DECLPROC ?fun_ref_acf9c214ccee2d81;
+            ..DECLPROC ?fun_ref_ad657d0473ebdc2c;
+            ..DECLPROC ?fun_ref_b35400841b15fc2d;
+            ..DECLPROC ?fun_ref_b4fde213ffa24781;
+            ..DECLPROC ?fun_ref_b78be06772ce3abe;
+            ..DECLPROC ?fun_ref_b93b9862cda1783c;
+            ..DECLPROC ?fun_ref_bf9d36be65618269;
+            ..DECLPROC ?fun_ref_c0ca23818e24f3c9;
+            ..DECLPROC ?fun_ref_c29a788970be0722;
+            ..DECLPROC ?fun_ref_c4dfd32efb676592;
+            ..DECLPROC ?fun_ref_d078cffef374dca6;
+            ..DECLPROC ?fun_ref_d5c7d946856b384e;
+            ..DECLPROC ?fun_ref_d90a47bc5659815b;
+            ..DECLPROC ?fun_ref_dac218b13a72ff8a;
+            ..DECLPROC ?fun_ref_dbbd90e91bdad5c0;
+            ..DECLPROC ?fun_ref_e31d986f279fa0fb;
+            ..DECLPROC ?fun_ref_ebb984d6b6cfd144;
+            ..DECLPROC ?fun_ref_ec91dcef8bc865b1;
+            ..DECLPROC ?fun_ref_edec8407367eca46;
+            ..DECLPROC ?fun_ref_ff17a983a407f70d;
+            x2..recv_internal PROC:<{
+            18x2....s0 s1 XCHG
+            118x2....CTOS
+            26x2....4 LDU
+            18x2....s0 s1 XCHG
+            18x2....1 PUSHINT
+            18x2....AND
+            18x2....-1 MULCONST
+            18x2....s0 s1 XCHG
+            26x2....LDMSGADDR
+            18x2....s0 s1 XCHG
+            18x2....s0 PUSH
+            26x2....SBITS
+            34x2....267 PUSHINT
+            18x2....EQUAL
+            34x2....136 THROWIFNOT
+            18x2....s0 PUSH
+            34x2....11 PLDU
+            18x2....s0 PUSH
+            34x2....1279 PUSHINT
+            18x2....EQUAL
+            34x2....137 THROWIF
+            26x2....10 PUSHPOW2
+            18x2....EQUAL
+            34x2....136 THROWIFNOT
+            34x2....s0 s6 s4 PUXCPU
+            18x2....s0 s3 XCHG
+            30x2....4 TUPLE
+            28x2....1 SETGLOBVAR
+            18x2....s0 s2 XCHG
+            29x2....2 SETGLOBVAR
+            126x2....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x2....ROTREV
+            126x2....?fun_ref_1dd4b06caa854cc5 INLINECALLDICT
+            34x2....130 THROWIFNOT
+            18x2....s0 POP
+            18x2....NEWC
+            26x2....3 GETGLOBVAR
+            18x2....s0 s1 XCHG
+            18x2....STREF
+            18x2....-1 PUSHINT
+            18x2....s0 s1 XCHG
+            26x2....1 STI
+            518x2....ENDC
+            26x2....c4 POP
+            x2..}>
+            x5..?fun_67104 PROC:<{
+            126x5....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x5....ROTREV
+            126x5....?fun_ref_9855e2156586b67c INLINECALLDICT
+            18x5....s1 POP
+            x5..}>
+            x5..?fun_68387 PROC:<{
+            126x5....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x5....ROTREV
+            126x5....?fun_ref_b35400841b15fc2d INLINECALLDICT
+            18x5....s1 POP
+            x5..}>
+            x9..?fun_69278 PROC:<{
+            126x9....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x9....ROTREV
+            126x9....?fun_ref_06b3879f92816ea8 INLINECALLDICT
+            18x9....s1 POP
+            x9..}>
+            x5..?fun_71169 PROC:<{
+            126x5....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x5....ROTREV
+            126x5....?fun_ref_25d3dcb88f5e1c81 INLINECALLDICT
+            18x5....s1 POP
+            x5..}>
+            x3..?fun_72450 PROC:<{
+            126x3....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x3....ROTREV
+            126x3....?fun_ref_2de3f30de2cef910 INLINECALLDICT
+            18x3....s1 POP
+            x3..}>
+            x3..?fun_73407 PROC:<{
+            126x3....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x3....ROTREV
+            126x3....?fun_ref_dac218b13a72ff8a INLINECALLDICT
+            18x3....s1 POP
+            x3..}>
+            x3..?fun_75056 PROC:<{
+            126x3....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x3....ROTREV
+            126x3....?fun_ref_81da9ce5747a9d33 INLINECALLDICT
+            18x3....s1 POP
+            x3..}>
+            x5..?fun_77532 PROC:<{
+            126x5....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x5....ROTREV
+            126x5....?fun_ref_977c111ff228eb82 INLINECALLDICT
+            18x5....s1 POP
+            x5..}>
+            x3..?fun_79121 PROC:<{
+            126x3....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x3....ROTREV
+            126x3....?fun_ref_ec91dcef8bc865b1 INLINECALLDICT
+            18x3....s1 POP
+            x3..}>
+            x2..?fun_80400 PROC:<{
+            126x2....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x2....ROTREV
+            126x2....?fun_ref_edec8407367eca46 INLINECALLDICT
+            18x2....s1 POP
+            x2..}>
+            x5..?fun_80704 PROC:<{
+            126x5....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x5....ROTREV
+            126x5....?fun_ref_d078cffef374dca6 INLINECALLDICT
+            18x5....s1 POP
+            x5..}>
+            x5..?fun_81661 PROC:<{
+            126x5....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x5....ROTREV
+            126x5....?fun_ref_278488dac308342b INLINECALLDICT
+            18x5....s1 POP
+            x5..}>
+            x2..?fun_81709 PROC:<{
+            126x2....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x2....ROTREV
+            126x2....?fun_ref_b4fde213ffa24781 INLINECALLDICT
+            18x2....s1 POP
+            x2..}>
+            ..?fun_83393 PROC:<{
+            ....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            ....ROTREV
+            ....?fun_ref_3df1ed9c149f3ddc INLINECALLDICT
+            ....s1 POP
+            ..}>
+            x2..?fun_83863 PROC:<{
+            126x2....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x2....ROTREV
+            126x2....?fun_ref_2e8105a0f1ba34b1 INLINECALLDICT
+            18x2....s1 POP
+            x2..}>
+            x5..?fun_84903 PROC:<{
+            126x5....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x5....ROTREV
+            126x5....?fun_ref_943f0cebd640e361 INLINECALLDICT
+            18x5....s1 POP
+            x5..}>
+            x1..?fun_85125 PROC:<{
+            126x1....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x1....ROTREV
+            126x1....?fun_ref_1a5aedf76777daf0 INLINECALLDICT
+            18x1....s1 POP
+            x1..}>
+            x9..?fun_85530 PROC:<{
+            126x9....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x9....ROTREV
+            126x9....?fun_ref_502827ca8e8185dc INLINECALLDICT
+            18x9....s1 POP
+            x9..}>
+            x3..?fun_88966 PROC:<{
+            126x3....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x3....ROTREV
+            126x3....?fun_ref_9a0c5e8798cc0509 INLINECALLDICT
+            18x3....s1 POP
+            x3..}>
+            x4..?fun_89158 PROC:<{
+            126x4....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x4....s0 s1 XCHG
+            126x4....?fun_ref_0bddee3e66194d71 INLINECALLDICT
+            18x4....s1 POP
+            x4..}>
+            ..?fun_89358 PROC:<{
+            ....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            ....ROTREV
+            ....?fun_ref_49c7034f83091de6 INLINECALLDICT
+            ....s1 POP
+            ..}>
+            x3..?fun_90178 PROC:<{
+            126x3....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x3....ROTREV
+            126x3....?fun_ref_ebb984d6b6cfd144 INLINECALLDICT
+            18x3....s1 POP
+            x3..}>
+            x3..?fun_93157 PROC:<{
+            126x3....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x3....ROTREV
+            126x3....?fun_ref_d5c7d946856b384e INLINECALLDICT
+            18x3....s1 POP
+            x3..}>
+            x3..?fun_93221 PROC:<{
+            18x3....s0 PUSH
+            18x3....ISNULL
+            18x3....<{
+            18x1......s0 POP
+            18x1......NULL
+            18x3....}> PUSHCONT
+            26x3....<{
+            18x2......s0 PUSH
+            26x2......SBITS
+            34x2......267 PUSHINT
+            18x2......EQUAL
+            34x2......136 THROWIFNOT
+            18x2......s0 PUSH
+            34x2......11 PLDU
+            18x2......s0 PUSH
+            34x2......1279 PUSHINT
+            18x2......EQUAL
+            34x2......137 THROWIF
+            26x2......10 PUSHPOW2
+            18x2......EQUAL
+            34x2......136 THROWIFNOT
+            26x3....}> PUSHCONT
+            18x3....IFELSE
+            126x3....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x3....s0 s1 XCHG
+            126x3....?fun_ref_0bddee3e66194d71 INLINECALLDICT
+            18x3....s1 POP
+            x3..}>
+            x9..?fun_94307 PROC:<{
+            18x9....s1 PUSH
+            18x9....ISNULL
+            18x9....<{
+            18x4......s1 POP
+            18x4......NULL
+            18x9....}> PUSHCONT
+            26x9....<{
+            18x5......s0 s1 XCHG
+            18x5......s0 PUSH
+            26x5......SBITS
+            34x5......267 PUSHINT
+            18x5......EQUAL
+            34x5......136 THROWIFNOT
+            18x5......s0 PUSH
+            34x5......11 PLDU
+            18x5......s0 PUSH
+            34x5......1279 PUSHINT
+            18x5......EQUAL
+            34x5......137 THROWIF
+            26x5......10 PUSHPOW2
+            18x5......EQUAL
+            34x5......136 THROWIFNOT
+            26x9....}> PUSHCONT
+            18x9....IFELSE
+            18x9....s1 PUSH
+            18x9....ISNULL
+            18x9....<{
+            18x4......s1 POP
+            18x4......NULL
+            18x9....}> PUSHCONT
+            26x9....<{
+            18x5......s0 s1 XCHG
+            18x5......s0 PUSH
+            26x5......SBITS
+            34x5......267 PUSHINT
+            18x5......EQUAL
+            34x5......136 THROWIFNOT
+            18x5......s0 PUSH
+            34x5......11 PLDU
+            18x5......s0 PUSH
+            34x5......1279 PUSHINT
+            18x5......EQUAL
+            34x5......137 THROWIF
+            26x5......10 PUSHPOW2
+            18x5......EQUAL
+            34x5......136 THROWIFNOT
+            26x9....}> PUSHCONT
+            18x9....IFELSE
+            126x9....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x9....ROTREV
+            126x9....?fun_ref_8ffaafaa854bd141 INLINECALLDICT
+            18x9....s1 POP
+            x9..}>
+            x5..?fun_97220 PROC:<{
+            126x5....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x5....ROTREV
+            126x5....?fun_ref_251a304e2f13da63 INLINECALLDICT
+            18x5....s1 POP
+            x5..}>
+            x3..?fun_97284 PROC:<{
+            126x3....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x3....s0 s1 XCHG
+            126x3....?fun_ref_0bddee3e66194d71 INLINECALLDICT
+            18x3....s1 POP
+            x3..}>
+            x5..?fun_98700 PROC:<{
+            18x5....s1 PUSH
+            18x5....ISNULL
+            18x5....<{
+            18x2......s1 POP
+            18x2......NULL
+            18x5....}> PUSHCONT
+            26x5....<{
+            18x3......s0 s1 XCHG
+            18x3......s0 PUSH
+            26x3......SBITS
+            34x3......267 PUSHINT
+            18x3......EQUAL
+            34x3......136 THROWIFNOT
+            18x3......s0 PUSH
+            34x3......11 PLDU
+            18x3......s0 PUSH
+            34x3......1279 PUSHINT
+            18x3......EQUAL
+            34x3......137 THROWIF
+            26x3......10 PUSHPOW2
+            18x3......EQUAL
+            34x3......136 THROWIFNOT
+            26x5....}> PUSHCONT
+            18x5....IFELSE
+            18x5....s0 s1 XCHG
+            18x5....s0 PUSH
+            26x5....SBITS
+            34x5....267 PUSHINT
+            18x5....EQUAL
+            34x5....136 THROWIFNOT
+            18x5....s0 PUSH
+            34x5....11 PLDU
+            18x5....s0 PUSH
+            34x5....1279 PUSHINT
+            18x5....EQUAL
+            34x5....137 THROWIF
+            26x5....10 PUSHPOW2
+            18x5....EQUAL
+            34x5....136 THROWIFNOT
+            126x5....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x5....ROTREV
+            126x5....?fun_ref_c4dfd32efb676592 INLINECALLDICT
+            18x5....s1 POP
+            x5..}>
+            x1..?fun_99260 PROC:<{
+            126x1....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x1....ROTREV
+            126x1....?fun_ref_1e8474cb72f85f98 INLINECALLDICT
+            18x1....s1 POP
+            x1..}>
+            x9..?fun_99450 PROC:<{
+            126x9....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x9....ROTREV
+            126x9....?fun_ref_52ebac4ebc285034 INLINECALLDICT
+            18x9....s1 POP
+            x9..}>
+            x3..?fun_99590 PROC:<{
+            18x3....s0 PUSH
+            18x3....ISNULL
+            18x3....<{
+            18x1......s0 POP
+            18x1......NULL
+            18x3....}> PUSHCONT
+            26x3....<{
+            18x2......s0 PUSH
+            26x2......SBITS
+            34x2......267 PUSHINT
+            18x2......EQUAL
+            34x2......136 THROWIFNOT
+            18x2......s0 PUSH
+            34x2......11 PLDU
+            18x2......s0 PUSH
+            34x2......1279 PUSHINT
+            18x2......EQUAL
+            34x2......137 THROWIF
+            26x2......10 PUSHPOW2
+            18x2......EQUAL
+            34x2......136 THROWIFNOT
+            26x3....}> PUSHCONT
+            18x3....IFELSE
+            126x3....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x3....s0 s1 XCHG
+            126x3....?fun_ref_dbbd90e91bdad5c0 INLINECALLDICT
+            18x3....s1 POP
+            x3..}>
+            x5..?fun_100136 PROC:<{
+            126x5....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x5....ROTREV
+            126x5....?fun_ref_9855e2156586b67c INLINECALLDICT
+            18x5....s1 POP
+            x5..}>
+            x5..?fun_102829 PROC:<{
+            18x5....s0 s1 XCHG
+            18x5....s0 PUSH
+            26x5....SBITS
+            34x5....267 PUSHINT
+            18x5....EQUAL
+            34x5....136 THROWIFNOT
+            18x5....s0 PUSH
+            34x5....11 PLDU
+            18x5....s0 PUSH
+            34x5....1279 PUSHINT
+            18x5....EQUAL
+            34x5....137 THROWIF
+            26x5....10 PUSHPOW2
+            18x5....EQUAL
+            34x5....136 THROWIFNOT
+            18x5....s1 PUSH
+            18x5....ISNULL
+            18x5....<{
+            18x2......s1 POP
+            18x2......NULL
+            18x5....}> PUSHCONT
+            26x5....<{
+            18x3......s0 s1 XCHG
+            18x3......s0 PUSH
+            26x3......SBITS
+            34x3......267 PUSHINT
+            18x3......EQUAL
+            34x3......136 THROWIFNOT
+            18x3......s0 PUSH
+            34x3......11 PLDU
+            18x3......s0 PUSH
+            34x3......1279 PUSHINT
+            18x3......EQUAL
+            34x3......137 THROWIF
+            26x3......10 PUSHPOW2
+            18x3......EQUAL
+            34x3......136 THROWIFNOT
+            26x5....}> PUSHCONT
+            18x5....IFELSE
+            126x5....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x5....ROTREV
+            126x5....?fun_ref_ad657d0473ebdc2c INLINECALLDICT
+            18x5....s1 POP
+            x5..}>
+            x3..?fun_103515 PROC:<{
+            126x3....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x3....ROTREV
+            126x3....?fun_ref_bf9d36be65618269 INLINECALLDICT
+            18x3....s1 POP
+            x3..}>
+            x3..?fun_103719 PROC:<{
+            126x3....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x3....s0 s1 XCHG
+            126x3....?fun_ref_dbbd90e91bdad5c0 INLINECALLDICT
+            18x3....s1 POP
+            x3..}>
+            x5..?fun_104201 PROC:<{
+            126x5....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x5....ROTREV
+            126x5....?fun_ref_25d3dcb88f5e1c81 INLINECALLDICT
+            18x5....s1 POP
+            x5..}>
+            x3..?fun_106958 PROC:<{
+            18x3....s0 s1 XCHG
+            18x3....s0 PUSH
+            26x3....SBITS
+            34x3....267 PUSHINT
+            18x3....EQUAL
+            34x3....136 THROWIFNOT
+            18x3....s0 PUSH
+            34x3....11 PLDU
+            18x3....s0 PUSH
+            34x3....1279 PUSHINT
+            18x3....EQUAL
+            34x3....137 THROWIF
+            26x3....10 PUSHPOW2
+            18x3....EQUAL
+            34x3....136 THROWIFNOT
+            18x3....s0 s1 XCHG
+            18x3....s0 PUSH
+            26x3....SBITS
+            34x3....267 PUSHINT
+            18x3....EQUAL
+            34x3....136 THROWIFNOT
+            18x3....s0 PUSH
+            34x3....11 PLDU
+            18x3....s0 PUSH
+            34x3....1279 PUSHINT
+            18x3....EQUAL
+            34x3....137 THROWIF
+            26x3....10 PUSHPOW2
+            18x3....EQUAL
+            34x3....136 THROWIFNOT
+            126x3....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x3....ROTREV
+            126x3....?fun_ref_d90a47bc5659815b INLINECALLDICT
+            18x3....s1 POP
+            x3..}>
+            x5..?fun_107576 PROC:<{
+            126x5....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x5....ROTREV
+            126x5....?fun_ref_39d09f18c03b037a INLINECALLDICT
+            18x5....s1 POP
+            x5..}>
+            x3..?fun_108394 PROC:<{
+            126x3....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x3....ROTREV
+            126x3....?fun_ref_dac218b13a72ff8a INLINECALLDICT
+            18x3....s1 POP
+            x3..}>
+            ..?fun_108636 PROC:<{
+            ....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            ....ROTREV
+            ....?fun_ref_acf9c214ccee2d81 INLINECALLDICT
+            ....s1 POP
+            ..}>
+            x3..?fun_109161 PROC:<{
+            126x3....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x3....ROTREV
+            126x3....?fun_ref_8b1b2058f0ba717f INLINECALLDICT
+            18x3....s1 POP
+            x3..}>
+            ..?fun_110321 PROC:<{
+            ....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            ....ROTREV
+            ....?fun_ref_1665824c3631042e INLINECALLDICT
+            ....s1 POP
+            ..}>
+            x9..?fun_111087 PROC:<{
+            18x9....s1 PUSH
+            18x9....ISNULL
+            18x9....<{
+            18x4......s1 POP
+            18x4......NULL
+            18x9....}> PUSHCONT
+            26x9....<{
+            18x5......s0 s1 XCHG
+            18x5......s0 PUSH
+            26x5......SBITS
+            34x5......267 PUSHINT
+            18x5......EQUAL
+            34x5......136 THROWIFNOT
+            18x5......s0 PUSH
+            34x5......11 PLDU
+            18x5......s0 PUSH
+            34x5......1279 PUSHINT
+            18x5......EQUAL
+            34x5......137 THROWIF
+            26x5......10 PUSHPOW2
+            18x5......EQUAL
+            34x5......136 THROWIFNOT
+            26x9....}> PUSHCONT
+            18x9....IFELSE
+            18x9....s1 PUSH
+            18x9....ISNULL
+            18x9....<{
+            18x4......s1 POP
+            18x4......NULL
+            18x9....}> PUSHCONT
+            26x9....<{
+            18x5......s0 s1 XCHG
+            18x5......s0 PUSH
+            26x5......SBITS
+            34x5......267 PUSHINT
+            18x5......EQUAL
+            34x5......136 THROWIFNOT
+            18x5......s0 PUSH
+            34x5......11 PLDU
+            18x5......s0 PUSH
+            34x5......1279 PUSHINT
+            18x5......EQUAL
+            34x5......137 THROWIF
+            26x5......10 PUSHPOW2
+            18x5......EQUAL
+            34x5......136 THROWIFNOT
+            26x9....}> PUSHCONT
+            18x9....IFELSE
+            126x9....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x9....ROTREV
+            126x9....?fun_ref_45e06f8a133863ea INLINECALLDICT
+            18x9....s1 POP
+            x9..}>
+            x5..?fun_111641 PROC:<{
+            126x5....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x5....ROTREV
+            126x5....?fun_ref_c29a788970be0722 INLINECALLDICT
+            18x5....s1 POP
+            x5..}>
+            x4..?fun_111973 PROC:<{
+            126x4....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x4....s0 s1 XCHG
+            126x4....?fun_ref_dbbd90e91bdad5c0 INLINECALLDICT
+            18x4....s1 POP
+            x4..}>
+            x9..?fun_112459 PROC:<{
+            126x9....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x9....ROTREV
+            126x9....?fun_ref_06b3879f92816ea8 INLINECALLDICT
+            18x9....s1 POP
+            x9..}>
+            x3..?fun_113224 PROC:<{
+            126x3....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x3....ROTREV
+            126x3....?fun_ref_5026e72acd3f4702 INLINECALLDICT
+            18x3....s1 POP
+            x3..}>
+            ..supported_interfaces PROC:<{
+            ....123515602279859691144772641439386770278 PUSHINT
+            ....209801025412363888721030803524359905849 PUSHINT
+            ....42980537499636128163026532310500881091 PUSHINT
+            ....36993126140238121407019133875791708966 PUSHINT
+            ....209474421377847335869795010607481022628 PUSHINT
+            ..}>
+            x2..?fun_114791 PROC:<{
+            126x2....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x2....ROTREV
+            126x2....?fun_ref_edec8407367eca46 INLINECALLDICT
+            18x2....s1 POP
+            x2..}>
+            x5..?fun_114952 PROC:<{
+            18x5....s1 PUSH
+            18x5....ISNULL
+            18x5....<{
+            18x2......s1 POP
+            18x2......NULL
+            18x5....}> PUSHCONT
+            26x5....<{
+            18x3......s0 s1 XCHG
+            18x3......s0 PUSH
+            26x3......SBITS
+            34x3......267 PUSHINT
+            18x3......EQUAL
+            34x3......136 THROWIFNOT
+            18x3......s0 PUSH
+            34x3......11 PLDU
+            18x3......s0 PUSH
+            34x3......1279 PUSHINT
+            18x3......EQUAL
+            34x3......137 THROWIF
+            26x3......10 PUSHPOW2
+            18x3......EQUAL
+            34x3......136 THROWIFNOT
+            26x5....}> PUSHCONT
+            18x5....IFELSE
+            18x5....s0 s1 XCHG
+            18x5....s0 PUSH
+            26x5....SBITS
+            34x5....267 PUSHINT
+            18x5....EQUAL
+            34x5....136 THROWIFNOT
+            18x5....s0 PUSH
+            34x5....11 PLDU
+            18x5....s0 PUSH
+            34x5....1279 PUSHINT
+            18x5....EQUAL
+            34x5....137 THROWIF
+            26x5....10 PUSHPOW2
+            18x5....EQUAL
+            34x5....136 THROWIFNOT
+            126x5....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x5....ROTREV
+            126x5....?fun_ref_ff17a983a407f70d INLINECALLDICT
+            18x5....s1 POP
+            x5..}>
+            ..lazy_deployment_completed PROC:<{
+            ....c4 PUSH
+            ....CTOS
+            ....1 LDI
+            ....s0 s1 XCHG
+            ..}>
+            x9..?fun_115966 PROC:<{
+            126x9....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x9....ROTREV
+            126x9....?fun_ref_81da9ce5747a9d33 INLINECALLDICT
+            18x9....s1 POP
+            x9..}>
+            x5..?fun_116652 PROC:<{
+            126x5....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x5....ROTREV
+            126x5....?fun_ref_278488dac308342b INLINECALLDICT
+            18x5....s1 POP
+            x5..}>
+            x5..?fun_119081 PROC:<{
+            18x5....s0 s1 XCHG
+            18x5....s0 PUSH
+            26x5....SBITS
+            34x5....267 PUSHINT
+            18x5....EQUAL
+            34x5....136 THROWIFNOT
+            18x5....s0 PUSH
+            34x5....11 PLDU
+            18x5....s0 PUSH
+            34x5....1279 PUSHINT
+            18x5....EQUAL
+            34x5....137 THROWIF
+            26x5....10 PUSHPOW2
+            18x5....EQUAL
+            34x5....136 THROWIFNOT
+            18x5....s1 PUSH
+            18x5....ISNULL
+            18x5....<{
+            18x2......s1 POP
+            18x2......NULL
+            18x5....}> PUSHCONT
+            26x5....<{
+            18x3......s0 s1 XCHG
+            18x3......s0 PUSH
+            26x3......SBITS
+            34x3......267 PUSHINT
+            18x3......EQUAL
+            34x3......136 THROWIFNOT
+            18x3......s0 PUSH
+            34x3......11 PLDU
+            18x3......s0 PUSH
+            34x3......1279 PUSHINT
+            18x3......EQUAL
+            34x3......137 THROWIF
+            26x3......10 PUSHPOW2
+            18x3......EQUAL
+            34x3......136 THROWIFNOT
+            26x5....}> PUSHCONT
+            18x5....IFELSE
+            126x5....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x5....ROTREV
+            126x5....?fun_ref_2f14994fd76434ab INLINECALLDICT
+            18x5....s1 POP
+            x5..}>
+            x3..?fun_120031 PROC:<{
+            126x3....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x3....ROTREV
+            126x3....?fun_ref_52ebac4ebc285034 INLINECALLDICT
+            18x3....s1 POP
+            x3..}>
+            x5..?fun_120717 PROC:<{
+            126x5....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x5....ROTREV
+            126x5....?fun_ref_977c111ff228eb82 INLINECALLDICT
+            18x5....s1 POP
+            x5..}>
+            x2..?fun_120881 PROC:<{
+            126x2....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x2....ROTREV
+            126x2....?fun_ref_2e8105a0f1ba34b1 INLINECALLDICT
+            18x2....s1 POP
+            x2..}>
+            ..get_abi_ipfs PROC:<{
+            ....x{697066733A2F2F516D4E637167555A53426976636150655974634A7A67577131487872337563504A38657A577436376B4A5642456E82_} PUSHSLICE
+            ..}>
+            x3..?fun_123210 PROC:<{
+            18x3....s0 s1 XCHG
+            18x3....s0 PUSH
+            26x3....SBITS
+            34x3....267 PUSHINT
+            18x3....EQUAL
+            34x3....136 THROWIFNOT
+            18x3....s0 PUSH
+            34x3....11 PLDU
+            18x3....s0 PUSH
+            34x3....1279 PUSHINT
+            18x3....EQUAL
+            34x3....137 THROWIF
+            26x3....10 PUSHPOW2
+            18x3....EQUAL
+            34x3....136 THROWIFNOT
+            18x3....s0 s1 XCHG
+            18x3....s0 PUSH
+            26x3....SBITS
+            34x3....267 PUSHINT
+            18x3....EQUAL
+            34x3....136 THROWIFNOT
+            18x3....s0 PUSH
+            34x3....11 PLDU
+            18x3....s0 PUSH
+            34x3....1279 PUSHINT
+            18x3....EQUAL
+            34x3....137 THROWIF
+            26x3....10 PUSHPOW2
+            18x3....EQUAL
+            34x3....136 THROWIFNOT
+            126x3....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x3....ROTREV
+            126x3....?fun_ref_b78be06772ce3abe INLINECALLDICT
+            18x3....s1 POP
+            x3..}>
+            x5..?fun_124092 PROC:<{
+            126x5....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x5....ROTREV
+            126x5....?fun_ref_5c56423ce8e9ee73 INLINECALLDICT
+            18x5....s1 POP
+            x5..}>
+            x3..?fun_124910 PROC:<{
+            126x3....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x3....ROTREV
+            126x3....?fun_ref_ec91dcef8bc865b1 INLINECALLDICT
+            18x3....s1 POP
+            x3..}>
+            x1..?fun_125000 PROC:<{
+            126x1....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x1....ROTREV
+            126x1....?fun_ref_1a5aedf76777daf0 INLINECALLDICT
+            18x1....s1 POP
+            x1..}>
+            ..?fun_126476 PROC:<{
+            ....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            ....ROTREV
+            ....?fun_ref_b4fde213ffa24781 INLINECALLDICT
+            ....s1 POP
+            ..}>
+            x3..?fun_127339 PROC:<{
+            126x3....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x3....ROTREV
+            126x3....?fun_ref_4473d19174b70b6c INLINECALLDICT
+            18x3....s1 POP
+            x3..}>
+            x5..?fun_128157 PROC:<{
+            126x5....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x5....ROTREV
+            126x5....?fun_ref_7299352e77d5a022 INLINECALLDICT
+            18x5....s1 POP
+            x5..}>
+            x9..?fun_128975 PROC:<{
+            126x9....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x9....ROTREV
+            126x9....?fun_ref_502827ca8e8185dc INLINECALLDICT
+            18x9....s1 POP
+            x9..}>
+            x1..?fun_129050 PROC:<{
+            126x1....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x1....ROTREV
+            126x1....?fun_ref_1e8474cb72f85f98 INLINECALLDICT
+            18x1....s1 POP
+            x1..}>
+            x18..?fun_ref_06b3879f92816ea8 PROCREF:<{
+            18x18....s1 PUSH
+            18x18....ISNULL
+            18x18....s1 PUSH
+            18x18....ISNULL
+            18x18....DUP2
+            18x18....AND
+            18x18....<{
+            26x4......4 BLKDROP
+            18x4......-1 PUSHINT
+            18x18....}> PUSHCONT
+            26x18....<{
+            18x14......s0 s1 XCHG
+            18x14......NOT
+            18x14......s0 s1 XCHG
+            18x14......NOT
+            18x14......AND
+            18x14......<{
+            18x6........s0 s1 XCHG
+            526x6........HASHSU
+            18x6........s0 s1 XCHG
+            526x6........HASHSU
+            18x6........EQUAL
+            18x14......}> PUSHCONT
+            18x14......<{
+            18x8........DROP2
+            18x8........0 PUSHINT
+            18x14......}> PUSHCONT
+            18x14......IFELSE
+            26x18....}> PUSHCONT
+            18x18....IFELSE
+            x18..}>
+            x10..?fun_ref_0bddee3e66194d71 PROCREF:<{
+            18x10....ISNULL
+            18x10....NOT
+            x10..}>
+            ..?fun_ref_1665824c3631042e PROCREF:<{
+            ....LSHIFTX
+            ..}>
+            x2..?fun_ref_1a5aedf76777daf0 PROCREF:<{
+            26x2....false 0 false 1 0 DIV
+            x2..}>
+            x58..?fun_ref_1dd4b06caa854cc5 PROCREF:<{
+            18x58....s0 s1 XCHG
+            18x58....<{
+            ......s0 POP
+            ......-1 PUSHINT
+            18x58....}> PUSHCONT
+            18x58....IFJMP
+            18x58....0 PUSHINT
+            18x58....s1 PUSH
+            26x58....SBITS
+            26x58....31 GTINT
+            18x58....<{
+            18x58......s0 POP
+            18x58......s0 PUSH
+            34x58......32 PLDU
+            18x58....}> PUSHCONT
+            18x58....IF
+            23x58....2490013878 PUSHINT
+            18x58....EQUAL
+            26x58....<{
+            26x58......32 LDU
+            18x58......s0 s1 XCHG
+            23x58......2490013878 PUSHINT
+            18x58......EQUAL
+            34x58......129 THROWIFNOT
+            26x58......64 LDU
+            18x58......s0 s1 XCHG
+            18x58......s1 POP
+            18x58......NEWC
+            18x58......s0 s1 XCHG
+            23x58......2952335191 PUSHINT
+            18x58......ROT
+            26x58......32 STU
+            26x58......64 STU
+            518x58......ENDC
+            26x58......2 GETGLOBVAR
+            18x58......s0 s1 XCHG
+            18x58......0 PUSHINT
+            18x58......NULL
+            126x58......?fun_ref_e31d986f279fa0fb INLINECALLDICT
+            18x58......-1 PUSHINT
+            26x58....}> PUSHCONT
+            18x58....IFJMP
+            ....s0 POP
+            ....0 PUSHINT
+            x58..}>
+            x2..?fun_ref_1e8474cb72f85f98 PROCREF:<{
+            18x2....MUL
+            x2..}>
+            x5..?fun_ref_251a304e2f13da63 PROCREF:<{
+            18x5....s1 PUSH
+            18x5....ISNULL
+            18x5....s1 PUSH
+            18x5....ISNULL
+            18x5....DUP2
+            18x5....AND
+            18x5....<{
+            26x1......4 BLKDROP
+            18x1......-1 PUSHINT
+            18x5....}> PUSHCONT
+            18x5....<{
+            18x4......s0 s1 XCHG
+            18x4......NOT
+            18x4......s0 s1 XCHG
+            18x4......NOT
+            18x4......AND
+            18x4......<{
+            18x2........EQUAL
+            18x4......}> PUSHCONT
+            18x4......<{
+            18x2........DROP2
+            18x2........0 PUSHINT
+            18x4......}> PUSHCONT
+            18x4......IFELSE
+            18x5....}> PUSHCONT
+            18x5....IFELSE
+            x5..}>
+            x10..?fun_ref_25d3dcb88f5e1c81 PROCREF:<{
+            18x10....s0 s1 XCHG
+            18x10....s1 PUSH
+            18x10....ISNULL
+            18x10....<{
+            18x4......DROP2
+            18x4......0 PUSHINT
+            18x10....}> PUSHCONT
+            18x10....<{
+            18x6......s0 s1 XCHG
+            526x6......HASHSU
+            18x6......s0 s1 XCHG
+            526x6......HASHSU
+            18x6......EQUAL
+            18x10....}> PUSHCONT
+            18x10....IFELSE
+            x10..}>
+            x10..?fun_ref_278488dac308342b PROCREF:<{
+            18x10....s1 PUSH
+            18x10....ISNULL
+            18x10....<{
+            18x4......DROP2
+            18x4......-1 PUSHINT
+            18x10....}> PUSHCONT
+            18x10....<{
+            18x6......s0 s1 XCHG
+            526x6......HASHSU
+            18x6......s0 s1 XCHG
+            526x6......HASHSU
+            18x6......NEQ
+            18x10....}> PUSHCONT
+            18x10....IFELSE
+            x10..}>
+            x3..?fun_ref_2de3f30de2cef910 PROCREF:<{
+            18x3....s1 PUSH
+            18x3....ISNULL
+            18x3....<{
+            18x1......DROP2
+            18x1......0 PUSHINT
+            18x3....}> PUSHCONT
+            18x3....<{
+            18x2......EQUAL
+            18x3....}> PUSHCONT
+            18x3....IFELSE
+            x3..}>
+            x5..?fun_ref_2e8105a0f1ba34b1 PROCREF:<{
+            18x5....ADD
+            x5..}>
+            x5..?fun_ref_2f14994fd76434ab PROCREF:<{
+            18x5....s0 s1 XCHG
+            18x5....s1 PUSH
+            18x5....ISNULL
+            18x5....<{
+            18x2......DROP2
+            18x2......0 PUSHINT
+            18x5....}> PUSHCONT
+            18x5....<{
+            26x3......SDEQ
+            18x5....}> PUSHCONT
+            18x5....IFELSE
+            x5..}>
+            x5..?fun_ref_39d09f18c03b037a PROCREF:<{
+            18x5....s0 s1 XCHG
+            18x5....s1 PUSH
+            18x5....ISNULL
+            18x5....<{
+            18x2......DROP2
+            18x2......0 PUSHINT
+            18x5....}> PUSHCONT
+            18x5....<{
+            18x3......s0 s1 XCHG
+            26x3......HASHCU
+            18x3......s0 s1 XCHG
+            26x3......HASHCU
+            18x3......EQUAL
+            18x5....}> PUSHCONT
+            18x5....IFELSE
+            x5..}>
+            ..?fun_ref_3df1ed9c149f3ddc PROCREF:<{
+            ....OR
+            ..}>
+            x3..?fun_ref_4473d19174b70b6c PROCREF:<{
+            18x3....LEQ
+            x3..}>
+            x9..?fun_ref_45e06f8a133863ea PROCREF:<{
+            18x9....s1 PUSH
+            18x9....ISNULL
+            18x9....s1 PUSH
+            18x9....ISNULL
+            18x9....DUP2
+            18x9....AND
+            18x9....<{
+            26x2......4 BLKDROP
+            18x2......-1 PUSHINT
+            18x9....}> PUSHCONT
+            18x9....<{
+            18x7......s0 s1 XCHG
+            18x7......NOT
+            18x7......s0 s1 XCHG
+            18x7......NOT
+            18x7......AND
+            18x7......<{
+            26x3........SDEQ
+            18x7......}> PUSHCONT
+            18x7......<{
+            18x4........DROP2
+            18x4........0 PUSHINT
+            18x7......}> PUSHCONT
+            18x7......IFELSE
+            18x9....}> PUSHCONT
+            18x9....IFELSE
+            x9..}>
+            ..?fun_ref_49c7034f83091de6 PROCREF:<{
+            ....RSHIFTX
+            ..}>
+            x3..?fun_ref_5026e72acd3f4702 PROCREF:<{
+            18x3....LESS
+            x3..}>
+            x18..?fun_ref_502827ca8e8185dc PROCREF:<{
+            18x18....s1 PUSH
+            18x18....ISNULL
+            18x18....s1 PUSH
+            18x18....ISNULL
+            18x18....DUP2
+            18x18....AND
+            18x18....<{
+            26x4......4 BLKDROP
+            18x4......0 PUSHINT
+            18x18....}> PUSHCONT
+            26x18....<{
+            18x14......s0 s1 XCHG
+            18x14......NOT
+            18x14......s0 s1 XCHG
+            18x14......NOT
+            18x14......AND
+            18x14......<{
+            18x6........s0 s1 XCHG
+            526x6........HASHSU
+            18x6........s0 s1 XCHG
+            526x6........HASHSU
+            18x6........NEQ
+            18x14......}> PUSHCONT
+            18x14......<{
+            18x8........DROP2
+            18x8........-1 PUSHINT
+            18x14......}> PUSHCONT
+            18x14......IFELSE
+            26x18....}> PUSHCONT
+            18x18....IFELSE
+            x18..}>
+            x12..?fun_ref_52ebac4ebc285034 PROCREF:<{
+            18x12....s1 PUSH
+            18x12....ISNULL
+            18x12....s1 PUSH
+            18x12....ISNULL
+            18x12....DUP2
+            18x12....AND
+            18x12....<{
+            26x2......4 BLKDROP
+            18x2......-1 PUSHINT
+            18x12....}> PUSHCONT
+            26x12....<{
+            18x10......s0 s1 XCHG
+            18x10......NOT
+            18x10......s0 s1 XCHG
+            18x10......NOT
+            18x10......AND
+            18x10......<{
+            18x6........s0 s1 XCHG
+            26x6........HASHCU
+            18x6........s0 s1 XCHG
+            26x6........HASHCU
+            18x6........EQUAL
+            18x10......}> PUSHCONT
+            18x10......<{
+            18x4........DROP2
+            18x4........0 PUSHINT
+            18x10......}> PUSHCONT
+            18x10......IFELSE
+            26x12....}> PUSHCONT
+            18x12....IFELSE
+            x12..}>
+            x5..?fun_ref_5c56423ce8e9ee73 PROCREF:<{
+            18x5....s0 s1 XCHG
+            18x5....s1 PUSH
+            18x5....ISNULL
+            18x5....<{
+            18x2......DROP2
+            18x2......-1 PUSHINT
+            18x5....}> PUSHCONT
+            18x5....<{
+            18x3......s0 s1 XCHG
+            26x3......HASHCU
+            18x3......s0 s1 XCHG
+            26x3......HASHCU
+            18x3......NEQ
+            18x5....}> PUSHCONT
+            18x5....IFELSE
+            x5..}>
+            x5..?fun_ref_7299352e77d5a022 PROCREF:<{
+            18x5....s1 PUSH
+            18x5....ISNULL
+            18x5....<{
+            18x2......DROP2
+            18x2......-1 PUSHINT
+            18x5....}> PUSHCONT
+            18x5....<{
+            18x3......s0 s1 XCHG
+            26x3......HASHCU
+            18x3......s0 s1 XCHG
+            26x3......HASHCU
+            18x3......NEQ
+            18x5....}> PUSHCONT
+            18x5....IFELSE
+            x5..}>
+            x12..?fun_ref_81da9ce5747a9d33 PROCREF:<{
+            18x12....s1 PUSH
+            18x12....ISNULL
+            18x12....s1 PUSH
+            18x12....ISNULL
+            18x12....DUP2
+            18x12....AND
+            18x12....<{
+            26x2......4 BLKDROP
+            18x2......0 PUSHINT
+            18x12....}> PUSHCONT
+            26x12....<{
+            18x10......s0 s1 XCHG
+            18x10......NOT
+            18x10......s0 s1 XCHG
+            18x10......NOT
+            18x10......AND
+            18x10......<{
+            18x6........s0 s1 XCHG
+            26x6........HASHCU
+            18x6........s0 s1 XCHG
+            26x6........HASHCU
+            18x6........NEQ
+            18x10......}> PUSHCONT
+            18x10......<{
+            18x4........DROP2
+            18x4........-1 PUSHINT
+            18x10......}> PUSHCONT
+            18x10......IFELSE
+            26x12....}> PUSHCONT
+            18x12....IFELSE
+            x12..}>
+            x3..?fun_ref_8b1b2058f0ba717f PROCREF:<{
+            18x3....GEQ
+            x3..}>
+            x9..?fun_ref_8ffaafaa854bd141 PROCREF:<{
+            18x9....s1 PUSH
+            18x9....ISNULL
+            18x9....s1 PUSH
+            18x9....ISNULL
+            18x9....DUP2
+            18x9....AND
+            18x9....<{
+            26x2......4 BLKDROP
+            18x2......-1 PUSHINT
+            18x9....}> PUSHCONT
+            18x9....<{
+            18x7......s0 s1 XCHG
+            18x7......NOT
+            18x7......s0 s1 XCHG
+            18x7......NOT
+            18x7......AND
+            18x7......<{
+            26x3........SDEQ
+            18x7......}> PUSHCONT
+            18x7......<{
+            18x4........DROP2
+            18x4........0 PUSHINT
+            18x7......}> PUSHCONT
+            18x7......IFELSE
+            18x9....}> PUSHCONT
+            18x9....IFELSE
+            18x9....NOT
+            x9..}>
+            x5..?fun_ref_943f0cebd640e361 PROCREF:<{
+            18x5....s1 PUSH
+            18x5....ISNULL
+            18x5....s1 PUSH
+            18x5....ISNULL
+            18x5....DUP2
+            18x5....AND
+            18x5....<{
+            26x1......4 BLKDROP
+            18x1......0 PUSHINT
+            18x5....}> PUSHCONT
+            18x5....<{
+            18x4......s0 s1 XCHG
+            18x4......NOT
+            18x4......s0 s1 XCHG
+            18x4......NOT
+            18x4......AND
+            18x4......<{
+            18x2........NEQ
+            18x4......}> PUSHCONT
+            18x4......<{
+            18x2........DROP2
+            18x2........-1 PUSHINT
+            18x4......}> PUSHCONT
+            18x4......IFELSE
+            18x5....}> PUSHCONT
+            18x5....IFELSE
+            x5..}>
+            x10..?fun_ref_977c111ff228eb82 PROCREF:<{
+            18x10....s0 s1 XCHG
+            18x10....s1 PUSH
+            18x10....ISNULL
+            18x10....<{
+            18x4......DROP2
+            18x4......-1 PUSHINT
+            18x10....}> PUSHCONT
+            18x10....<{
+            18x6......s0 s1 XCHG
+            526x6......HASHSU
+            18x6......s0 s1 XCHG
+            526x6......HASHSU
+            18x6......NEQ
+            18x10....}> PUSHCONT
+            18x10....IFELSE
+            x10..}>
+            x10..?fun_ref_9855e2156586b67c PROCREF:<{
+            18x10....s1 PUSH
+            18x10....ISNULL
+            18x10....<{
+            18x4......DROP2
+            18x4......0 PUSHINT
+            18x10....}> PUSHCONT
+            18x10....<{
+            18x6......s0 s1 XCHG
+            526x6......HASHSU
+            18x6......s0 s1 XCHG
+            526x6......HASHSU
+            18x6......EQUAL
+            18x10....}> PUSHCONT
+            18x10....IFELSE
+            x10..}>
+            x3..?fun_ref_9a0c5e8798cc0509 PROCREF:<{
+            18x3....GREATER
+            x3..}>
+            x475..?fun_ref_a05e0042bce184fb PROCREF:<{
+            26x475....c4 PUSH
+            118x475....CTOS
+            18x475....LDREF
+            18x475....s0 s1 XCHG
+            30x475....3 SETGLOBVAR
+            26x475....1 LDI
+            18x475....s0 POP
+            18x475....<{
+            18x402......NULL
+            18x475....}> PUSHCONT
+            18x475....IFJMP
+            26x73....MYADDR
+            34x73....11 PLDU
+            26x73....10 PUSHPOW2
+            18x73....EQUAL
+            34x73....137 THROWIFNOT
+            126x73....?fun_ref_c0ca23818e24f3c9 INLINECALLDICT
+            x475..}>
+            ..?fun_ref_acf9c214ccee2d81 PROCREF:<{
+            ....AND
+            ..}>
+            x5..?fun_ref_ad657d0473ebdc2c PROCREF:<{
+            18x5....s0 s1 XCHG
+            18x5....s1 PUSH
+            18x5....ISNULL
+            18x5....<{
+            18x2......DROP2
+            18x2......0 PUSHINT
+            18x5....}> PUSHCONT
+            18x5....<{
+            26x3......SDEQ
+            18x5....}> PUSHCONT
+            18x5....IFELSE
+            18x5....NOT
+            x5..}>
+            x5..?fun_ref_b35400841b15fc2d PROCREF:<{
+            18x5....s0 s1 XCHG
+            18x5....s1 PUSH
+            18x5....ISNULL
+            18x5....<{
+            18x1......DROP2
+            18x1......-1 PUSHINT
+            18x5....}> PUSHCONT
+            18x5....<{
+            18x4......NEQ
+            18x5....}> PUSHCONT
+            18x5....IFELSE
+            x5..}>
+            x2..?fun_ref_b4fde213ffa24781 PROCREF:<{
+            26x2....false 0 false 2 0 DIV
+            x2..}>
+            x3..?fun_ref_b78be06772ce3abe PROCREF:<{
+            18x3....s0 s1 XCHG
+            26x3....SDEQ
+            x3..}>
+            x71..?fun_ref_b93b9862cda1783c PROCREF:<{
+            18x71....NEWC
+            18x71....1 PUSHINT
+            18x71....s0 s1 XCHG
+            26x71....2 STI
+            26x71....s0 s7 XCHG2
+            18x71....s0 s1 XCHG
+            26x71....1 STI
+            18x71....0 PUSHINT
+            18x71....s0 s1 XCHG
+            26x71....3 STI
+            26x71....s0 s5 XCHG2
+            18x71....s0 PUSH
+            26x71....SBITS
+            34x71....267 PUSHINT
+            18x71....EQUAL
+            34x71....136 THROWIFNOT
+            18x71....s0 PUSH
+            34x71....11 PLDU
+            18x71....s0 PUSH
+            34x71....1279 PUSHINT
+            18x71....EQUAL
+            34x71....137 THROWIF
+            26x71....10 PUSHPOW2
+            18x71....EQUAL
+            34x71....136 THROWIFNOT
+            26x71....STSLICER
+            26x71....s0 s3 XCHG2
+            26x71....STGRAMS
+            18x71....0 PUSHINT
+            18x71....s0 s1 XCHG
+            26x71....105 STI
+            18x71....s3 PUSH
+            18x71....ISNULL
+            18x71....NOT
+            18x71....<{
+            18x4......-1 PUSHINT
+            18x71....}> PUSHCONT
+            18x71....<{
+            18x67......s4 PUSH
+            18x67......ISNULL
+            18x67......NOT
+            18x71....}> PUSHCONT
+            18x71....IFELSE
+            18x71....<{
+            18x67......s3 POP
+            18x67......s3 POP
+            18x67......s0 s1 XCHG
+            18x67......0 PUSHINT
+            18x67......s0 s1 XCHG
+            26x67......1 STI
+            18x71....}> PUSHCONT
+            126x71....<{
+            18x4......-1 PUSHINT
+            18x4......s0 s1 XCHG
+            26x4......1 STI
+            18x4......NEWC
+            18x4......0 PUSHINT
+            18x4......s0 s1 XCHG
+            26x4......1 STI
+            18x4......0 PUSHINT
+            18x4......s0 s1 XCHG
+            26x4......1 STI
+            18x4......s4 PUSH
+            18x4......ISNULL
+            18x4......NOT
+            18x4......<{
+            18x4........-1 PUSHINT
+            18x4........s0 s1 XCHG
+            26x4........1 STI
+            18x4........s0 s4 XCHG
+            18x4........s0 PUSH
+            18x4........ISNULL
+            34x4........128 THROWIF
+            26x4........s0 s4 XCHG2
+            18x4........STREF
+            18x4......}> PUSHCONT
+            18x4......<{
+            ........s4 POP
+            ........s0 s3 XCHG
+            ........0 PUSHINT
+            ........s0 s1 XCHG
+            ........1 STI
+            18x4......}> PUSHCONT
+            18x4......IFELSE
+            18x4......s4 PUSH
+            18x4......ISNULL
+            18x4......NOT
+            18x4......<{
+            18x4........-1 PUSHINT
+            18x4........s0 s1 XCHG
+            26x4........1 STI
+            18x4........s0 s4 XCHG
+            18x4........s0 PUSH
+            18x4........ISNULL
+            34x4........128 THROWIF
+            26x4........s0 s4 XCHG2
+            18x4........STREF
+            18x4......}> PUSHCONT
+            18x4......<{
+            ........s4 POP
+            ........s0 s3 XCHG
+            ........0 PUSHINT
+            ........s0 s1 XCHG
+            ........1 STI
+            18x4......}> PUSHCONT
+            18x4......IFELSE
+            18x4......0 PUSHINT
+            18x4......s0 s1 XCHG
+            26x4......1 STI
+            18x4......s0 s2 XCHG
+            18x4......-1 PUSHINT
+            18x4......s0 s1 XCHG
+            26x4......1 STI
+            18x4......s0 s2 XCHG
+            518x4......ENDC
+            18x4......ROT
+            18x4......STREF
+            126x71....}> IFREFELSE
+            18x71....s1 PUSH
+            18x71....ISNULL
+            18x71....NOT
+            18x71....<{
+            18x70......-1 PUSHINT
+            18x70......s0 s1 XCHG
+            26x70......1 STI
+            18x70......s0 s1 XCHG
+            18x70......s0 PUSH
+            18x70......ISNULL
+            34x70......128 THROWIF
+            18x70......s0 s1 XCHG
+            18x70......STREF
+            18x71....}> PUSHCONT
+            18x71....<{
+            18x1......s1 POP
+            18x1......0 PUSHINT
+            18x1......s0 s1 XCHG
+            26x1......1 STI
+            18x71....}> PUSHCONT
+            18x71....IFELSE
+            518x71....ENDC
+            18x71....s0 s1 XCHG
+            526x71....SENDRAWMSG
+            x71..}>
+            x3..?fun_ref_bf9d36be65618269 PROCREF:<{
+            18x3....s0 s1 XCHG
+            18x3....s0 s1 XCHG
+            26x3....HASHCU
+            18x3....s0 s1 XCHG
+            26x3....HASHCU
+            18x3....NEQ
+            x3..}>
+            x82..?fun_ref_c0ca23818e24f3c9 PROCREF:<{
+            18x82....NULL
+            x82..}>
+            x5..?fun_ref_c29a788970be0722 PROCREF:<{
+            18x5....s1 PUSH
+            18x5....ISNULL
+            18x5....<{
+            18x2......DROP2
+            18x2......0 PUSHINT
+            18x5....}> PUSHCONT
+            18x5....<{
+            18x3......s0 s1 XCHG
+            26x3......HASHCU
+            18x3......s0 s1 XCHG
+            26x3......HASHCU
+            18x3......EQUAL
+            18x5....}> PUSHCONT
+            18x5....IFELSE
+            x5..}>
+            x5..?fun_ref_c4dfd32efb676592 PROCREF:<{
+            18x5....s1 PUSH
+            18x5....ISNULL
+            18x5....<{
+            18x2......DROP2
+            18x2......0 PUSHINT
+            18x5....}> PUSHCONT
+            18x5....<{
+            26x3......SDEQ
+            18x5....}> PUSHCONT
+            18x5....IFELSE
+            18x5....NOT
+            x5..}>
+            x5..?fun_ref_d078cffef374dca6 PROCREF:<{
+            18x5....s0 s1 XCHG
+            18x5....s1 PUSH
+            18x5....ISNULL
+            18x5....<{
+            18x1......DROP2
+            18x1......0 PUSHINT
+            18x5....}> PUSHCONT
+            18x5....<{
+            18x4......EQUAL
+            18x5....}> PUSHCONT
+            18x5....IFELSE
+            x5..}>
+            x3..?fun_ref_d5c7d946856b384e PROCREF:<{
+            18x3....s1 PUSH
+            18x3....ISNULL
+            18x3....<{
+            18x1......DROP2
+            18x1......-1 PUSHINT
+            18x3....}> PUSHCONT
+            18x3....<{
+            18x2......NEQ
+            18x3....}> PUSHCONT
+            18x3....IFELSE
+            x3..}>
+            x3..?fun_ref_d90a47bc5659815b PROCREF:<{
+            18x3....s0 s1 XCHG
+            26x3....SDEQ
+            18x3....NOT
+            x3..}>
+            x6..?fun_ref_dac218b13a72ff8a PROCREF:<{
+            18x6....s0 s1 XCHG
+            18x6....s0 s1 XCHG
+            526x6....HASHSU
+            18x6....s0 s1 XCHG
+            526x6....HASHSU
+            18x6....NEQ
+            x6..}>
+            x10..?fun_ref_dbbd90e91bdad5c0 PROCREF:<{
+            18x10....ISNULL
+            x10..}>
+            x63..?fun_ref_e31d986f279fa0fb PROCREF:<{
+            18x63....NULL
+            18x63....NULL
+            18x63....s2 PUSH
+            18x63....ISNULL
+            18x63....NOT
+            18x63....<{
+            ......DROP2
+            ......s0 PUSH
+            ......ISNULL
+            ......128 THROWIF
+            ......2 UNTUPLE
+            ......s0 s1 XCHG
+            18x63....}> PUSHCONT
+            18x63....<{
+            18x63......s2 POP
+            18x63....}> PUSHCONT
+            18x63....IFELSE
+            26x63....s2 s4 XCHG
+            18x63....0 PUSHINT
+            18x63....s0 s3 XCHG
+            18x63....s0 s4 XCHG
+            26x63....66 PUSHINT
+            26x63....s2 s3 XCHG2
+            126x63....?fun_ref_b93b9862cda1783c INLINECALLDICT
+            x63..}>
+            x3..?fun_ref_ebb984d6b6cfd144 PROCREF:<{
+            18x3....s0 s1 XCHG
+            18x3....s0 s1 XCHG
+            26x3....HASHCU
+            18x3....s0 s1 XCHG
+            26x3....HASHCU
+            18x3....EQUAL
+            x3..}>
+            x6..?fun_ref_ec91dcef8bc865b1 PROCREF:<{
+            18x6....s0 s1 XCHG
+            18x6....s0 s1 XCHG
+            526x6....HASHSU
+            18x6....s0 s1 XCHG
+            526x6....HASHSU
+            18x6....EQUAL
+            x6..}>
+            x4..?fun_ref_edec8407367eca46 PROCREF:<{
+            18x4....SUB
+            x4..}>
+            x5..?fun_ref_ff17a983a407f70d PROCREF:<{
+            18x5....s1 PUSH
+            18x5....ISNULL
+            18x5....<{
+            18x2......DROP2
+            18x2......0 PUSHINT
+            18x5....}> PUSHCONT
+            18x5....<{
+            26x3......SDEQ
+            18x5....}> PUSHCONT
+            18x5....IFELSE
+            x5..}>
+            }END>c
+        
+ + \ No newline at end of file diff --git a/src/test/features/output/ternary_TernaryTester.code.boc.html b/src/test/features/output/ternary_TernaryTester.code.boc.html new file mode 100644 index 000000000..0ae9c7d8d --- /dev/null +++ b/src/test/features/output/ternary_TernaryTester.code.boc.html @@ -0,0 +1,325 @@ + + + + + +

Code coverage

+
+                        PROGRAM{
+            ..DECLPROC recv_internal;
+            ..DECLPROC ?fun_70304;
+            ..DECLPROC ?fun_74435;
+            ..DECLPROC ?fun_78562;
+            ..DECLPROC ?fun_82437;
+            ..DECLPROC ?fun_86564;
+            ..DECLPROC ?fun_90695;
+            ..DECLPROC ?fun_94822;
+            ..DECLPROC ?fun_99209;
+            ..DECLPROC ?fun_103336;
+            ..DECLPROC ?fun_107552;
+            ..DECLPROC supported_interfaces;
+            ..DECLPROC lazy_deployment_completed;
+            ..DECLPROC get_abi_ipfs;
+            ..DECLPROC ?fun_ref_364de9562794919e;
+            ..DECLPROC ?fun_ref_4b7c16b16b29693f;
+            ..DECLPROC ?fun_ref_7a606fe4d77c6a30;
+            ..DECLPROC ?fun_ref_8810e73f1aa91ec4;
+            ..DECLPROC ?fun_ref_93db61788f47c8df;
+            ..DECLPROC ?fun_ref_96bb5087664b6772;
+            ..DECLPROC ?fun_ref_a05e0042bce184fb;
+            ..DECLPROC ?fun_ref_c0ca23818e24f3c9;
+            ..DECLPROC ?fun_ref_d816dc4ba685aed0;
+            ..DECLPROC ?fun_ref_eac35a6e322f692c;
+            ..DECLPROC ?fun_ref_f7f33a77d1558909;
+            x3..recv_internal PROC:<{
+            18x3....s0 s1 XCHG
+            118x3....CTOS
+            26x3....4 LDU
+            18x3....s0 s1 XCHG
+            18x3....1 PUSHINT
+            18x3....AND
+            18x3....-1 MULCONST
+            18x3....s0 s1 XCHG
+            26x3....LDMSGADDR
+            18x3....s0 s1 XCHG
+            18x3....s0 PUSH
+            26x3....SBITS
+            34x3....267 PUSHINT
+            18x3....EQUAL
+            34x3....136 THROWIFNOT
+            18x3....s0 PUSH
+            34x3....11 PLDU
+            18x3....s0 PUSH
+            34x3....1279 PUSHINT
+            18x3....EQUAL
+            34x3....137 THROWIF
+            26x3....10 PUSHPOW2
+            18x3....EQUAL
+            34x3....136 THROWIFNOT
+            34x3....s0 s6 s4 PUXCPU
+            18x3....s0 s3 XCHG
+            30x3....4 TUPLE
+            28x3....1 SETGLOBVAR
+            18x3....s0 s2 XCHG
+            29x3....2 SETGLOBVAR
+            126x3....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x3....ROTREV
+            126x3....?fun_ref_364de9562794919e INLINECALLDICT
+            34x3....130 THROWIFNOT
+            18x3....s0 POP
+            18x3....NEWC
+            26x3....3 GETGLOBVAR
+            18x3....s0 s1 XCHG
+            18x3....STREF
+            18x3....-1 PUSHINT
+            18x3....s0 s1 XCHG
+            26x3....1 STI
+            518x3....ENDC
+            26x3....c4 POP
+            x3..}>
+            x2..?fun_70304 PROC:<{
+            126x2....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x2....s0 s1 XCHG
+            126x2....?fun_ref_4b7c16b16b29693f INLINECALLDICT
+            18x2....s1 POP
+            x2..}>
+            x2..?fun_74435 PROC:<{
+            126x2....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x2....s0 s1 XCHG
+            126x2....?fun_ref_f7f33a77d1558909 INLINECALLDICT
+            18x2....s1 POP
+            x2..}>
+            x2..?fun_78562 PROC:<{
+            126x2....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x2....ROTREV
+            126x2....?fun_ref_eac35a6e322f692c INLINECALLDICT
+            18x2....s1 POP
+            x2..}>
+            x4..?fun_82437 PROC:<{
+            126x4....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x4....ROTREV
+            126x4....?fun_ref_96bb5087664b6772 INLINECALLDICT
+            18x4....s1 POP
+            x4..}>
+            x1..?fun_86564 PROC:<{
+            126x1....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            126x1....?fun_ref_8810e73f1aa91ec4 INLINECALLDICT
+            18x1....s1 POP
+            x1..}>
+            x1..?fun_90695 PROC:<{
+            126x1....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            126x1....?fun_ref_8810e73f1aa91ec4 INLINECALLDICT
+            18x1....s1 POP
+            x1..}>
+            x1..?fun_94822 PROC:<{
+            126x1....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            126x1....?fun_ref_d816dc4ba685aed0 INLINECALLDICT
+            18x1....s1 POP
+            x1..}>
+            x1..?fun_99209 PROC:<{
+            126x1....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            126x1....?fun_ref_7a606fe4d77c6a30 INLINECALLDICT
+            18x1....s1 POP
+            x1..}>
+            x1..?fun_103336 PROC:<{
+            126x1....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            126x1....?fun_ref_7a606fe4d77c6a30 INLINECALLDICT
+            18x1....s1 POP
+            x1..}>
+            x6..?fun_107552 PROC:<{
+            126x6....?fun_ref_a05e0042bce184fb INLINECALLDICT
+            18x6....s0 s1 XCHG
+            126x6....?fun_ref_93db61788f47c8df INLINECALLDICT
+            18x6....s1 POP
+            x6..}>
+            ..supported_interfaces PROC:<{
+            ....123515602279859691144772641439386770278 PUSHINT
+            ....209801025412363888721030803524359905849 PUSHINT
+            ....42980537499636128163026532310500881091 PUSHINT
+            ....36993126140238121407019133875791708966 PUSHINT
+            ....209474421377847335869795010607481022628 PUSHINT
+            ..}>
+            ..lazy_deployment_completed PROC:<{
+            ....c4 PUSH
+            ....CTOS
+            ....1 LDI
+            ....s0 s1 XCHG
+            ..}>
+            ..get_abi_ipfs PROC:<{
+            ....x{697066733A2F2F516D517A587442666B7736504E654E6B645A4162696378675644506B65716D327161424E685063747A33794D6B4A82_} PUSHSLICE
+            ..}>
+            x4..?fun_ref_364de9562794919e PROCREF:<{
+            18x4....s0 s1 XCHG
+            18x4....<{
+            ......s0 POP
+            ......-1 PUSHINT
+            18x4....}> PUSHCONT
+            18x4....IFJMP
+            18x4....0 PUSHINT
+            18x4....s1 PUSH
+            26x4....SBITS
+            26x4....31 GTINT
+            18x4....<{
+            ......s0 POP
+            ......s0 PUSH
+            ......32 PLDU
+            18x4....}> PUSHCONT
+            18x4....IF
+            26x4....0 EQINT
+            18x4....s0 s1 XCHG
+            26x4....SBITS
+            26x4....33 LESSINT
+            18x4....AND
+            18x4....<{
+            18x4......-1 PUSHINT
+            18x4....}> PUSHCONT
+            18x4....IFJMP
+            ....0 PUSHINT
+            x4..}>
+            x2..?fun_ref_4b7c16b16b29693f PROCREF:<{
+            26x2....123 EQINT
+            18x2....<{
+            18x1......1 PUSHINT
+            18x2....}> PUSHCONT
+            18x2....<{
+            18x1......2 PUSHINT
+            18x2....}> PUSHCONT
+            18x2....IFELSE
+            x2..}>
+            x2..?fun_ref_7a606fe4d77c6a30 PROCREF:<{
+            18x2....3 PUSHINT
+            x2..}>
+            x2..?fun_ref_8810e73f1aa91ec4 PROCREF:<{
+            18x2....1 PUSHINT
+            x2..}>
+            x6..?fun_ref_93db61788f47c8df PROCREF:<{
+            18x6....s0 PUSH
+            26x6....1 EQINT
+            18x6....<{
+            18x1......s0 POP
+            26x1......42 PUSHINT
+            18x6....}> PUSHCONT
+            26x6....<{
+            18x5......s0 PUSH
+            26x5......2 EQINT
+            18x5......<{
+            18x1........s0 POP
+            26x1........43 PUSHINT
+            18x5......}> PUSHCONT
+            18x5......<{
+            26x4........3 EQINT
+            18x4........<{
+            26x1..........44 PUSHINT
+            18x4........}> PUSHCONT
+            18x4........<{
+            26x3..........45 PUSHINT
+            18x4........}> PUSHCONT
+            18x4........IFELSE
+            18x5......}> PUSHCONT
+            18x5......IFELSE
+            26x6....}> PUSHCONT
+            18x6....IFELSE
+            x6..}>
+            x4..?fun_ref_96bb5087664b6772 PROCREF:<{
+            18x4....s0 s1 XCHG
+            26x4....123 EQINT
+            18x4....<{
+            34x2......456 PUSHINT
+            18x2......EQUAL
+            18x2......<{
+            18x1........1 PUSHINT
+            18x2......}> PUSHCONT
+            18x2......<{
+            18x1........2 PUSHINT
+            18x2......}> PUSHCONT
+            18x2......IFELSE
+            18x4....}> PUSHCONT
+            18x4....<{
+            34x2......789 PUSHINT
+            18x2......EQUAL
+            18x2......<{
+            18x1........3 PUSHINT
+            18x2......}> PUSHCONT
+            18x2......<{
+            18x1........4 PUSHINT
+            18x2......}> PUSHCONT
+            18x2......IFELSE
+            18x4....}> PUSHCONT
+            18x4....IFELSE
+            x4..}>
+            x475..?fun_ref_a05e0042bce184fb PROCREF:<{
+            26x475....c4 PUSH
+            118x475....CTOS
+            18x475....LDREF
+            18x475....s0 s1 XCHG
+            30x475....3 SETGLOBVAR
+            26x475....1 LDI
+            18x475....s0 POP
+            18x475....<{
+            18x402......NULL
+            18x475....}> PUSHCONT
+            18x475....IFJMP
+            26x73....MYADDR
+            34x73....11 PLDU
+            26x73....10 PUSHPOW2
+            18x73....EQUAL
+            34x73....137 THROWIFNOT
+            126x73....?fun_ref_c0ca23818e24f3c9 INLINECALLDICT
+            x475..}>
+            x82..?fun_ref_c0ca23818e24f3c9 PROCREF:<{
+            18x82....NULL
+            x82..}>
+            x1..?fun_ref_d816dc4ba685aed0 PROCREF:<{
+            18x1....2 PUSHINT
+            x1..}>
+            x2..?fun_ref_eac35a6e322f692c PROCREF:<{
+            18x2....EQUAL
+            18x2....<{
+            18x1......1 PUSHINT
+            18x2....}> PUSHCONT
+            18x2....<{
+            18x1......2 PUSHINT
+            18x2....}> PUSHCONT
+            18x2....IFELSE
+            x2..}>
+            x2..?fun_ref_f7f33a77d1558909 PROCREF:<{
+            18x2....s0 PUSH
+            26x2....123 EQINT
+            18x2....<{
+            26x1......1 LSHIFT
+            18x2....}> PUSHCONT
+            18x2....<{
+            26x1......3 MULCONST
+            18x2....}> PUSHCONT
+            18x2....IFELSE
+            x2..}>
+            }END>c
+        
+ + \ No newline at end of file diff --git a/src/test/integration.spec.ts b/src/test/integration.spec.ts index 1ce13123a..770b503c3 100644 --- a/src/test/integration.spec.ts +++ b/src/test/integration.spec.ts @@ -13,15 +13,15 @@ describe('integration', () => { beforeEach(() => { __DANGER_resetNodeId(); }); - for (let r of loadCases(__dirname + "/contracts/")) { + for (const r of loadCases(__dirname + "/contracts/")) { it('should resolve expressions for ' + r.name, async () => { let ctx = new CompilerContext({ shared: {} }); - let project = createNodeFileSystem(__dirname + "/contracts/"); - let stdlib = createVirtualFileSystem('@stdlib', files); + const project = createNodeFileSystem(__dirname + "/contracts/"); + const stdlib = createVirtualFileSystem('@stdlib', files); ctx = precompile(ctx, project, stdlib, r.name + '.tact'); - let contract = getContracts(ctx)[0]; - let res = await compile(ctx, contract, r.name + '_' + contract); - for (let f of res.output.files) { + const contract = getContracts(ctx)[0]; + const res = await compile(ctx, contract, r.name + '_' + contract); + for (const f of res.output.files) { expect(f.code).toEqual(fs.readFileSync(__dirname + "/contracts/output/" + f.name, 'utf8')); } }); diff --git a/src/test/stdlib.spec.ts b/src/test/stdlib.spec.ts index 7862d036b..174f311b3 100644 --- a/src/test/stdlib.spec.ts +++ b/src/test/stdlib.spec.ts @@ -6,21 +6,21 @@ describe('stdlib', () => { it('should execute slice methods correctly', async () => { // Create and deploy contract - let system = await ContractSystem.create(); - let treasure = system.treasure('treasure'); - let contract = system.open(await StdlibTest.fromInit()); + const system = await ContractSystem.create(); + const treasure = system.treasure('treasure'); + const contract = system.open(await StdlibTest.fromInit()); await contract.send(treasure, { value: toNano('10') }, null); await system.run(); // Execute slice methods - let slice = beginCell() + const slice = beginCell() .storeBit(1) .storeBit(1) .storeRef(beginCell().storeBit(1).endCell()) .endCell(); - let bits = (await contract.getSliceBits(slice)); - let refs = (await contract.getSliceRefs(slice)); - let empty = (await contract.getSliceEmpty(slice)); + const bits = (await contract.getSliceBits(slice)); + const refs = (await contract.getSliceRefs(slice)); + const empty = (await contract.getSliceEmpty(slice)); expect(bits).toBe(2n); expect(refs).toBe(1n); expect(empty).toBe(false); diff --git a/src/types/createTLBType.ts b/src/types/createTLBType.ts index 79c1d135a..6a32bb685 100644 --- a/src/types/createTLBType.ts +++ b/src/types/createTLBType.ts @@ -79,8 +79,8 @@ function createTLBField(src: ABIField) { if (src.type.format !== null && src.type.format !== undefined) { throw Error('Unsupported map format ' + src.type.format); } - let key = createTypeFormat(src.type.key, src.type.keyFormat ? src.type.keyFormat : null); - let value = createTypeFormat(src.type.value, src.type.valueFormat ? src.type.valueFormat : null); + const key = createTypeFormat(src.type.key, src.type.keyFormat ? src.type.keyFormat : null); + const value = createTypeFormat(src.type.value, src.type.valueFormat ? src.type.valueFormat : null); return src.name + ':dict<' + key + ', ' + value + '>'; } @@ -88,14 +88,14 @@ function createTLBField(src: ABIField) { } export function createTLBType(name: string, args: ABIField[], kind: 'struct' | 'message', knownHeader: number | null): { tlb: string, header: number | null } { - let fields = args.map(createTLBField).join(' '); + const fields = args.map(createTLBField).join(' '); if (kind === 'struct') { return { tlb: '_ ' + fields + ' = ' + name, header: null }; } else { - let base = cs.snakeCase(name) + ' ' + fields + ' = ' + name; - let op = knownHeader !== null ? knownHeader : beginCell().storeBuffer(sha256_sync(base)).endCell().beginParse().loadUint(32); - let opText = beginCell().storeUint(op, 32).endCell().beginParse().loadBuffer(4).toString('hex'); - let res = cs.snakeCase(name) + '#' + opText + ' ' + fields + ' = ' + name; + const base = cs.snakeCase(name) + ' ' + fields + ' = ' + name; + const op = knownHeader !== null ? knownHeader : beginCell().storeBuffer(sha256_sync(base)).endCell().beginParse().loadUint(32); + const opText = beginCell().storeUint(op, 32).endCell().beginParse().loadBuffer(4).toString('hex'); + const res = cs.snakeCase(name) + '#' + opText + ' ' + fields + ' = ' + name; return { tlb: res, header: op }; } } \ No newline at end of file diff --git a/src/types/getSupportedInterfaces.ts b/src/types/getSupportedInterfaces.ts index 45829197b..726588925 100644 --- a/src/types/getSupportedInterfaces.ts +++ b/src/types/getSupportedInterfaces.ts @@ -1,15 +1,15 @@ -import { enabledDebug, enabledMaterchain } from "../config/features"; +import { enabledDebug, enabledMasterchain } from "../config/features"; import { CompilerContext } from "../context"; import { TypeDescription } from "./types"; -export function getSupportedIntefaces(type: TypeDescription, ctx: CompilerContext) { - let interfaces: string[] = []; +export function getSupportedInterfaces(type: TypeDescription, ctx: CompilerContext) { + const interfaces: string[] = []; interfaces.push('org.ton.abi.ipfs.v0'); interfaces.push('org.ton.deploy.lazy.v0'); if (enabledDebug(ctx)) { interfaces.push('org.ton.debug.v0'); } - if (!enabledMaterchain(ctx)) { + if (!enabledMasterchain(ctx)) { interfaces.push('org.ton.chain.workchain.v0'); } else { interfaces.push('org.ton.chain.any.v0'); diff --git a/src/types/resolveABITypeRef.ts b/src/types/resolveABITypeRef.ts index 3068942c1..7d9b4a83a 100644 --- a/src/types/resolveABITypeRef.ts +++ b/src/types/resolveABITypeRef.ts @@ -64,7 +64,7 @@ export function resolveABIType(src: ASTField): ABITypeRef { if (src.type.name === 'Int') { if (src.as) { - let fmt = intFormats[src.as]; + const fmt = intFormats[src.as]; if (!fmt) { throwError(`Unsupported format ${src.as}`, src.ref); } @@ -80,7 +80,7 @@ export function resolveABIType(src: ASTField): ABITypeRef { } if (src.type.name === 'Cell') { if (src.as) { - let fmt = cellFormats[src.as]; + const fmt = cellFormats[src.as]; if (!fmt) { throwError(`Unsupported format ${src.as}`, src.ref); } @@ -91,7 +91,7 @@ export function resolveABIType(src: ASTField): ABITypeRef { if (src.type.name === 'Slice') { if (src.as) { if (src.as) { - let fmt = sliceFormats[src.as]; + const fmt = sliceFormats[src.as]; if (!fmt) { throwError(`Unsupported format ${src.as}`, src.ref); } @@ -103,7 +103,7 @@ export function resolveABIType(src: ASTField): ABITypeRef { if (src.type.name === 'Builder') { if (src.as) { if (src.as) { - let fmt = builderFormats[src.as]; + const fmt = builderFormats[src.as]; if (!fmt) { throwError(`Unsupported format ${src.as}`, src.ref); } @@ -156,7 +156,7 @@ export function resolveABIType(src: ASTField): ABITypeRef { if (src.type.key === 'Int') { key = 'int'; if (src.type.keyAs) { - let format = intMapFormats[src.type.keyAs]; + const format = intMapFormats[src.type.keyAs]; if (!format) { throwError(`Unsupported format ${src.type.keyAs} for map key`, src.ref); } @@ -176,7 +176,7 @@ export function resolveABIType(src: ASTField): ABITypeRef { if (src.type.value === 'Int') { value = 'int'; if (src.type.valueAs) { - let format = intMapFormats[src.type.valueAs]; + const format = intMapFormats[src.type.valueAs]; if (!format) { throwError(`Unsupported format ${src.type.valueAs} for map value`, src.ref); } @@ -263,7 +263,7 @@ export function createABITypeRefFromTypeRef(src: TypeRef, ref: ASTRef): ABITypeR if (src.key === 'Int') { key = 'int'; if (src.keyAs) { - let format = intMapFormats[src.keyAs]; + const format = intMapFormats[src.keyAs]; if (!format) { throwError(`Unsupported format ${src.keyAs} for map key`, ref); } @@ -283,7 +283,7 @@ export function createABITypeRefFromTypeRef(src: TypeRef, ref: ASTRef): ABITypeR if (src.value === 'Int') { value = 'int'; if (src.valueAs) { - let format = intMapFormats[src.valueAs]; + const format = intMapFormats[src.valueAs]; if (!format) { throwError(`Unsupported format ${src.valueAs} for map value`, ref); } diff --git a/src/types/resolveConstantValue.ts b/src/types/resolveConstantValue.ts index e6f6df323..5482c0799 100644 --- a/src/types/resolveConstantValue.ts +++ b/src/types/resolveConstantValue.ts @@ -1,5 +1,5 @@ import { Address, Cell, toNano } from "@ton/core"; -import { enabledMaterchain } from "../config/features"; +import { enabledMasterchain } from "../config/features"; import { CompilerContext } from "../context"; import { ASTExpression, throwError } from "../grammar/ast"; import { printTypeRef, TypeRef } from "./types"; @@ -9,8 +9,8 @@ function reduceInt(ast: ASTExpression): bigint { if (ast.kind === 'number') { return ast.value; } else if (ast.kind === 'op_binary') { - let l = reduceInt(ast.left); - let r = reduceInt(ast.right); + const l = reduceInt(ast.left); + const r = reduceInt(ast.right); if (ast.op === '+') { return l + r; } else if (ast.op === '-') { @@ -49,7 +49,7 @@ function reduceInt(ast: ASTExpression): bigint { } if (ast.name === 'sha256') { if (ast.args.length === 1 && ast.args[0].kind === 'string') { - let str = reduceString(ast.args[0]); + const str = reduceString(ast.args[0]); if (Buffer.from(str).length <= 128) { return BigInt('0x' + sha256_sync(str).toString('hex')); } @@ -92,11 +92,11 @@ function reduceAddress(ast: ASTExpression, ctx: CompilerContext): Address { if (ast.name === 'address') { if (ast.args.length === 1) { const str = reduceString(ast.args[0]); - let address = Address.parse(str); + const address = Address.parse(str); if (address.workChain !== 0 && address.workChain !== -1) { throwError(`Address ${str} invalid address`, ast.ref); } - if (!enabledMaterchain(ctx)) { + if (!enabledMasterchain(ctx)) { if (address.workChain !== 0) { throwError(`Address ${str} from masterchain are not enabled for this contract`, ast.ref); } @@ -108,7 +108,7 @@ function reduceAddress(ast: ASTExpression, ctx: CompilerContext): Address { throwError('Cannot reduce expression to a constant Address', ast.ref); } -function reduceCell(ast: ASTExpression, ctx: CompilerContext): Cell { +function reduceCell(ast: ASTExpression): Cell { if (ast.kind === 'op_static_call') { if (ast.name === 'cell') { if (ast.args.length === 1) { @@ -123,7 +123,7 @@ function reduceCell(ast: ASTExpression, ctx: CompilerContext): Cell { } } } - throwError('Cannot reduce expression to a constant Address', ast.ref); + throwError('Cannot reduce expression to a constant Cell', ast.ref); } export function resolveConstantValue(type: TypeRef, ast: ASTExpression | null, ctx: CompilerContext) { @@ -164,7 +164,7 @@ export function resolveConstantValue(type: TypeRef, ast: ASTExpression | null, c // Handle Cell if (type.name === 'Cell') { - return reduceCell(ast, ctx); + return reduceCell(ast); } throwError(`Expected constant value, got ${printTypeRef(type)}`, ast.ref); diff --git a/src/types/resolveDescriptors.spec.ts b/src/types/resolveDescriptors.spec.ts index b64c0b164..8b974f151 100644 --- a/src/types/resolveDescriptors.spec.ts +++ b/src/types/resolveDescriptors.spec.ts @@ -14,7 +14,7 @@ describe('resolveDescriptors', () => { beforeEach(() => { __DANGER_resetNodeId(); }); - for (let r of loadCases(__dirname + "/test/")) { + for (const r of loadCases(__dirname + "/test/")) { it('should resolve descriptors for ' + r.name, () => { let ctx = openContext(new CompilerContext(), [{ code: r.code, path: '', origin: 'user' }], []); ctx = resolveDescriptors(ctx); @@ -23,9 +23,9 @@ describe('resolveDescriptors', () => { expect(getAllStaticFunctions(ctx)).toMatchSnapshot(); }); } - for (let r of loadCases(__dirname + "/test-failed/")) { + for (const r of loadCases(__dirname + "/test-failed/")) { it('should fail descriptors for ' + r.name, () => { - let ctx = openContext(new CompilerContext(), [{ code: r.code, path: '', origin: 'user' }], []); + const ctx = openContext(new CompilerContext(), [{ code: r.code, path: '', origin: 'user' }], []); expect(() => resolveDescriptors(ctx)).toThrowErrorMatchingSnapshot(); }); } diff --git a/src/types/resolveDescriptors.ts b/src/types/resolveDescriptors.ts index f5f9b4ff0..970b4c215 100644 --- a/src/types/resolveDescriptors.ts +++ b/src/types/resolveDescriptors.ts @@ -10,9 +10,9 @@ import { Address, Cell } from "@ton/core"; import { enabledExternals } from "../config/features"; import { isRuntimeType } from "./isRuntimeType"; -let store = createContextStore(); -let staticFunctionsStore = createContextStore(); -let staticConstantsStore = createContextStore(); +const store = createContextStore(); +const staticFunctionsStore = createContextStore(); +const staticConstantsStore = createContextStore(); function verifyMapType(key: string, keyAs: string | null, value: string, valueAs: string | null, ref: ASTRef) { if (!keyAs && !valueAs) { @@ -75,7 +75,7 @@ export const toBounced = (type: string) => `${type}%%BOUNCED%%`; export function resolveTypeRef(ctx: CompilerContext, src: ASTTypeRef): TypeRef { if (src.kind === 'type_ref_simple') { - let t = getType(ctx, src.name); + const t = getType(ctx, src.name); return { kind: 'ref', name: t.name, @@ -83,8 +83,8 @@ export function resolveTypeRef(ctx: CompilerContext, src: ASTTypeRef): TypeRef { }; } if (src.kind === 'type_ref_map') { - let k = getType(ctx, src.key).name; - let v = getType(ctx, src.value).name; + const k = getType(ctx, src.key).name; + const v = getType(ctx, src.value).name; verifyMapType(k, src.keyAs, v, src.valueAs, src.ref); return { kind: 'map', @@ -95,7 +95,7 @@ export function resolveTypeRef(ctx: CompilerContext, src: ASTTypeRef): TypeRef { }; } if (src.kind === 'type_ref_bounced') { - let t = getType(ctx, src.name); + const t = getType(ctx, src.name); return { kind: 'ref_bounced', name: t.name, @@ -150,21 +150,21 @@ function uidForName(name: string, types: { [key: string]: TypeDescription }) { } export function resolveDescriptors(ctx: CompilerContext) { - let types: { [key: string]: TypeDescription } = {}; - let staticFunctions: { [key: string]: FunctionDescription } = {}; - let staticConstants: { [key: string]: ConstantDescription } = {}; - let ast = getRawAST(ctx); + const types: { [key: string]: TypeDescription } = {}; + const staticFunctions: { [key: string]: FunctionDescription } = {}; + const staticConstants: { [key: string]: ConstantDescription } = {}; + const ast = getRawAST(ctx); // // Register types // - for (let a of ast.types) { + for (const a of ast.types) { if (types[a.name]) { throwError(`Type ${a.name} already exists`, a.ref); } - let uid = uidForName(a.name, types); + const uid = uidForName(a.name, types); if (a.kind === 'primitive') { types[a.name] = { @@ -254,7 +254,7 @@ export function resolveDescriptors(ctx: CompilerContext) { // function buildFieldDescription(src: ASTField, index: number): FieldDescription { - let tr = buildTypeRef(src.type, types); + const tr = buildTypeRef(src.type, types); // Check if field is runtime type if (isRuntimeType(tr)) { @@ -268,18 +268,18 @@ export function resolveDescriptors(ctx: CompilerContext) { } // Resolve abi type - let type = resolveABIType(src); + const type = resolveABIType(src); return { name: src.name, type: tr, index, as: src.as, default: d, ref: src.ref, ast: src, abi: { name: src.name, type } }; } function buildConstantDescription(src: ASTConstant): ConstantDescription { - let tr = buildTypeRef(src.type, types); - let d = resolveConstantValue(tr, src.value, ctx); + const tr = buildTypeRef(src.type, types); + const d = resolveConstantValue(tr, src.value, ctx); return { name: src.name, type: tr, value: d, ref: src.ref, ast: src }; } - for (let a of ast.types) { + for (const a of ast.types) { // Contract if (a.kind === 'def_contract') { @@ -300,7 +300,7 @@ export function resolveDescriptors(ctx: CompilerContext) { throwError(`Constant ${f.name} already exists`, f.ref); } if (f.attributes.find((v) => v.type !== 'overrides')) { - throwError(`Constant can be only overriden`, f.ref); + throwError(`Constant can be only overridden`, f.ref); } types[a.name].constants.push(buildConstantDescription(f)); } @@ -340,7 +340,7 @@ export function resolveDescriptors(ctx: CompilerContext) { throwError(`Constant ${f.name} already exists`, f.ref); } if (f.attributes.find((v) => v.type === 'overrides')) { - throwError(`Trait constant cannot be overriden`, f.ref); + throwError(`Trait constant cannot be overridden`, f.ref); } // if (f.attributes.find((v) => v.type === 'abstract')) { // continue; // Do not materialize abstract constants @@ -355,7 +355,7 @@ export function resolveDescriptors(ctx: CompilerContext) { // Populate partial serialization info // - for (let t in types) { + for (const t in types) { types[t].partialFieldCount = resolvePartialFields(ctx, types[t]) } @@ -375,7 +375,7 @@ export function resolveDescriptors(ctx: CompilerContext) { // Resolve args let args: FunctionArgument[] = []; - for (let r of a.args) { + for (const r of a.args) { args.push({ name: r.name, type: buildTypeRef(r.type, types), @@ -384,13 +384,13 @@ export function resolveDescriptors(ctx: CompilerContext) { } // Resolve flags - let isGetter = a.attributes.find(a => a.type === 'get'); - let isMutating = a.attributes.find(a => a.type === 'mutates'); - let isExtends = a.attributes.find(a => a.type === 'extends'); - let isVirtual = a.attributes.find(a => a.type === 'virtual'); - let isOverrides = a.attributes.find(a => a.type === 'overrides'); - let isInline = a.attributes.find(a => a.type === 'inline'); - let isAbstract = a.attributes.find(a => a.type === 'abstract'); + const isGetter = a.attributes.find(a => a.type === 'get'); + const isMutating = a.attributes.find(a => a.type === 'mutates'); + const isExtends = a.attributes.find(a => a.type === 'extends'); + const isVirtual = a.attributes.find(a => a.type === 'virtual'); + const isOverrides = a.attributes.find(a => a.type === 'overrides'); + const isInline = a.attributes.find(a => a.type === 'inline'); + const isAbstract = a.attributes.find(a => a.type === 'abstract'); // Check for native if (a.kind === 'def_native_function') { @@ -439,7 +439,7 @@ export function resolveDescriptors(ctx: CompilerContext) { // Check virtual if (isVirtual) { - let t = types[self!]!; + const t = types[self!]!; if (t.kind !== 'trait') { throwError('Virtual functions must be defined within a trait', isVirtual.ref); } @@ -447,7 +447,7 @@ export function resolveDescriptors(ctx: CompilerContext) { // Check abstract if (isAbstract) { - let t = types[self!]!; + const t = types[self!]!; if (t.kind !== 'trait') { throwError('Abstract functions must be defined within a trait', isAbstract.ref); } @@ -455,7 +455,7 @@ export function resolveDescriptors(ctx: CompilerContext) { // Check overrides if (isOverrides) { - let t = types[self!]!; + const t = types[self!]!; if (t.kind !== 'contract') { throwError('Overrides functions must be defined within a contract', isOverrides.ref); } @@ -506,9 +506,9 @@ export function resolveDescriptors(ctx: CompilerContext) { throwError('Mutating functions must be extend functions', isMutating.ref); } - // Check argumen names - let exNames = new Set(); - for (let arg of args) { + // Check argument names + const exNames = new Set(); + for (const arg of args) { if (arg.name === 'self') { throwError('Argument name "self" is reserved', arg.ref); } @@ -520,13 +520,13 @@ export function resolveDescriptors(ctx: CompilerContext) { // Check for runtime types in getters if (isGetter) { - for (let arg of args) { + for (const arg of args) { if (isRuntimeType(arg.type)) { - throwError(printTypeRef(arg.type) + ' is a runtime onlye type and can\'t be used as a getter argument', arg.ref); + throwError(printTypeRef(arg.type) + ' is a runtime-only type and can\'t be used as a getter argument', arg.ref); } } if (isRuntimeType(returns)) { - throwError(printTypeRef(returns) + ' is a runtime onlye type and can\'t be used as getter return type', a.ref); + throwError(printTypeRef(returns) + ' is a runtime-only type and can\'t be used as getter return type', a.ref); } } @@ -548,8 +548,8 @@ export function resolveDescriptors(ctx: CompilerContext) { } function resolveInitFunction(ast: ASTInitFunction): InitDescription { - let args: InitArgument[] = []; - for (let r of ast.args) { + const args: InitArgument[] = []; + for (const r of ast.args) { args.push({ name: r.name, type: buildTypeRef(r.type, types), @@ -559,9 +559,9 @@ export function resolveDescriptors(ctx: CompilerContext) { } // Check if runtime types are used - for (let a of args) { + for (const a of args) { if (isRuntimeType(a.type)) { - throwError(printTypeRef(a.type) + ' is a runtime onlye type and can\'t be used as a init function argument', a.ref); + throwError(printTypeRef(a.type) + ' is a runtime-only type and can\'t be used as a init function argument', a.ref); } } @@ -576,7 +576,7 @@ export function resolveDescriptors(ctx: CompilerContext) { const s = types[a.name]; for (const d of a.declarations) { if (d.kind === 'def_function') { - let f = resolveFunctionDescriptor(s.name, d, s.origin); + const f = resolveFunctionDescriptor(s.name, d, s.origin); if (f.self !== s.name) { throw Error('Function self must be ' + s.name); // Impossible } @@ -611,7 +611,7 @@ export function resolveDescriptors(ctx: CompilerContext) { } // Check resolved argument type - let t = types[arg.type.name]; + const t = types[arg.type.name]; if (!t) { throwError('Type ' + arg.type.name + ' not found', d.ref); } @@ -687,7 +687,7 @@ export function resolveDescriptors(ctx: CompilerContext) { if (d.selector.comment.value === '') { throwError('To use empty comment receiver, just remove argument instead of passing empty string', d.ref); } - let c = d.selector.comment.value; + const c = d.selector.comment.value; if (s.receivers.find((v) => v.selector.kind === (internal ? 'internal-comment' : 'external-comment') && v.selector.comment === c)) { throwError(`Receive function for "${c}" already exists`, d.ref); } @@ -731,7 +731,7 @@ export function resolveDescriptors(ctx: CompilerContext) { ast: d }); } else { - let type = types[arg.type.name]; + const type = types[arg.type.name]; if (type.ast.kind !== 'def_struct' || !type.ast.message) { throwError('Bounce receive function can only accept bounced message, message or Slice', d.ref); } @@ -753,7 +753,7 @@ export function resolveDescriptors(ctx: CompilerContext) { } } else if (arg.type.kind === "type_ref_bounced") { - let t = types[arg.type.name]; + const t = types[arg.type.name]; if (t.kind !== 'struct') { throwError('Bounce receive function can only accept bounced struct types', d.ref); } @@ -793,8 +793,8 @@ export function resolveDescriptors(ctx: CompilerContext) { // Check for missing init methods // - for (let k in types) { - let t = types[k]; + for (const k in types) { + const t = types[k]; if (t.kind === 'contract') { if (!t.init) { throwError('Contract ' + t.name + ' does not have init method', t.ast.ref); @@ -806,29 +806,30 @@ export function resolveDescriptors(ctx: CompilerContext) { // Flatten and resolve traits // - for (let k in types) { - let t = types[k]; + for (const k in types) { + const t = types[k]; if (t.ast.kind === 'def_trait' || t.ast.kind === 'def_contract') { // Flatten traits - let traits: TypeDescription[] = []; - let visited = new Set(); + const traits: TypeDescription[] = []; + const visited = new Set(); visited.add(t.name); + // eslint-disable-next-line no-inner-declarations function visit(name: string) { if (visited.has(name)) { return; } - let tt = types[name]; + const tt = types[name]; if (!tt) { throwError('Trait ' + name + ' not found', t.ast.ref) } visited.add(name); traits.push(tt); if (tt.ast.kind === 'def_trait') { - for (let s of tt.ast.traits) { + for (const s of tt.ast.traits) { visit(s.value); } - for (let f of tt.traits) { + for (const f of tt.traits) { visit(f.name); } } else { @@ -836,7 +837,7 @@ export function resolveDescriptors(ctx: CompilerContext) { } } visit('BaseTrait'); - for (let s of t.ast.traits) { + for (const s of t.ast.traits) { visit(s.value); } @@ -849,10 +850,10 @@ export function resolveDescriptors(ctx: CompilerContext) { // Verify trait fields // - for (let k in types) { - let t = types[k]; + for (const k in types) { + const t = types[k]; - for (let tr of t.traits) { + for (const tr of t.traits) { // Check that trait is valid if (!types[tr.name]) { @@ -863,11 +864,11 @@ export function resolveDescriptors(ctx: CompilerContext) { } // Check that trait has all required fields - let ttr = types[tr.name]; - for (let f of ttr.fields) { + const ttr = types[tr.name]; + for (const f of ttr.fields) { // Check if field exists - let ex = t.fields.find((v) => v.name === f.name); + const ex = t.fields.find((v) => v.name === f.name); if (!ex) { throwError(`Trait ${tr.name} requires field ${f.name}`, t.ast.ref); } @@ -885,11 +886,11 @@ export function resolveDescriptors(ctx: CompilerContext) { // function copyTraits(t: TypeDescription) { - for (let tr of t.traits) { + for (const tr of t.traits) { // Copy functions - for (let f of tr.functions.values()) { - let ex = t.functions.get(f.name); + for (const f of tr.functions.values()) { + const ex = t.functions.get(f.name); if (!ex && f.isAbstract) { throwError(`Trait ${tr.name} requires function ${f.name}`, t.ast.ref); } @@ -909,8 +910,8 @@ export function resolveDescriptors(ctx: CompilerContext) { throwError(`Overridden function ${f.name} should have same number of arguments`, ex.ast.ref); } for (let i = 0; i < f.args.length; i++) { - let a = ex.args[i]; - let b = f.args[i]; + const a = ex.args[i]; + const b = f.args[i]; if (!typeRefEquals(a.type, b.type)) { throwError(`Overridden function ${f.name} should have same argument types`, ex.ast.ref); } @@ -932,8 +933,8 @@ export function resolveDescriptors(ctx: CompilerContext) { } // Copy constants - for (let f of tr.constants) { - let ex = t.constants.find((v) => v.name === f.name); + for (const f of tr.constants) { + const ex = t.constants.find((v) => v.name === f.name); if (!ex && f.ast.attributes.find((v) => v.type === 'abstract')) { throwError(`Trait ${tr.name} requires constant ${f.name}`, t.ast.ref); } @@ -959,7 +960,8 @@ export function resolveDescriptors(ctx: CompilerContext) { } // Copy receivers - for (let f of tr.receivers) { + for (const f of tr.receivers) { + // eslint-disable-next-line no-inner-declarations function sameReceiver(a: ReceiverSelector, b: ReceiverSelector) { if (a.kind === 'internal-comment' && b.kind === 'internal-comment') { return a.comment === b.comment; @@ -993,8 +995,8 @@ export function resolveDescriptors(ctx: CompilerContext) { }); } - // Copy intefaces - for (let i of tr.interfaces) { + // Copy interfaces + for (const i of tr.interfaces) { if (!t.interfaces.find((v) => v === i)) { t.interfaces.push(i); } @@ -1004,8 +1006,8 @@ export function resolveDescriptors(ctx: CompilerContext) { // Copy to non-traits to avoid duplicates - let processed = new Set(); - let processing = new Set(); + const processed = new Set(); + const processing = new Set(); function processType(name: string) { @@ -1019,8 +1021,8 @@ export function resolveDescriptors(ctx: CompilerContext) { processing.has(name); // Process dependencies first - let dependencies = Object.values(types).filter((v) => v.traits.find((v2) => v2.name === name)); - for (let d of dependencies) { + const dependencies = Object.values(types).filter((v) => v.traits.find((v2) => v2.name === name)); + for (const d of dependencies) { processType(d.name); } @@ -1031,7 +1033,7 @@ export function resolveDescriptors(ctx: CompilerContext) { processed.add(name); processing.delete(name); } - for (let k in types) { + for (const k in types) { processType(k); } @@ -1039,10 +1041,10 @@ export function resolveDescriptors(ctx: CompilerContext) { // Register dependencies // - for (let k in types) { - let t = types[k]; - let dependsOn = new Set(); - let handler = (src: ASTNode) => { + for (const k in types) { + const t = types[k]; + const dependsOn = new Set(); + const handler = (src: ASTNode) => { if (src.kind === 'init_of') { if (!types[src.name]) { throwError(`Type ${src.name} not found`, src.ref); @@ -1052,15 +1054,15 @@ export function resolveDescriptors(ctx: CompilerContext) { } // Traverse functions - for (let f of t.functions.values()) { + for (const f of t.functions.values()) { traverse(f.ast, handler); } - for (let f of t.receivers) { + for (const f of t.receivers) { traverse(f.ast, handler); } // Add dependencies - for (let s of dependsOn) { + for (const s of dependsOn) { if (s !== k) { t.dependsOn.push(types[s]!); } @@ -1072,8 +1074,8 @@ export function resolveDescriptors(ctx: CompilerContext) { // function collectTransient(name: string, to: Set) { - let t = types[name]; - for (let d of t.dependsOn) { + const t = types[name]; + for (const d of t.dependsOn) { if (to.has(d.name)) { continue; } @@ -1081,11 +1083,11 @@ export function resolveDescriptors(ctx: CompilerContext) { collectTransient(d.name, to); } } - for (let k in types) { - let dependsOn = new Set(); + for (const k in types) { + const dependsOn = new Set(); dependsOn.add(k); collectTransient(k, dependsOn); - for (let s of dependsOn) { + for (const s of dependsOn) { if (s !== k && !types[k].dependsOn.find((v) => v.name === s)) { types[k].dependsOn.push(types[s]!); } @@ -1096,8 +1098,8 @@ export function resolveDescriptors(ctx: CompilerContext) { // Resolve static functions // - for (let a of ast.functions) { - let r = resolveFunctionDescriptor(null, a, a.origin); + for (const a of ast.functions) { + const r = resolveFunctionDescriptor(null, a, a.origin); if (r.self) { if (types[r.self].functions.has(r.name)) { throwError(`Function ${r.name} already exists in type ${r.self}`, r.ast.ref); @@ -1118,7 +1120,7 @@ export function resolveDescriptors(ctx: CompilerContext) { // Resolve static constants // - for (let a of ast.constants) { + for (const a of ast.constants) { if (staticConstants[a.name]) { throwError(`Static constant ${a.name} already exists`, a.ref); } @@ -1132,13 +1134,13 @@ export function resolveDescriptors(ctx: CompilerContext) { // Register types and functions in context // - for (let t in types) { + for (const t in types) { ctx = store.set(ctx, t, types[t]); } - for (let t in staticFunctions) { + for (const t in staticFunctions) { ctx = staticFunctionsStore.set(ctx, t, staticFunctions[t]); } - for (let t in staticConstants) { + for (const t in staticConstants) { ctx = staticConstantsStore.set(ctx, t, staticConstants[t]); } @@ -1146,7 +1148,7 @@ export function resolveDescriptors(ctx: CompilerContext) { } export function getType(ctx: CompilerContext, name: string): TypeDescription { - let r = store.get(ctx, name); + const r = store.get(ctx, name); if (!r) { throw Error('Type ' + name + ' not found'); } @@ -1162,7 +1164,7 @@ export function getContracts(ctx: CompilerContext) { } export function getStaticFunction(ctx: CompilerContext, name: string): FunctionDescription { - let r = staticFunctionsStore.get(ctx, name); + const r = staticFunctionsStore.get(ctx, name); if (!r) { throw Error('Static function ' + name + ' not found'); } @@ -1174,7 +1176,7 @@ export function hasStaticFunction(ctx: CompilerContext, name: string) { } export function getStaticConstant(ctx: CompilerContext, name: string): ConstantDescription { - let r = staticConstantsStore.get(ctx, name); + const r = staticConstantsStore.get(ctx, name); if (!r) { throw Error('Static constant ' + name + ' not found'); } diff --git a/src/types/resolveErrors.ts b/src/types/resolveErrors.ts index 51693a02d..7137885c8 100644 --- a/src/types/resolveErrors.ts +++ b/src/types/resolveErrors.ts @@ -4,7 +4,7 @@ import { ASTNode, traverse } from "../grammar/ast"; import { resolveConstantValue } from "./resolveConstantValue"; import { getAllStaticConstants, getAllStaticFunctions, getAllTypes } from "./resolveDescriptors"; -let exceptions = createContextStore<{ value: string, id: number }>(); +const exceptions = createContextStore<{ value: string, id: number }>(); function stringId(src: string): number { return sha256_sync(src).readUInt32BE(0); @@ -20,9 +20,9 @@ function resolveStringsInAST(ast: ASTNode, ctx: CompilerContext) { if (node.args.length !== 2) { return; } - let resolved = resolveConstantValue({ kind: 'ref', name: 'String', optional: false }, node.args[1], ctx) as string; + const resolved = resolveConstantValue({ kind: 'ref', name: 'String', optional: false }, node.args[1], ctx) as string; if (!exceptions.get(ctx, resolved)) { - let id = exceptionId(resolved); + const id = exceptionId(resolved); if (Object.values(exceptions.all(ctx)).find((v) => v.id === id)) { throw new Error(`Duplicate error id: ${resolved}`); } @@ -36,17 +36,17 @@ function resolveStringsInAST(ast: ASTNode, ctx: CompilerContext) { export function resolveErrors(ctx: CompilerContext) { // Process all static functions - for (let f of Object.values(getAllStaticFunctions(ctx))) { + for (const f of Object.values(getAllStaticFunctions(ctx))) { ctx = resolveStringsInAST(f.ast, ctx); } // Process all static constants - for (let f of Object.values(getAllStaticConstants(ctx))) { + for (const f of Object.values(getAllStaticConstants(ctx))) { ctx = resolveStringsInAST(f.ast, ctx); } // Process all types - for (let t of Object.values(getAllTypes(ctx))) { + for (const t of Object.values(getAllTypes(ctx))) { // Process fields for (const f of Object.values(t.fields)) { @@ -69,7 +69,7 @@ export function resolveErrors(ctx: CompilerContext) { } // Process functions - for (let f of t.functions.values()) { + for (const f of t.functions.values()) { ctx = resolveStringsInAST(f.ast, ctx); } } @@ -82,7 +82,7 @@ export function getAllErrors(ctx: CompilerContext) { } export function getErrorId(value: string, ctx: CompilerContext) { - let ex = exceptions.get(ctx, value); + const ex = exceptions.get(ctx, value); if (!ex) { throw new Error(`Error not found: ${value}`); } diff --git a/src/types/resolveExpression.ts b/src/types/resolveExpression.ts index 02a7a902e..360fd8de1 100644 --- a/src/types/resolveExpression.ts +++ b/src/types/resolveExpression.ts @@ -1,4 +1,4 @@ -import { ASTBoolean, ASTExpression, ASTInitOf, ASTLvalueRef, ASTNull, ASTNumber, ASTOpBinary, ASTOpCall, ASTOpCallStatic, ASTOpField, ASTOpNew, ASTOpUnary, ASTString, throwError, cloneASTNode, ASTConditional } from '../grammar/ast'; +import { ASTBoolean, ASTExpression, ASTInitOf, ASTLvalueRef, ASTNull, ASTNumber, ASTOpBinary, ASTOpCall, ASTOpCallStatic, ASTOpField, ASTOpNew, ASTOpUnary, ASTString, throwError, ASTConditional } from '../grammar/ast'; import { CompilerContext, createContextStore } from "../context"; import { getStaticConstant, getStaticFunction, getType, hasStaticConstant, hasStaticFunction } from "./resolveDescriptors"; import { FieldDescription, printTypeRef, TypeRef, typeRefEquals } from "./types"; @@ -8,10 +8,10 @@ import { GlobalFunctions } from "../abi/global"; import { isAssignable } from "./isAssignable"; import { StructFunctions } from "../abi/struct"; -let store = createContextStore<{ ast: ASTExpression, description: TypeRef }>(); +const store = createContextStore<{ ast: ASTExpression, description: TypeRef }>(); export function getExpType(ctx: CompilerContext, exp: ASTExpression) { - let t = store.get(ctx, exp.id); + const t = store.get(ctx, exp.id); if (!t) { throw Error('Expression ' + exp.id + ' not found'); } @@ -19,7 +19,7 @@ export function getExpType(ctx: CompilerContext, exp: ASTExpression) { } function registerExpType(ctx: CompilerContext, exp: ASTExpression, description: TypeRef): CompilerContext { - let ex = store.get(ctx, exp.id); + const ex = store.get(ctx, exp.id); if (ex) { if (typeRefEquals(ex.description, description)) { return ctx; @@ -48,15 +48,15 @@ function resolveStringLiteral(exp: ASTString, sctx: StatementContext, ctx: Compi function resolveStructNew(exp: ASTOpNew, sctx: StatementContext, ctx: CompilerContext): CompilerContext { // Get type - let tp = getType(ctx, exp.type); + const tp = getType(ctx, exp.type); if (tp.kind !== 'struct') { throwError(`Invalid type "${exp.type}" for construction`, exp.ref); } // Process fields - let processed = new Set(); - for (let e of exp.args) { + const processed = new Set(); + for (const e of exp.args) { // Check duplicates if (processed.has(e.name)) { @@ -65,7 +65,7 @@ function resolveStructNew(exp: ASTOpNew, sctx: StatementContext, ctx: CompilerCo processed.add(e.name); // Check existing - let f = tp.fields.find((v) => v.name === e.name); + const f = tp.fields.find((v) => v.name === e.name); if (!f) { throwError(`Unknown fields "${e.name}" in type ${tp.name}`, e.ref); } @@ -74,14 +74,14 @@ function resolveStructNew(exp: ASTOpNew, sctx: StatementContext, ctx: CompilerCo ctx = resolveExpression(e.exp, sctx, ctx); // Check expression type - let expressionType = getExpType(ctx, e.exp); + const expressionType = getExpType(ctx, e.exp); if (!isAssignable(expressionType, f.type)) { throwError(`Invalid type "${printTypeRef(expressionType)}" for fields "${e.name}" with type ${printTypeRef(f.type)} in type ${tp.name}`, e.ref); } } // Check missing fields - for (let f of tp.fields) { + for (const f of tp.fields) { if (f.default === undefined && !processed.has(f.name)) { throwError(`Missing fields "${f.name}" in type ${tp.name}`, exp.ref); } @@ -96,8 +96,8 @@ function resolveBinaryOp(exp: ASTOpBinary, sctx: StatementContext, ctx: Compiler // Resolve left and right expressions ctx = resolveExpression(exp.left, sctx, ctx); ctx = resolveExpression(exp.right, sctx, ctx); - let le = getExpType(ctx, exp.left); - let re = getExpType(ctx, exp.right); + const le = getExpType(ctx, exp.left); + const re = getExpType(ctx, exp.right); // Check operands let resolved: TypeRef; @@ -121,8 +121,8 @@ function resolveBinaryOp(exp: ASTOpBinary, sctx: StatementContext, ctx: Compiler // Check if types are compatible if (le.kind !== 'null' && re.kind !== 'null') { - let l = le; - let r = re; + const l = le; + const r = re; if (l.kind === 'map' && r.kind === 'map') { if (l.key !== r.key || l.value !== r.value || l.keyAs !== r.keyAs || l.valueAs !== r.valueAs) { @@ -195,7 +195,7 @@ function resolveField(exp: ASTOpField, sctx: StatementContext, ctx: CompilerCont ctx = resolveExpression(exp.src, sctx, ctx); // Find target type and check for type - let src = getExpType(ctx, exp.src); + const src = getExpType(ctx, exp.src); if (src === null || ((src.kind !== 'ref' || src.optional) && (src.kind !== 'ref_bounced'))) { throwError(`Invalid type "${printTypeRef(src)}" for field access`, exp.ref); @@ -211,7 +211,7 @@ function resolveField(exp: ASTOpField, sctx: StatementContext, ctx: CompilerCont // Find field let fields: FieldDescription[]; - let srcT = getType(ctx, src.name); + const srcT = getType(ctx, src.name); fields = srcT.fields; if (src.kind === 'ref_bounced') { @@ -240,15 +240,15 @@ function resolveStaticCall(exp: ASTOpCallStatic, sctx: StatementContext, ctx: Co // Check if abi global function if (GlobalFunctions[exp.name]) { - let f = GlobalFunctions[exp.name]; + const f = GlobalFunctions[exp.name]; // Resolve arguments - for (let e of exp.args) { + for (const e of exp.args) { ctx = resolveExpression(e, sctx, ctx); } // Resolve return type - let resolved = f.resolve(ctx, exp.args.map((v) => getExpType(ctx, v)), exp.ref); + const resolved = f.resolve(ctx, exp.args.map((v) => getExpType(ctx, v)), exp.ref); // Register return type return registerExpType(ctx, exp, resolved); @@ -260,10 +260,10 @@ function resolveStaticCall(exp: ASTOpCallStatic, sctx: StatementContext, ctx: Co } // Get static function - let f = getStaticFunction(ctx, exp.name); + const f = getStaticFunction(ctx, exp.name); // Resolve call arguments - for (let e of exp.args) { + for (const e of exp.args) { ctx = resolveExpression(e, sctx, ctx); } @@ -272,9 +272,9 @@ function resolveStaticCall(exp: ASTOpCallStatic, sctx: StatementContext, ctx: Co throwError(`Function "${exp.name}" expects ${f.args.length} arguments, got ${exp.args.length}`, exp.ref); } for (let i = 0; i < f.args.length; i++) { - let a = f.args[i]; - let e = exp.args[i]; - let t = getExpType(ctx, e); + const a = f.args[i]; + const e = exp.args[i]; + const t = getExpType(ctx, e); if (!isAssignable(t, a.type)) { throwError(`Invalid type "${printTypeRef(t)}" for argument "${a.name}"`, e.ref); } @@ -295,12 +295,12 @@ function resolveCall(exp: ASTOpCall, sctx: StatementContext, ctx: CompilerContex } // Resolve args - for (let e of exp.args) { + for (const e of exp.args) { ctx = resolveExpression(e, sctx, ctx); } // Resolve return value - let src = getExpType(ctx, exp.src); + const src = getExpType(ctx, exp.src); if (src === null) { throwError(`Invalid type "${printTypeRef(src)}" for function call`, exp.ref); } @@ -313,18 +313,18 @@ function resolveCall(exp: ASTOpCall, sctx: StatementContext, ctx: CompilerContex } // Register return type - let srcT = getType(ctx, src.name); + const srcT = getType(ctx, src.name); // Check struct ABI if (srcT.kind === 'struct') { - let abi = StructFunctions[exp.name]; + const abi = StructFunctions[exp.name]; if (abi) { - let resolved = abi.resolve(ctx, [src, ...exp.args.map((v) => getExpType(ctx, v))], exp.ref); + const resolved = abi.resolve(ctx, [src, ...exp.args.map((v) => getExpType(ctx, v))], exp.ref); return registerExpType(ctx, exp, resolved); } } - let f = srcT.functions.get(exp.name)!; + const f = srcT.functions.get(exp.name)!; if (!f) { throwError(`Type "${src.name}" does not have a function named "${exp.name}"`, exp.ref); } @@ -334,9 +334,9 @@ function resolveCall(exp: ASTOpCall, sctx: StatementContext, ctx: CompilerContex throwError(`Function "${exp.name}" expects ${f.args.length} arguments, got ${exp.args.length}`, exp.ref); } for (let i = 0; i < f.args.length; i++) { - let a = f.args[i]; - let e = exp.args[i]; - let t = getExpType(ctx, e); + const a = f.args[i]; + const e = exp.args[i]; + const t = getExpType(ctx, e); if (!isAssignable(t, a.type)) { throwError(`Invalid type "${printTypeRef(t)}" for argument "${a.name}"`, e.ref); } @@ -347,11 +347,11 @@ function resolveCall(exp: ASTOpCall, sctx: StatementContext, ctx: CompilerContex // Handle map if (src.kind === 'map') { - let abf = MapFunctions[exp.name]; + const abf = MapFunctions[exp.name]; if (!abf) { throwError(`Map function "${exp.name}" not found`, exp.ref); } - let resolved = abf.resolve(ctx, [src, ...exp.args.map((v) => getExpType(ctx, v))], exp.ref); + const resolved = abf.resolve(ctx, [src, ...exp.args.map((v) => getExpType(ctx, v))], exp.ref); return registerExpType(ctx, exp, resolved); } @@ -365,7 +365,7 @@ function resolveCall(exp: ASTOpCall, sctx: StatementContext, ctx: CompilerContex export function resolveInitOf(ast: ASTInitOf, sctx: StatementContext, ctx: CompilerContext): CompilerContext { // Resolve type - let type = getType(ctx, ast.name); + const type = getType(ctx, ast.name); if (type.kind !== 'contract') { throwError(`Type "${ast.name}" is not a contract`, ast.ref); } @@ -374,7 +374,7 @@ export function resolveInitOf(ast: ASTInitOf, sctx: StatementContext, ctx: Compi } // Resolve args - for (let e of ast.args) { + for (const e of ast.args) { ctx = resolveExpression(e, sctx, ctx); } @@ -383,9 +383,9 @@ export function resolveInitOf(ast: ASTInitOf, sctx: StatementContext, ctx: Compi throwError(`Init function of "${type.name}" expects ${type.init.args.length} arguments, got ${ast.args.length}`, ast.ref); } for (let i = 0; i < type.init.args.length; i++) { - let a = type.init.args[i]; - let e = ast.args[i]; - let t = getExpType(ctx, e); + const a = type.init.args[i]; + const e = ast.args[i]; + const t = getExpType(ctx, e); if (!isAssignable(t, a.type)) { throwError(`Invalid type "${printTypeRef(t)}" for argument "${a.name}"`, e.ref); } @@ -398,7 +398,7 @@ export function resolveInitOf(ast: ASTInitOf, sctx: StatementContext, ctx: Compi export function resolveConditional(ast: ASTConditional, sctx: StatementContext, ctx: CompilerContext): CompilerContext { // Resolve condition ctx = resolveExpression(ast.condition, sctx, ctx); - let conditionType = getExpType(ctx, ast.condition); + const conditionType = getExpType(ctx, ast.condition); if (conditionType.kind !== 'ref' || conditionType.optional || conditionType.name !== 'Bool') { throwError(`Invalid type "${printTypeRef(conditionType)}" for ternary condition`, ast.condition.ref); } @@ -406,8 +406,8 @@ export function resolveConditional(ast: ASTConditional, sctx: StatementContext, // Resolve then and else branches ctx = resolveExpression(ast.thenBranch, sctx, ctx); ctx = resolveExpression(ast.elseBranch, sctx, ctx); - let thenType = getExpType(ctx, ast.thenBranch); - let elseType = getExpType(ctx, ast.elseBranch); + const thenType = getExpType(ctx, ast.thenBranch); + const elseType = getExpType(ctx, ast.elseBranch); if (!typeRefEquals(thenType, elseType)) { throwError(`Non-matching types "${printTypeRef(thenType)}" and "${printTypeRef(elseType)}" for ternary branches`, ast.elseBranch.ref); } @@ -417,7 +417,7 @@ export function resolveConditional(ast: ASTConditional, sctx: StatementContext, } export function resolveLValueRef(path: ASTLvalueRef[], sctx: StatementContext, ctx: CompilerContext): CompilerContext { - let paths: ASTLvalueRef[] = path; + const paths: ASTLvalueRef[] = path; let t = sctx.vars[paths[0].name]; if (!t) { throwError(`Variable "${paths[0].name}" not found`, paths[0].ref); @@ -429,8 +429,8 @@ export function resolveLValueRef(path: ASTLvalueRef[], sctx: StatementContext, c if (t.kind !== 'ref' || t.optional) { throwError(`Invalid type "${printTypeRef(t)}" for field access`, path[i].ref); } - let srcT = getType(ctx, t.name); - let ex = srcT.fields.find((v) => v.name === paths[i].name); + const srcT = getType(ctx, t.name); + const ex = srcT.fields.find((v) => v.name === paths[i].name); if (!ex) { throwError('Field ' + paths[i].name + ' not found in type ' + srcT.name, path[i].ref); } @@ -487,12 +487,12 @@ export function resolveExpression(exp: ASTExpression, sctx: StatementContext, ct if (exp.kind === 'id') { // Find variable - let v = sctx.vars[exp.value]; + const v = sctx.vars[exp.value]; if (!v) { if (!hasStaticConstant(ctx, exp.value)) { throwError('Unable to resolve id ' + exp.value, exp.ref); } else { - let cc = getStaticConstant(ctx, exp.value); + const cc = getStaticConstant(ctx, exp.value); return registerExpType(ctx, exp, cc.type); } } @@ -528,9 +528,9 @@ export function resolveExpression(exp: ASTExpression, sctx: StatementContext, ct } export function getAllExpressionTypes(ctx: CompilerContext) { - let res: [string, string][] = []; - let a = store.all(ctx); - for (let e in a) { + const res: [string, string][] = []; + const a = store.all(ctx); + for (const e in a) { res.push([a[e].ast.ref.contents, printTypeRef(a[e].description)]); } return res; diff --git a/src/types/resolveSignatures.ts b/src/types/resolveSignatures.ts index 9c7741683..37b9c1383 100644 --- a/src/types/resolveSignatures.ts +++ b/src/types/resolveSignatures.ts @@ -1,5 +1,5 @@ import * as changeCase from 'change-case'; -import { ABIField, beginCell } from "@ton/core"; +import { ABIField } from "@ton/core"; import { CompilerContext } from "../context"; import { idToHex } from '../utils/idToHex'; import { newMessageId } from "../utils/newMessageId"; @@ -7,8 +7,8 @@ import { getAllTypes, getType } from "./resolveDescriptors"; export function resolveSignatures(ctx: CompilerContext) { - let types = getAllTypes(ctx); - let signatures = new Map(); + const types = getAllTypes(ctx); + const signatures = new Map(); function createTypeFormat(type: string, format: string | number | boolean | null) { if (type === 'int') { if (typeof format === 'number') { @@ -78,11 +78,11 @@ export function resolveSignatures(ctx: CompilerContext) { } // Struct types - let t = getType(ctx, type); + const t = getType(ctx, type); if (t.kind !== 'struct') { throw Error('Unsupported type ' + type); } - let s = createTupeSignature(type); + const s = createTupeSignature(type); if (format === 'ref') { return `^${s.signature}`; } else if (format !== null) { @@ -105,8 +105,8 @@ export function resolveSignatures(ctx: CompilerContext) { if (src.type.format !== null && src.type.format !== undefined) { throw Error('Unsupported map format ' + src.type.format); } - let key = createTypeFormat(src.type.key, src.type.keyFormat ? src.type.keyFormat : null); - let value = createTypeFormat(src.type.value, src.type.valueFormat ? src.type.valueFormat : null); + const key = createTypeFormat(src.type.key, src.type.keyFormat ? src.type.keyFormat : null); + const value = createTypeFormat(src.type.value, src.type.valueFormat ? src.type.valueFormat : null); return src.name + ':dict<' + key + ', ' + value + '>'; } @@ -117,14 +117,14 @@ export function resolveSignatures(ctx: CompilerContext) { if (signatures.has(name)) { return signatures.get(name)! } - let t = getType(ctx, name); + const t = getType(ctx, name); if (t.kind !== 'struct') { throw Error('Unsupported type ' + name); } - let fields = t.fields.map((v) => createTLBField(v.abi)); + const fields = t.fields.map((v) => createTLBField(v.abi)); // Calculate signature and method id - let signature = name + '{' + fields.join(',') + '}'; + const signature = name + '{' + fields.join(',') + '}'; let id: number | null = null; if (t.ast.kind === 'def_struct' && t.ast.message) { if (t.ast.prefix !== null) { @@ -135,17 +135,17 @@ export function resolveSignatures(ctx: CompilerContext) { } // Calculate TLB - let tlbHeader = (id !== null ? changeCase.snakeCase(name) + '#' + idToHex(id) : '_'); - let tlb = tlbHeader + ' ' + fields.join(' ') + ' = ' + name; + const tlbHeader = (id !== null ? changeCase.snakeCase(name) + '#' + idToHex(id) : '_'); + const tlb = tlbHeader + ' ' + fields.join(' ') + ' = ' + name; signatures.set(name, { signature, id, tlb }); return { signature, id, tlb }; } - for (let k in types) { - let t = types[k]; + for (const k in types) { + const t = types[k]; if (t.kind === 'struct') { - let r = createTupeSignature(t.name); + const r = createTupeSignature(t.name); t.tlb = r.tlb; t.signature = r.signature; t.header = r.id; diff --git a/src/types/resolveStatements.spec.ts b/src/types/resolveStatements.spec.ts index ea739f04c..922684180 100644 --- a/src/types/resolveStatements.spec.ts +++ b/src/types/resolveStatements.spec.ts @@ -10,7 +10,7 @@ describe('resolveStatements', () => { beforeEach(() => { __DANGER_resetNodeId(); }); - for (let r of loadCases(__dirname + "/stmts/")) { + for (const r of loadCases(__dirname + "/stmts/")) { it('should resolve statements for ' + r.name, () => { let ctx = openContext(new CompilerContext(), [{ code: r.code, path: '', origin: 'user' }], []); ctx = resolveDescriptors(ctx); @@ -18,7 +18,7 @@ describe('resolveStatements', () => { expect(getAllExpressionTypes(ctx)).toMatchSnapshot(); }); } - for (let r of loadCases(__dirname + "/stmts-failed/")) { + for (const r of loadCases(__dirname + "/stmts-failed/")) { it('should fail statements for ' + r.name, () => { let ctx = openContext(new CompilerContext(), [{ code: r.code, path: '', origin: 'user' }], []); ctx = resolveDescriptors(ctx); diff --git a/src/types/resolveStatements.ts b/src/types/resolveStatements.ts index 1f0fb9890..cfbe48df6 100644 --- a/src/types/resolveStatements.ts +++ b/src/types/resolveStatements.ts @@ -38,7 +38,7 @@ function removeRequiredVariable(name: string, src: StatementContext): StatementC if (!src.requiredFields.find((v) => v === name)) { throw Error('Variable is not required: ' + name); // Should happen earlier } - let filtered = src.requiredFields.filter((v) => v !== name); + const filtered = src.requiredFields.filter((v) => v !== name); return { ...src, requiredFields: filtered @@ -66,28 +66,28 @@ function processCondition(condition: ASTCondition, sctx: StatementContext, ctx: // Simple if if (condition.falseStatements === null && condition.elseif === null) { - let r = processStatements(condition.trueStatements, initialCtx, ctx); + const r = processStatements(condition.trueStatements, initialCtx, ctx); ctx = r.ctx; return { ctx, sctx: initialCtx }; } // Simple if-else - let processedCtx: StatementContext[] = []; + const processedCtx: StatementContext[] = []; // Process true branch - let r = processStatements(condition.trueStatements, initialCtx, ctx); + const r = processStatements(condition.trueStatements, initialCtx, ctx); ctx = r.ctx; processedCtx.push(r.sctx); // Process else/elseif branch if (condition.falseStatements !== null && condition.elseif === null) { // if-else - let r = processStatements(condition.falseStatements, initialCtx, ctx); + const r = processStatements(condition.falseStatements, initialCtx, ctx); ctx = r.ctx; processedCtx.push(r.sctx); } else if (condition.falseStatements === null && condition.elseif !== null) { // if-else if - let r = processCondition(condition.elseif, initialCtx, ctx); + const r = processCondition(condition.elseif, initialCtx, ctx); ctx = r.ctx; processedCtx.push(r.sctx); } else { @@ -95,10 +95,10 @@ function processCondition(condition: ASTCondition, sctx: StatementContext, ctx: } // Merge statement contexts - let removed: string[] = []; - for (let f of initialCtx.requiredFields) { + const removed: string[] = []; + for (const f of initialCtx.requiredFields) { let found = false; - for (let c of processedCtx) { + for (const c of processedCtx) { if (c.requiredFields.find((v) => v === f)) { found = true; break; @@ -108,7 +108,7 @@ function processCondition(condition: ASTCondition, sctx: StatementContext, ctx: removed.push(f); } } - for (let r of removed) { + for (const r of removed) { initialCtx = removeRequiredVariable(r, initialCtx); } @@ -120,7 +120,7 @@ function processStatements(statements: ASTStatement[], sctx: StatementContext, c // Process statements let exited = false; - for (let s of statements) { + for (const s of statements) { // Check for unreachable if (exited) { @@ -134,8 +134,8 @@ function processStatements(statements: ASTStatement[], sctx: StatementContext, c ctx = resolveExpression(s.expression, sctx, ctx); // Check type - let expressionType = getExpType(ctx, s.expression); - let variableType = resolveTypeRef(ctx, s.type); + const expressionType = getExpType(ctx, s.expression); + const variableType = resolveTypeRef(ctx, s.type); if (!isAssignable(expressionType, variableType)) { throwError(`Type mismatch: ${printTypeRef(expressionType)} is not assignable to ${printTypeRef(variableType)}`, s.ref); } @@ -155,8 +155,8 @@ function processStatements(statements: ASTStatement[], sctx: StatementContext, c ctx = resolveExpression(s.expression, sctx, ctx); // Check type - let expressionType = getExpType(ctx, s.expression); - let tailType = getExpType(ctx, s.path[s.path.length - 1]); + const expressionType = getExpType(ctx, s.expression); + const tailType = getExpType(ctx, s.path[s.path.length - 1]); if (!isAssignable(expressionType, tailType)) { throwError(`Type mismatch: ${printTypeRef(expressionType)} is not assignable to ${printTypeRef(tailType)}`, s.ref); } @@ -178,8 +178,8 @@ function processStatements(statements: ASTStatement[], sctx: StatementContext, c ctx = resolveExpression(s.expression, sctx, ctx); // Check type - let expressionType = getExpType(ctx, s.expression); - let tailType = getExpType(ctx, s.path[s.path.length - 1]); + const expressionType = getExpType(ctx, s.expression); + const tailType = getExpType(ctx, s.path[s.path.length - 1]); if (!isAssignable(expressionType, tailType)) { throwError(`Type mismatch: ${printTypeRef(expressionType)} is not assignable to ${printTypeRef(tailType)}`, s.ref); } @@ -200,12 +200,12 @@ function processStatements(statements: ASTStatement[], sctx: StatementContext, c } else if (s.kind === 'statement_condition') { // Process condition (expression resolved inside) - let r = processCondition(s, sctx, ctx); + const r = processCondition(s, sctx, ctx); ctx = r.ctx; sctx = r.sctx; // Check type - let expressionType = getExpType(ctx, s.expression); + const expressionType = getExpType(ctx, s.expression); if (expressionType.kind !== 'ref' || expressionType.name !== 'Bool' || expressionType.optional) { throwError(`Type mismatch: ${printTypeRef(expressionType)} is not assignable to Bool`, s.ref); } @@ -218,7 +218,7 @@ function processStatements(statements: ASTStatement[], sctx: StatementContext, c ctx = resolveExpression(s.expression, sctx, ctx); // Check type - let expressionType = getExpType(ctx, s.expression); + const expressionType = getExpType(ctx, s.expression); if (!isAssignable(expressionType, sctx.returns)) { throwError(`Type mismatch: ${printTypeRef(expressionType)} is not assignable to ${printTypeRef(sctx.returns)}`, s.ref); } @@ -246,13 +246,13 @@ function processStatements(statements: ASTStatement[], sctx: StatementContext, c ctx = resolveExpression(s.condition, sctx, ctx); // Check type - let expressionType = getExpType(ctx, s.condition); + const expressionType = getExpType(ctx, s.condition); if (expressionType.kind !== 'ref' || expressionType.name !== 'Int' || expressionType.optional) { throwError(`Type mismatch: ${printTypeRef(expressionType)} is not assignable to Int`, s.ref); } // Process inner statements - let r = processStatements(s.statements, sctx, ctx); + const r = processStatements(s.statements, sctx, ctx); ctx = r.ctx; sctx = r.sctx; @@ -262,13 +262,13 @@ function processStatements(statements: ASTStatement[], sctx: StatementContext, c ctx = resolveExpression(s.condition, sctx, ctx); // Check type - let expressionType = getExpType(ctx, s.condition); + const expressionType = getExpType(ctx, s.condition); if (expressionType.kind !== 'ref' || expressionType.name !== 'Bool' || expressionType.optional) { throwError(`Type mismatch: ${printTypeRef(expressionType)} is not assignable to bool`, s.ref); } // Process inner statements - let r = processStatements(s.statements, sctx, ctx); + const r = processStatements(s.statements, sctx, ctx); ctx = r.ctx; sctx = r.sctx; @@ -278,13 +278,13 @@ function processStatements(statements: ASTStatement[], sctx: StatementContext, c ctx = resolveExpression(s.condition, sctx, ctx); // Check type - let expressionType = getExpType(ctx, s.condition); + const expressionType = getExpType(ctx, s.condition); if (expressionType.kind !== 'ref' || expressionType.name !== 'Bool' || expressionType.optional) { throwError(`Type mismatch: ${printTypeRef(expressionType)} is not assignable to bool`, s.ref); } // Process inner statements - let r = processStatements(s.statements, sctx, ctx); + const r = processStatements(s.statements, sctx, ctx); ctx = r.ctx; sctx = r.sctx; @@ -297,7 +297,7 @@ function processStatements(statements: ASTStatement[], sctx: StatementContext, c } function processFunctionBody(statements: ASTStatement[], sctx: StatementContext, ctx: CompilerContext) { - let res = processStatements(statements, sctx, ctx); + const res = processStatements(statements, sctx, ctx); // Check if all required variables are assigned if (res.sctx.requiredFields.length > 0) { @@ -314,12 +314,12 @@ function processFunctionBody(statements: ASTStatement[], sctx: StatementContext, export function resolveStatements(ctx: CompilerContext) { // Process all static functions - for (let f of Object.values(getAllStaticFunctions(ctx))) { + for (const f of Object.values(getAllStaticFunctions(ctx))) { if (f.ast.kind === 'def_function') { // Build statement context let sctx = emptyContext(f.ast.ref, f.returns); - for (let p of f.args) { + for (const p of f.args) { sctx = addVariable(p.name, p.type, sctx); } @@ -331,7 +331,7 @@ export function resolveStatements(ctx: CompilerContext) { } // Process all types - for (let t of Object.values(getAllTypes(ctx))) { + for (const t of Object.values(getAllTypes(ctx))) { // Process init if (t.init) { @@ -343,7 +343,7 @@ export function resolveStatements(ctx: CompilerContext) { sctx = addVariable('self', { kind: 'ref', name: t.name, optional: false }, sctx); // Required variables - for (let f of t.fields) { + for (const f of t.fields) { if (f.default !== undefined) { // NOTE: undefined is important here continue; } @@ -354,7 +354,7 @@ export function resolveStatements(ctx: CompilerContext) { } // Args - for (let p of t.init.args) { + for (const p of t.init.args) { sctx = addVariable(p.name, p.type, sctx); } @@ -389,13 +389,13 @@ export function resolveStatements(ctx: CompilerContext) { } // Process functions - for (let f of t.functions.values()) { + for (const f of t.functions.values()) { if (f.ast.kind !== 'def_native_function') { // Build statement context let sctx = emptyContext(f.ast.ref, f.returns); sctx = addVariable('self', { kind: 'ref', name: t.name, optional: false }, sctx); - for (let a of f.args) { + for (const a of f.args) { sctx = addVariable(a.name, a.type, sctx); } diff --git a/src/utils/Writer.ts b/src/utils/Writer.ts index 27c65bc19..704fd73d9 100644 --- a/src/utils/Writer.ts +++ b/src/utils/Writer.ts @@ -15,8 +15,8 @@ export class Writer { } write(src: string) { - let lines = trimIndent(src).split('\n'); - for (let l of lines) { + const lines = trimIndent(src).split('\n'); + for (const l of lines) { this.append(l); } } diff --git a/src/utils/calculateIPFSlink.ts b/src/utils/calculateIPFSlink.ts index a2d749afb..858a62a73 100644 --- a/src/utils/calculateIPFSlink.ts +++ b/src/utils/calculateIPFSlink.ts @@ -3,7 +3,7 @@ import { MemoryBlockstore } from 'blockstore-core/memory'; export async function calculateIPFSlink(data: Buffer) { const blockstore = new MemoryBlockstore(); - let cid = await new Promise((resolve, reject) => { + const cid = await new Promise((resolve, reject) => { (async () => { try { for await (const entry of importer({ content: data }, blockstore)) { diff --git a/src/utils/errorToString.ts b/src/utils/errorToString.ts index b50757aff..4844851e9 100644 --- a/src/utils/errorToString.ts +++ b/src/utils/errorToString.ts @@ -1,4 +1,4 @@ -export function errorToString(src: any): string { +export function errorToString(src: unknown): string { if (src instanceof Error) { return src.stack || src.message; } else { diff --git a/src/utils/filePath.ts b/src/utils/filePath.ts index 4f78729d7..7a5708417 100644 --- a/src/utils/filePath.ts +++ b/src/utils/filePath.ts @@ -1,13 +1,8 @@ -// ts-ignore is used on purpose here (instead of installing @types/node or similar) -// because the whole package must not depend on any node code -// however, this function is required to fix compilation on windows +import pathModule from 'node:path'; + export function posixNormalize(path: string): string { - // @ts-ignore if (typeof global === 'object' && typeof global.process === 'object' && typeof global.process.versions === 'object' && global.process.versions.node) { - // @ts-ignore - const pathModule = require('node:path'); - let normalized_path = path.split(pathModule.sep).join(pathModule.posix.sep); - return normalized_path; + return path.split(pathModule.sep).join(pathModule.posix.sep); } return path; } diff --git a/src/utils/loadCases.ts b/src/utils/loadCases.ts index a94fbcf4a..055f1f807 100644 --- a/src/utils/loadCases.ts +++ b/src/utils/loadCases.ts @@ -1,9 +1,9 @@ import fs from 'fs'; export function loadCases(src: string) { - let recs = fs.readdirSync(src); - let res: { name: string, code: string }[] = []; - for (let r of recs) { + const recs = fs.readdirSync(src); + const res: { name: string, code: string }[] = []; + for (const r of recs) { if (r.endsWith('.tact')) { res.push({ name: r.slice(0, r.length - '.tact'.length), code: fs.readFileSync(src + r, 'utf8') }); } diff --git a/src/utils/text.spec.ts b/src/utils/text.spec.ts index 57d9d223f..fc4fcdf92 100644 --- a/src/utils/text.spec.ts +++ b/src/utils/text.spec.ts @@ -7,7 +7,7 @@ describe('text', () => { expect(isBlank('a')).toBe(false); }); it('should trim indent', () => { - let res = trimIndent(` + const res = trimIndent(` hello world 123123 123123 12312312 diff --git a/src/utils/text.ts b/src/utils/text.ts index 6b21f97d4..2bcb2f69a 100644 --- a/src/utils/text.ts +++ b/src/utils/text.ts @@ -35,8 +35,8 @@ export function trimIndent(src: string) { } // Find minimal indent - let indents = lines.filter((v) => !isBlank(v)).map((v) => indentWidth(v)); - let minimal = indents.length > 0 ? Math.min(...indents) : 0; + const indents = lines.filter((v) => !isBlank(v)).map((v) => indentWidth(v)); + const minimal = indents.length > 0 ? Math.min(...indents) : 0; // Trim indent return lines.map((v) => isBlank(v) ? '' : v.slice(minimal)).join('\n'); diff --git a/src/utils/utils.ts b/src/utils/utils.ts index 2b36b5eb2..c8fa53094 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -1,16 +1,16 @@ import { crc16 } from "./crc16"; export function topologicalSort(src: T[], references: (src: T) => T[]) { - let result: T[] = []; - let visited = new Set(); - let visiting = new Set(); - let visit = (src: T) => { + const result: T[] = []; + const visited = new Set(); + const visiting = new Set(); + const visit = (src: T) => { if (visiting.has(src)) { throw Error('Cycle detected'); } if (!visited.has(src)) { visiting.add(src); - for (let r of references(src)) { + for (const r of references(src)) { visit(r); } visiting.delete(src); @@ -18,16 +18,17 @@ export function topologicalSort(src: T[], references: (src: T) => T[]) { result.push(src); } } - for (let s of src) { + for (const s of src) { visit(s); } return result; } export function deepFreeze(obj: T) { - var propNames = Object.getOwnPropertyNames(obj); - for (let name of propNames) { - let value = (obj as any)[name]; + const propNames = Object.getOwnPropertyNames(obj); + for (const name of propNames) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const value = (obj as any)[name]; if (value && typeof value === "object") { deepFreeze(value); } diff --git a/src/verify.ts b/src/verify.ts index 96f0b897c..272df81c8 100644 --- a/src/verify.ts +++ b/src/verify.ts @@ -21,7 +21,7 @@ export async function verify(args: { pkg: string, logger?: TactLogger | null | u // Loading package let unpacked: PackageFileFormat; try { - let data = JSON.parse(args.pkg); + const data = JSON.parse(args.pkg); unpacked = fileFormat.parse(data); } catch (e) { return { ok: false, error: 'invalid-package-format' }; @@ -39,15 +39,15 @@ export async function verify(args: { pkg: string, logger?: TactLogger | null | u if (!unpacked.compiler.parameters) { return { ok: false, error: 'invalid-package-format' } } - let params = JSON.parse(unpacked.compiler.parameters); + const params = JSON.parse(unpacked.compiler.parameters); if (typeof params.entrypoint !== 'string') { return { ok: false, error: 'invalid-package-format' } } - let options: Options = params.options || {}; - let entrypoint: string = params.entrypoint; + const options: Options = params.options || {}; + const entrypoint: string = params.entrypoint; // Create config - let config: Config = { + const config: Config = { projects: [{ name: 'verifier', path: normalize('./contract/' + entrypoint), @@ -57,25 +57,25 @@ export async function verify(args: { pkg: string, logger?: TactLogger | null | u } // Build - let files: { [key: string]: string } = {} - for (let s in unpacked.sources) { + const files: { [key: string]: string } = {} + for (const s in unpacked.sources) { files['contract/' + s] = unpacked.sources[s]; } - let result = await run({ config, files, logger }); + const result = await run({ config, files, logger }); if (!result) { return { ok: false, error: 'compilation-failed' }; } // Read output - let compiledCell = files['output/verifier_' + unpacked.name + '.code.boc']; + const compiledCell = files['output/verifier_' + unpacked.name + '.code.boc']; if (!compiledCell) { return { ok: false, error: 'verification-failed' }; } // Check output - let a = Cell.fromBase64(compiledCell); - let b = Cell.fromBase64(unpacked.code); + const a = Cell.fromBase64(compiledCell); + const b = Cell.fromBase64(unpacked.code); if (!a.equals(b)) { return { ok: false, error: 'verification-failed' }; } diff --git a/src/vfs/createNodeFileSystem.spec.ts b/src/vfs/createNodeFileSystem.spec.ts index 7daf05123..c25855f17 100644 --- a/src/vfs/createNodeFileSystem.spec.ts +++ b/src/vfs/createNodeFileSystem.spec.ts @@ -5,16 +5,16 @@ import { createNodeFileSystem } from './createNodeFileSystem'; describe('createNodeFileSystem', () => { it('should open file system', () => { - let vfs = createNodeFileSystem(path.resolve(__dirname, './__testdata/')); + const vfs = createNodeFileSystem(path.resolve(__dirname, './__testdata/')); expect(vfs.root).toBe(path.normalize(__dirname + '/__testdata/')); }); it('should write and read files', () => { - let vfs = createNodeFileSystem(path.resolve(__dirname, './__testdata'), false); + const vfs = createNodeFileSystem(path.resolve(__dirname, './__testdata'), false); // Create a single file - let filename = 'tmp-' + Math.random() + '.txt'; - let realPath = vfs.resolve(filename); + const filename = 'tmp-' + Math.random() + '.txt'; + const realPath = vfs.resolve(filename); try { expect(vfs.exists(realPath)).toBe(false); vfs.writeFile(realPath, 'Hello world'); @@ -26,10 +26,10 @@ describe('createNodeFileSystem', () => { } // Automatically create directories - let dir = 'dir-' + Math.random(); - let fileName2 = dir + '/' + Math.random() + '.txt'; - let realPath2 = vfs.resolve(fileName2); - let realPaathDir2 = vfs.resolve(dir); + const dir = 'dir-' + Math.random(); + const fileName2 = dir + '/' + Math.random() + '.txt'; + const realPath2 = vfs.resolve(fileName2); + const realPaathDir2 = vfs.resolve(dir); try { expect(vfs.exists(realPath2)).toBe(false); vfs.writeFile(realPath2, 'Hello world'); diff --git a/src/vfs/createVirtualFileSystem.spec.ts b/src/vfs/createVirtualFileSystem.spec.ts index 742e960dd..cbc0fdb5e 100644 --- a/src/vfs/createVirtualFileSystem.spec.ts +++ b/src/vfs/createVirtualFileSystem.spec.ts @@ -13,11 +13,11 @@ describe('createVirtualFileSystem', () => { }); it('should read from virtual file system', () => { - let fs: { [key: string]: string } = { + const fs: { [key: string]: string } = { ['file.txt']: Buffer.from('Hello World').toString('base64'), ['empty.txt']: Buffer.from([]).toString('base64'), }; - let vfs = createVirtualFileSystem('@stdlib', fs); + const vfs = createVirtualFileSystem('@stdlib', fs); let realPath = vfs.resolve('./', './', 'file.txt'); expect(realPath).toBe('@stdlib/file.txt'); expect(vfs.exists(realPath)).toBe(true); diff --git a/src/vfs/createVirtualFileSystem.ts b/src/vfs/createVirtualFileSystem.ts index eba86deeb..ddfd01fe4 100644 --- a/src/vfs/createVirtualFileSystem.ts +++ b/src/vfs/createVirtualFileSystem.ts @@ -12,7 +12,7 @@ export function createVirtualFileSystem(root: string, fs: { [key: string]: strin if (!filePath.startsWith(normalizedRoot)) { throw new Error(`Path '${filePath}' is outside of the root directory '${normalizedRoot}'`); } - let name = filePath.slice(normalizedRoot.length); + const name = filePath.slice(normalizedRoot.length); return typeof fs[name] === 'string'; }, resolve(...filePath) { @@ -22,8 +22,8 @@ export function createVirtualFileSystem(root: string, fs: { [key: string]: strin if (!filePath.startsWith(normalizedRoot)) { throw new Error(`Path '${filePath}' is outside of the root directory '${normalizedRoot}'`); } - let name = filePath.slice(normalizedRoot.length); - let content = fs[name]; + const name = filePath.slice(normalizedRoot.length); + const content = fs[name]; if (typeof content !== 'string') { throw Error(`File ${name} not found at ${filePath}`); } else { @@ -37,7 +37,7 @@ export function createVirtualFileSystem(root: string, fs: { [key: string]: strin if (!filePath.startsWith(normalizedRoot)) { throw new Error(`Path '${filePath}' is outside of the root directory '${normalizedRoot}'`); } - let name = filePath.slice(normalizedRoot.length); + const name = filePath.slice(normalizedRoot.length); fs[name] = typeof content === 'string' ? Buffer.from(content).toString('base64') : content.toString('base64'); } } diff --git a/yarn.lock b/yarn.lock index f4dd202d6..836affe0d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,6 +2,11 @@ # yarn lockfile v1 +"@aashutoshrathi/word-wrap@^1.2.3": + version "1.2.6" + resolved "https://registry.yarnpkg.com/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz#bd9154aec9983f77b3a034ecaa015c2e4201f6cf" + integrity sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA== + "@ampproject/remapping@^2.1.0": version "2.2.0" resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.2.0.tgz#56c133824780de3174aed5ab6834f3026790154d" @@ -309,6 +314,57 @@ dependencies: "@jridgewell/trace-mapping" "0.3.9" +"@eslint-community/eslint-utils@^4.2.0", "@eslint-community/eslint-utils@^4.4.0": + version "4.4.0" + resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59" + integrity sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA== + dependencies: + eslint-visitor-keys "^3.3.0" + +"@eslint-community/regexpp@^4.5.1", "@eslint-community/regexpp@^4.6.1": + version "4.10.0" + resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.10.0.tgz#548f6de556857c8bb73bbee70c35dc82a2e74d63" + integrity sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA== + +"@eslint/eslintrc@^2.1.4": + version "2.1.4" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.1.4.tgz#388a269f0f25c1b6adc317b5a2c55714894c70ad" + integrity sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ== + dependencies: + ajv "^6.12.4" + debug "^4.3.2" + espree "^9.6.0" + globals "^13.19.0" + ignore "^5.2.0" + import-fresh "^3.2.1" + js-yaml "^4.1.0" + minimatch "^3.1.2" + strip-json-comments "^3.1.1" + +"@eslint/js@8.56.0": + version "8.56.0" + resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.56.0.tgz#ef20350fec605a7f7035a01764731b2de0f3782b" + integrity sha512-gMsVel9D7f2HLkBma9VbtzZRehRogVRfbr++f06nL2vnCGCNlzOD+/MUov/F4p8myyAHspEhVobgjpX64q5m6A== + +"@humanwhocodes/config-array@^0.11.13": + version "0.11.14" + resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.14.tgz#d78e481a039f7566ecc9660b4ea7fe6b1fec442b" + integrity sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg== + dependencies: + "@humanwhocodes/object-schema" "^2.0.2" + debug "^4.3.1" + minimatch "^3.0.5" + +"@humanwhocodes/module-importer@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz#af5b2691a22b44be847b0ca81641c5fb6ad0172c" + integrity sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA== + +"@humanwhocodes/object-schema@^2.0.2": + version "2.0.2" + resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-2.0.2.tgz#d9fae00a2d5cb40f92cfe64b47ad749fbc38f917" + integrity sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw== + "@iarna/toml@2.2.5": version "2.2.5" resolved "https://registry.yarnpkg.com/@iarna/toml/-/toml-2.2.5.tgz#b32366c89b43c6f8cefbdefac778b9c828e3ba8c" @@ -598,7 +654,7 @@ resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz#5bd262af94e9d25bd1e71b05deed44876a222e8b" integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A== -"@nodelib/fs.walk@^1.2.3": +"@nodelib/fs.walk@^1.2.3", "@nodelib/fs.walk@^1.2.8": version "1.2.8" resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz#e95737e8bb6746ddedf69c556953494f196fe69a" integrity sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg== @@ -991,6 +1047,11 @@ resolved "https://registry.yarnpkg.com/@types/js-yaml/-/js-yaml-4.0.5.tgz#738dd390a6ecc5442f35e7f03fa1431353f7e138" integrity sha512-FhpRzf927MNQdRZP0J5DLIdTXhjLYzeUTmLAu69mnVksLH9CJY3IuSeEgbKUki7GQZm0WqDkGzyxju2EZGD2wA== +"@types/json-schema@^7.0.12": + version "7.0.15" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" + integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA== + "@types/long@^4.0.1": version "4.0.2" resolved "https://registry.yarnpkg.com/@types/long/-/long-4.0.2.tgz#b74129719fc8d11c01868010082d483b7545591a" @@ -1021,6 +1082,11 @@ resolved "https://registry.yarnpkg.com/@types/qs/-/qs-6.9.7.tgz#63bb7d067db107cc1e457c303bc25d511febf6cb" integrity sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw== +"@types/semver@^7.5.0": + version "7.5.7" + resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.7.tgz#326f5fdda70d13580777bcaa1bc6fa772a5aef0e" + integrity sha512-/wdoPq1QqkSj9/QOeKkFquEuPzQbHTWAMPH/PaUMB+JuR31lXhlWXRZ52IpfDYVlDOUBvX09uBrPwxGT1hjNBg== + "@types/stack-utils@^2.0.0": version "2.0.1" resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.1.tgz#20f18294f797f2209b5f65c8e3b5c8e8261d127c" @@ -1038,6 +1104,102 @@ dependencies: "@types/yargs-parser" "*" +"@typescript-eslint/eslint-plugin@^7.0.2": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.0.2.tgz#c13a34057be425167cc4a765158c46fdf2fd981d" + integrity sha512-/XtVZJtbaphtdrWjr+CJclaCVGPtOdBpFEnvtNf/jRV0IiEemRrL0qABex/nEt8isYcnFacm3nPHYQwL+Wb7qg== + dependencies: + "@eslint-community/regexpp" "^4.5.1" + "@typescript-eslint/scope-manager" "7.0.2" + "@typescript-eslint/type-utils" "7.0.2" + "@typescript-eslint/utils" "7.0.2" + "@typescript-eslint/visitor-keys" "7.0.2" + debug "^4.3.4" + graphemer "^1.4.0" + ignore "^5.2.4" + natural-compare "^1.4.0" + semver "^7.5.4" + ts-api-utils "^1.0.1" + +"@typescript-eslint/parser@^7.0.2": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-7.0.2.tgz#95c31233d343db1ca1df8df7811b5b87ca7b1a68" + integrity sha512-GdwfDglCxSmU+QTS9vhz2Sop46ebNCXpPPvsByK7hu0rFGRHL+AusKQJ7SoN+LbLh6APFpQwHKmDSwN35Z700Q== + dependencies: + "@typescript-eslint/scope-manager" "7.0.2" + "@typescript-eslint/types" "7.0.2" + "@typescript-eslint/typescript-estree" "7.0.2" + "@typescript-eslint/visitor-keys" "7.0.2" + debug "^4.3.4" + +"@typescript-eslint/scope-manager@7.0.2": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-7.0.2.tgz#6ec4cc03752758ddd1fdaae6fbd0ed9a2ca4fe63" + integrity sha512-l6sa2jF3h+qgN2qUMjVR3uCNGjWw4ahGfzIYsCtFrQJCjhbrDPdiihYT8FnnqFwsWX+20hK592yX9I2rxKTP4g== + dependencies: + "@typescript-eslint/types" "7.0.2" + "@typescript-eslint/visitor-keys" "7.0.2" + +"@typescript-eslint/type-utils@7.0.2": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-7.0.2.tgz#a7fc0adff0c202562721357e7478207d380a757b" + integrity sha512-IKKDcFsKAYlk8Rs4wiFfEwJTQlHcdn8CLwLaxwd6zb8HNiMcQIFX9sWax2k4Cjj7l7mGS5N1zl7RCHOVwHq2VQ== + dependencies: + "@typescript-eslint/typescript-estree" "7.0.2" + "@typescript-eslint/utils" "7.0.2" + debug "^4.3.4" + ts-api-utils "^1.0.1" + +"@typescript-eslint/types@7.0.2": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-7.0.2.tgz#b6edd108648028194eb213887d8d43ab5750351c" + integrity sha512-ZzcCQHj4JaXFjdOql6adYV4B/oFOFjPOC9XYwCaZFRvqN8Llfvv4gSxrkQkd2u4Ci62i2c6W6gkDwQJDaRc4nA== + +"@typescript-eslint/typescript-estree@7.0.2": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-7.0.2.tgz#3c6dc8a3b9799f4ef7eca0d224ded01974e4cb39" + integrity sha512-3AMc8khTcELFWcKcPc0xiLviEvvfzATpdPj/DXuOGIdQIIFybf4DMT1vKRbuAEOFMwhWt7NFLXRkbjsvKZQyvw== + dependencies: + "@typescript-eslint/types" "7.0.2" + "@typescript-eslint/visitor-keys" "7.0.2" + debug "^4.3.4" + globby "^11.1.0" + is-glob "^4.0.3" + minimatch "9.0.3" + semver "^7.5.4" + ts-api-utils "^1.0.1" + +"@typescript-eslint/utils@7.0.2": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-7.0.2.tgz#8756123054cd934c8ba7db6a6cffbc654b10b5c4" + integrity sha512-PZPIONBIB/X684bhT1XlrkjNZJIEevwkKDsdwfiu1WeqBxYEEdIgVDgm8/bbKHVu+6YOpeRqcfImTdImx/4Bsw== + dependencies: + "@eslint-community/eslint-utils" "^4.4.0" + "@types/json-schema" "^7.0.12" + "@types/semver" "^7.5.0" + "@typescript-eslint/scope-manager" "7.0.2" + "@typescript-eslint/types" "7.0.2" + "@typescript-eslint/typescript-estree" "7.0.2" + semver "^7.5.4" + +"@typescript-eslint/visitor-keys@7.0.2": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-7.0.2.tgz#2899b716053ad7094962beb895d11396fc12afc7" + integrity sha512-8Y+YiBmqPighbm5xA2k4wKTxRzx9EkBu7Rlw+WHqMvRJ3RPz/BMBO9b2ru0LUNmXg120PHUXD5+SWFy2R8DqlQ== + dependencies: + "@typescript-eslint/types" "7.0.2" + eslint-visitor-keys "^3.4.1" + +"@ungap/structured-clone@^1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@ungap/structured-clone/-/structured-clone-1.2.0.tgz#756641adb587851b5ccb3e095daf27ae581c8406" + integrity sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ== + +acorn-jsx@^5.3.2: + version "5.3.2" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" + integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== + acorn-walk@^8.1.1, acorn-walk@^8.2.0: version "8.2.0" resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.2.0.tgz#741210f2e2426454508853a2f44d0ab83b7f69c1" @@ -1048,6 +1210,11 @@ acorn@^8.4.1, acorn@^8.7.0: resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.8.1.tgz#0a3f9cbecc4ec3bea6f0a80b66ae8dd2da250b73" integrity sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA== +acorn@^8.9.0: + version "8.11.3" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.11.3.tgz#71e0b14e13a4ec160724b38fb7b0f233b1b81d7a" + integrity sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg== + agent-base@6, agent-base@^6.0.0, agent-base@^6.0.2: version "6.0.2" resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.2.tgz#49fff58577cfee3f37176feab4c22e00f86d7f77" @@ -1055,6 +1222,16 @@ agent-base@6, agent-base@^6.0.0, agent-base@^6.0.2: dependencies: debug "4" +ajv@^6.12.4: + version "6.12.6" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" + integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== + dependencies: + fast-deep-equal "^3.1.1" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.4.1" + uri-js "^4.2.2" + ansi-align@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/ansi-align/-/ansi-align-3.0.1.tgz#0cdf12e111ace773a86e9a1fad1225c43cb19a59" @@ -1140,6 +1317,11 @@ argparse@^2.0.1: resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== +array-union@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" + integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== + array.prototype.map@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/array.prototype.map/-/array.prototype.map-1.0.5.tgz#6e43c2fee6c0fb5e4806da2dc92eb00970809e55" @@ -1631,7 +1813,7 @@ cross-env@^7.0.3: dependencies: cross-spawn "^7.0.1" -cross-spawn@^7.0.1, cross-spawn@^7.0.3: +cross-spawn@^7.0.1, cross-spawn@^7.0.2, cross-spawn@^7.0.3: version "7.0.3" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== @@ -1657,7 +1839,7 @@ data-uri-to-buffer@^4.0.0: resolved "https://registry.yarnpkg.com/data-uri-to-buffer/-/data-uri-to-buffer-4.0.0.tgz#b5db46aea50f6176428ac05b73be39a57701a64b" integrity sha512-Vr3mLBA8qWmcuschSLAOogKgQ/Jwxulv3RNE4FXnYWRGujzrRWQI4m12fQqRkwX06C0KanhLr4hK+GydchZsaA== -debug@4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1: +debug@4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.4: version "4.3.4" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== @@ -1681,7 +1863,7 @@ deep-extend@^0.6.0: resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== -deep-is@~0.1.3: +deep-is@^0.1.3, deep-is@~0.1.3: version "0.1.4" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== @@ -1768,6 +1950,13 @@ dir-glob@^3.0.1: dependencies: path-type "^4.0.0" +doctrine@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961" + integrity sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w== + dependencies: + esutils "^2.0.2" + dot-case@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/dot-case/-/dot-case-3.0.4.tgz#9b2b670d00a431667a8a75ba29cd1b98809ce751" @@ -1899,6 +2088,11 @@ escape-string-regexp@^2.0.0: resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz#a30304e99daa32e23b2fd20f51babd07cffca344" integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w== +escape-string-regexp@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" + integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== + escape-string-regexp@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz#4683126b500b61762f2dbebace1806e8be31b1c8" @@ -1916,16 +2110,101 @@ escodegen@^1.8.1: optionalDependencies: source-map "~0.6.1" +eslint-scope@^7.2.2: + version "7.2.2" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.2.2.tgz#deb4f92563390f32006894af62a22dba1c46423f" + integrity sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg== + dependencies: + esrecurse "^4.3.0" + estraverse "^5.2.0" + +eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.1, eslint-visitor-keys@^3.4.3: + version "3.4.3" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz#0cd72fe8550e3c2eae156a96a4dddcd1c8ac5800" + integrity sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag== + +eslint@^8.56.0: + version "8.56.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.56.0.tgz#4957ce8da409dc0809f99ab07a1b94832ab74b15" + integrity sha512-Go19xM6T9puCOWntie1/P997aXxFsOi37JIHRWI514Hc6ZnaHGKY9xFhrU65RT6CcBEzZoGG1e6Nq+DT04ZtZQ== + dependencies: + "@eslint-community/eslint-utils" "^4.2.0" + "@eslint-community/regexpp" "^4.6.1" + "@eslint/eslintrc" "^2.1.4" + "@eslint/js" "8.56.0" + "@humanwhocodes/config-array" "^0.11.13" + "@humanwhocodes/module-importer" "^1.0.1" + "@nodelib/fs.walk" "^1.2.8" + "@ungap/structured-clone" "^1.2.0" + ajv "^6.12.4" + chalk "^4.0.0" + cross-spawn "^7.0.2" + debug "^4.3.2" + doctrine "^3.0.0" + escape-string-regexp "^4.0.0" + eslint-scope "^7.2.2" + eslint-visitor-keys "^3.4.3" + espree "^9.6.1" + esquery "^1.4.2" + esutils "^2.0.2" + fast-deep-equal "^3.1.3" + file-entry-cache "^6.0.1" + find-up "^5.0.0" + glob-parent "^6.0.2" + globals "^13.19.0" + graphemer "^1.4.0" + ignore "^5.2.0" + imurmurhash "^0.1.4" + is-glob "^4.0.0" + is-path-inside "^3.0.3" + js-yaml "^4.1.0" + json-stable-stringify-without-jsonify "^1.0.1" + levn "^0.4.1" + lodash.merge "^4.6.2" + minimatch "^3.1.2" + natural-compare "^1.4.0" + optionator "^0.9.3" + strip-ansi "^6.0.1" + text-table "^0.2.0" + +espree@^9.6.0, espree@^9.6.1: + version "9.6.1" + resolved "https://registry.yarnpkg.com/espree/-/espree-9.6.1.tgz#a2a17b8e434690a5432f2f8018ce71d331a48c6f" + integrity sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ== + dependencies: + acorn "^8.9.0" + acorn-jsx "^5.3.2" + eslint-visitor-keys "^3.4.1" + esprima@^4.0.0, esprima@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== +esquery@^1.4.2: + version "1.5.0" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.5.0.tgz#6ce17738de8577694edd7361c57182ac8cb0db0b" + integrity sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg== + dependencies: + estraverse "^5.1.0" + +esrecurse@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.3.0.tgz#7ad7964d679abb28bee72cec63758b1c5d2c9921" + integrity sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag== + dependencies: + estraverse "^5.2.0" + estraverse@^4.2.0: version "4.3.0" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== +estraverse@^5.1.0, estraverse@^5.2.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123" + integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== + esutils@^2.0.2: version "2.0.3" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" @@ -1986,6 +2265,11 @@ external-editor@^3.0.3: iconv-lite "^0.4.24" tmp "^0.0.33" +fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" + integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== + fast-glob@^3.2.11, fast-glob@^3.2.7: version "3.2.12" resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.12.tgz#7f39ec99c2e6ab030337142da9e0c18f37afae80" @@ -1997,12 +2281,23 @@ fast-glob@^3.2.11, fast-glob@^3.2.7: merge2 "^1.3.0" micromatch "^4.0.4" -fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.1.0: +fast-glob@^3.2.9: + version "3.3.2" + resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.2.tgz#a904501e57cfdd2ffcded45e99a54fef55e46129" + integrity sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow== + dependencies: + "@nodelib/fs.stat" "^2.0.2" + "@nodelib/fs.walk" "^1.2.3" + glob-parent "^5.1.2" + merge2 "^1.3.0" + micromatch "^4.0.4" + +fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.0.0, fast-json-stable-stringify@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== -fast-levenshtein@~2.0.6: +fast-levenshtein@^2.0.6, fast-levenshtein@~2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" integrity sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw== @@ -2037,6 +2332,13 @@ figures@^5.0.0: escape-string-regexp "^5.0.0" is-unicode-supported "^1.2.0" +file-entry-cache@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027" + integrity sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg== + dependencies: + flat-cache "^3.0.4" + file-uri-to-path@2: version "2.0.0" resolved "https://registry.yarnpkg.com/file-uri-to-path/-/file-uri-to-path-2.0.0.tgz#7b415aeba227d575851e0a5b0c640d7656403fba" @@ -2057,6 +2359,28 @@ find-up@^4.0.0, find-up@^4.1.0: locate-path "^5.0.0" path-exists "^4.0.0" +find-up@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" + integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== + dependencies: + locate-path "^6.0.0" + path-exists "^4.0.0" + +flat-cache@^3.0.4: + version "3.2.0" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.2.0.tgz#2c0c2d5040c99b1632771a9d105725c0115363ee" + integrity sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw== + dependencies: + flatted "^3.2.9" + keyv "^4.5.3" + rimraf "^3.0.2" + +flatted@^3.2.9: + version "3.2.9" + resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.9.tgz#7eb4c67ca1ba34232ca9d2d93e9886e611ad7daf" + integrity sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ== + form-data-encoder@^2.1.2: version "2.1.4" resolved "https://registry.yarnpkg.com/form-data-encoder/-/form-data-encoder-2.1.4.tgz#261ea35d2a70d48d30ec7a9603130fa5515e9cd5" @@ -2196,6 +2520,13 @@ glob-parent@^5.1.2: dependencies: is-glob "^4.0.1" +glob-parent@^6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-6.0.2.tgz#6d237d99083950c79290f24c7642a3de9a28f9e3" + integrity sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A== + dependencies: + is-glob "^4.0.3" + glob@^7.0.0, glob@^7.1.3, glob@^7.1.4: version "7.2.3" resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" @@ -2241,6 +2572,13 @@ globals@^11.1.0: resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== +globals@^13.19.0: + version "13.24.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-13.24.0.tgz#8432a19d78ce0c1e833949c36adb345400bb1171" + integrity sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ== + dependencies: + type-fest "^0.20.2" + globby@13.1.2: version "13.1.2" resolved "https://registry.yarnpkg.com/globby/-/globby-13.1.2.tgz#29047105582427ab6eca4f905200667b056da515" @@ -2252,6 +2590,18 @@ globby@13.1.2: merge2 "^1.4.1" slash "^4.0.0" +globby@^11.1.0: + version "11.1.0" + resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b" + integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g== + dependencies: + array-union "^2.1.0" + dir-glob "^3.0.1" + fast-glob "^3.2.9" + ignore "^5.2.0" + merge2 "^1.4.1" + slash "^3.0.0" + gopd@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.0.1.tgz#29ff76de69dac7489b7c0918a5788e56477c332c" @@ -2281,6 +2631,11 @@ graceful-fs@4.2.10, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.6, resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.10.tgz#147d3a006da4ca3ce14728c7aefc287c367d7a6c" integrity sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA== +graphemer@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/graphemer/-/graphemer-1.4.0.tgz#fb2f1d55e0e3a1849aeffc90c4fa0dd53a0e66c6" + integrity sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag== + hamt-sharding@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/hamt-sharding/-/hamt-sharding-2.0.1.tgz#f45686d0339e74b03b233bee1bde9587727129b6" @@ -2416,6 +2771,11 @@ ignore@^5.2.0: resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.4.tgz#a291c0c6178ff1b960befe47fcdec301674a6324" integrity sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ== +ignore@^5.2.4: + version "5.3.1" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.1.tgz#5073e554cd42c5b33b394375f538b8593e34d4ef" + integrity sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw== + import-fresh@^3.2.1: version "3.3.0" resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b" @@ -2626,7 +2986,7 @@ is-generator-fn@^2.0.0: resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-2.1.0.tgz#7d140adc389aaf3011a8f2a2a4cfa6faadffb118" integrity sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ== -is-glob@^4.0.1: +is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3: version "4.0.3" resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== @@ -2678,7 +3038,7 @@ is-obj@^2.0.0: resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-2.0.0.tgz#473fb05d973705e3fd9620545018ca8e22ef4982" integrity sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w== -is-path-inside@^3.0.2: +is-path-inside@^3.0.2, is-path-inside@^3.0.3: version "3.0.3" resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.3.tgz#d231362e53a07ff2b0e0ea7fed049161ffd16283" integrity sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ== @@ -3276,6 +3636,16 @@ json-parse-even-better-errors@^2.3.0: resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz#7c47805a94319928e05777405dc12e1f7a4ee02d" integrity sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w== +json-schema-traverse@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" + integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== + +json-stable-stringify-without-jsonify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" + integrity sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw== + json5@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.1.tgz#655d50ed1e6f95ad1a3caababd2b0efda10b395c" @@ -3305,6 +3675,13 @@ keyv@^4.5.2: dependencies: json-buffer "3.0.1" +keyv@^4.5.3: + version "4.5.4" + resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.5.4.tgz#a879a99e29452f942439f2a405e3af8b31d4de93" + integrity sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw== + dependencies: + json-buffer "3.0.1" + kleur@^3.0.3: version "3.0.3" resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" @@ -3322,6 +3699,14 @@ leven@^3.1.0: resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" integrity sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A== +levn@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/levn/-/levn-0.4.1.tgz#ae4562c007473b932a6200d403268dd2fffc6ade" + integrity sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ== + dependencies: + prelude-ls "^1.2.1" + type-check "~0.4.0" + levn@~0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" @@ -3342,11 +3727,23 @@ locate-path@^5.0.0: dependencies: p-locate "^4.1.0" +locate-path@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286" + integrity sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw== + dependencies: + p-locate "^5.0.0" + lodash.memoize@4.x: version "4.1.2" resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" integrity sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag== +lodash.merge@^4.6.2: + version "4.6.2" + resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" + integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== + lodash@4.17.21, lodash@^4.17.21: version "4.17.21" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" @@ -3477,7 +3874,14 @@ mimic-response@^4.0.0: resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-4.0.0.tgz#35468b19e7c75d10f5165ea25e75a5ceea7cf70f" integrity sha512-e5ISH9xMYU0DzrT+jl8q2ze9D6eWBto+I8CNpe+VI+K2J/F/k3PdkdTdz4wvGVH4NTpo+NRYTVIuMQEMMcsLqg== -minimatch@^3.0.4, minimatch@^3.1.1: +minimatch@9.0.3: + version "9.0.3" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.3.tgz#a6e00c3de44c3a542bfaae70abfc22420a6da825" + integrity sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg== + dependencies: + brace-expansion "^2.0.1" + +minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== @@ -3680,6 +4084,18 @@ optionator@^0.8.1: type-check "~0.3.2" word-wrap "~1.2.3" +optionator@^0.9.3: + version "0.9.3" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.3.tgz#007397d44ed1872fdc6ed31360190f81814e2c64" + integrity sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg== + dependencies: + "@aashutoshrathi/word-wrap" "^1.2.3" + deep-is "^0.1.3" + fast-levenshtein "^2.0.6" + levn "^0.4.1" + prelude-ls "^1.2.1" + type-check "^0.4.0" + ora@6.1.2, ora@^6.1.2: version "6.1.2" resolved "https://registry.yarnpkg.com/ora/-/ora-6.1.2.tgz#7b3c1356b42fd90fb1dad043d5dbe649388a0bf5" @@ -3720,7 +4136,7 @@ p-limit@^2.2.0: dependencies: p-try "^2.0.0" -p-limit@^3.1.0: +p-limit@^3.0.2, p-limit@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== @@ -3734,6 +4150,13 @@ p-locate@^4.1.0: dependencies: p-limit "^2.2.0" +p-locate@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-5.0.0.tgz#83c8315c6785005e3bd021839411c9e110e6d834" + integrity sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw== + dependencies: + p-limit "^3.0.2" + p-try@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" @@ -3898,6 +4321,11 @@ prando@^6.0.1: resolved "https://registry.yarnpkg.com/prando/-/prando-6.0.1.tgz#ffa8de84c2adc4975dd9df37ae4ada0458face53" integrity sha512-ghUWxQ1T9IJmPu6eshc3VU0OwveUtXQ33ZLXYUcz1Oc5ppKLDXKp0TBDj6b0epwhEctzcQSNGR2iHyvQSn4W5A== +prelude-ls@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" + integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== + prelude-ls@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" @@ -3980,6 +4408,11 @@ proxy-from-env@^1.0.0: resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2" integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg== +punycode@^2.1.0: + version "2.3.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5" + integrity sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg== + pupa@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/pupa/-/pupa-3.1.0.tgz#f15610274376bbcc70c9a3aa8b505ea23f41c579" @@ -4189,7 +4622,7 @@ reusify@^1.0.4: resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== -rimraf@^3.0.0: +rimraf@^3.0.0, rimraf@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== @@ -4265,6 +4698,13 @@ semver@^6.0.0, semver@^6.3.0: resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== +semver@^7.5.4: + version "7.6.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.0.tgz#1a46a4db4bffcccd97b743b5005c8325f23d4e2d" + integrity sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg== + dependencies: + lru-cache "^6.0.0" + sentence-case@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/sentence-case/-/sentence-case-3.0.4.tgz#3645a7b8c117c787fde8702056225bb62a45131f" @@ -4548,6 +4988,11 @@ test-exclude@^6.0.0: glob "^7.1.4" minimatch "^3.0.4" +text-table@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" + integrity sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw== + through@^2.3.6: version "2.3.8" resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" @@ -4602,6 +5047,11 @@ tr46@~0.0.3: resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw== +ts-api-utils@^1.0.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.2.1.tgz#f716c7e027494629485b21c0df6180f4d08f5e8b" + integrity sha512-RIYA36cJn2WiH9Hy77hdF9r7oEwxAtB/TS9/S4Qd90Ap4z5FSiin5zEiTL44OII1Y3IIlEvxwxFUVgrHSZ/UpA== + ts-jest@^29.0.3: version "29.0.3" resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-29.0.3.tgz#63ea93c5401ab73595440733cefdba31fcf9cb77" @@ -4645,6 +5095,13 @@ tweetnacl@1.0.3: resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-1.0.3.tgz#ac0af71680458d8a6378d0d0d050ab1407d35596" integrity sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw== +type-check@^0.4.0, type-check@~0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1" + integrity sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew== + dependencies: + prelude-ls "^1.2.1" + type-check@~0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" @@ -4657,6 +5114,11 @@ type-detect@4.0.8: resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== +type-fest@^0.20.2: + version "0.20.2" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4" + integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ== + type-fest@^0.21.3: version "0.21.3" resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37" @@ -4770,6 +5232,13 @@ upper-case@^2.0.2: dependencies: tslib "^2.0.3" +uri-js@^4.2.2: + version "4.4.1" + resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e" + integrity sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg== + dependencies: + punycode "^2.1.0" + url-join@5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/url-join/-/url-join-5.0.0.tgz#c2f1e5cbd95fa91082a93b58a1f42fecb4bdbcf1"