diff --git a/.eslintrc.json b/.eslintrc.json index 1bf94ac6..4e074a20 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -29,6 +29,8 @@ }, "ignorePatterns": [ "src/types/typeStrings/typeString_parser_header.ts", - "src/types/typeStrings/typeString_parser.ts" + "src/types/typeStrings/typeString_parser.ts", + "src/compile/inference/file_level_definitions_parser_header.ts", + "src/compile/inference/file_level_definitions_parser.ts" ] } diff --git a/.gitignore b/.gitignore index 2d0fdc91..943d83bd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,9 @@ .nyc_output -node_modules +.compiler_cache +/node_modules dist docs coverage *.tgz src/types/typeStrings/typeString_parser.ts +src/compile/inference/file_level_definitions_parser.ts diff --git a/.nycrc.json b/.nycrc.json index 4625137a..487288d0 100644 --- a/.nycrc.json +++ b/.nycrc.json @@ -1,6 +1,15 @@ { "extension": [".ts"], - "exclude": ["**/*.d.ts", "**/node_modules/**", "**/test/**", "**/coverage/**", "**/docs/**", "src/types/typeStrings/typeString_parser*.ts"], + "exclude": [ + "**/*.d.ts", + "**/node_modules/**", + "**/test/**", + "**/coverage/**", + "**/docs/**", + "**/.compiler_cache/**", + "src/types/typeStrings/typeString_parser*.ts", + "src/compile/inference/file_level_definitions_parser*.ts" + ], "reporter": ["html", "text-summary"], "all": true, "check-coverage": true, diff --git a/README.md b/README.md index bbdba362..69bbc09b 100644 --- a/README.md +++ b/README.md @@ -46,13 +46,13 @@ import { CompileFailedError, CompileResult, compileSol } from "solc-typed-ast"; let result: CompileResult; try { - result = compileSol("sample.sol", "auto", []); + result = await compileSol("sample.sol", "auto", []); } catch (e) { if (e instanceof CompileFailedError) { console.error("Compile errors encountered:"); for (const failure of e.failures) { - console.error(`SolcJS ${failure.compilerVersion}:`); + console.error(`Solc ${failure.compilerVersion}:`); for (const error of failure.errors) { console.error(error); @@ -68,7 +68,15 @@ console.log(result); The second argument with the `"auto"` value specifies a compiler selection strategy. If `"auto"` is specified and source code contains valid `pragma solidity` directive, then compiler version will be automatically picked from it. If compile process will not succedd, the execution will fall back to _"compiler guessing"_: trying to compile source with a few different versions of the new and old Solidity compilers. The other option would be to specify a concrete supported compiler version string, like `"0.7.0"` for example. There is also a support for various compiler selection strategies, including used-defined custom ones (`CompilerVersionSelectionStrategy` interface implementations). -**NOTE:** We want to notify that **the package preinstalls 50+ SolcJS compilers** (since 0.4.13), so be ready that it will occupy fair amount of free space. At some point we may consider to move compilers away from this package. It will mostly depend on users feedback. +**NOTE:** We want to notify that **the package preinstalls 50+ versions of Solc compilers** (since 0.4.13), so be ready that it will occupy fair amount of free space. At some point we may consider to move compilers away from this package. It will mostly depend on users feedback. + +### Native compilers + +Package supports switching between native binary Solc compilers and its WASM versions. The CLI option `--compiler-kind` and `kind` argument of `compile*()` functions family may be used for that purpose. Native binary compilers are downloaded on demand to the directory `.compiler_cache` at the package installation directory (by default). The compiler cache location may be customized by setting `SOL_AST_COMPILER_CACHE` environment variable to a custom path. For example: + +```bash +SOL_AST_COMPILER_CACHE=~/.compiler_cache solc-ast-compile sample.sol --compiler-kind native --tree +``` ### Typed universal AST @@ -130,6 +138,7 @@ Use `--help` to see all available features. The project have following directory structure: ``` +├── .compiler_cache # Cache of downloaded native compilers. ├── coverage # Test coverage report, produced by "npm test" command. ├── dist # Generated JavaScript sources for package distribution (produced by "npm run build" and published by "npm publish" commands). ├── docs # Project documentation and API reference, produced by "npm run docs:render" or "npm run docs:refresh" commands. diff --git a/package-lock.json b/package-lock.json index b1b32592..0eab1d35 100644 --- a/package-lock.json +++ b/package-lock.json @@ -416,9 +416,9 @@ "integrity": "sha512-rIY/6WPm7T8n3qS2vuHTUBPdXHl+rGxWxW5okDfo9J4Z0+gRRZT0msvUdIJkE4/HS29GUMziwGaaKO2bWONBrg==" }, "@ethersproject/networks": { - "version": "5.5.1", - "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.5.1.tgz", - "integrity": "sha512-tYRDM4zZtSUcKnD4UMuAlj7SeXH/k5WC4SP2u1Pn57++JdXHkRu2zwNkgNogZoxHzhm9Q6qqurDBVptHOsW49Q==", + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.5.2.tgz", + "integrity": "sha512-NEqPxbGBfy6O3x4ZTISb90SjEDkWYDUbEeIFhJly0F7sZjoQMnj5KYzMSkMkLKZ+1fGpx00EDpHQCy6PrDupkQ==", "requires": { "@ethersproject/logger": "^5.5.0" } @@ -683,9 +683,9 @@ } }, "@types/istanbul-lib-coverage": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.3.tgz", - "integrity": "sha512-sz7iLqvVUg1gIedBOvlkxPlc8/uVzyS5OwGz1cKjXzkl3FpL3al0crU8YGU1WoHkxn0Wxbw5tyi6hvzJKNzFsw==", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", + "integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==", "dev": true }, "@types/istanbul-lib-report": { @@ -719,15 +719,15 @@ "dev": true }, "@types/mocha": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-9.0.0.tgz", - "integrity": "sha512-scN0hAWyLVAvLR9AyW7HoFF5sJZglyBsbPuHO4fv7JRvfmPBMfp1ozWqOf/e4wwPNxezBZXRfWzMb6iFLgEVRA==", + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-9.1.0.tgz", + "integrity": "sha512-QCWHkbMv4Y5U9oW10Uxbr45qMMSzl4OzijsozynUAgx3kEHUdXB00udx2dWDQ7f2TU2a2uuiFaRZjCe3unPpeg==", "dev": true }, "@types/node": { - "version": "12.20.38", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.38.tgz", - "integrity": "sha512-NxmtBRGipjx1B225OeMdI+CQmLbYqvvmYbukDTJGDgzIDgPQ1EcjGmYxGhOk5hTBqeB558S6RgHSpq2iiqifAQ==" + "version": "12.20.42", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.42.tgz", + "integrity": "sha512-aI3/oo5DzyiI5R/xAhxxRzfZlWlsbbqdgxfTPkqu/Zt+23GXiJvMCyPJT4+xKSXOnLqoL8jJYMLTwvK2M3a5hw==" }, "@types/pbkdf2": { "version": "3.1.0", @@ -773,13 +773,14 @@ "dev": true }, "@typescript-eslint/eslint-plugin": { - "version": "5.8.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.8.0.tgz", - "integrity": "sha512-spu1UW7QuBn0nJ6+psnfCc3iVoQAifjKORgBngKOmC8U/1tbe2YJMzYQqDGYB4JCss7L8+RM2kKLb1B1Aw9BNA==", + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.10.0.tgz", + "integrity": "sha512-XXVKnMsq2fuu9K2KsIxPUGqb6xAImz8MEChClbXmE3VbveFtBUU5bzM6IPVWqzyADIgdkS2Ws/6Xo7W2TeZWjQ==", "dev": true, "requires": { - "@typescript-eslint/experimental-utils": "5.8.0", - "@typescript-eslint/scope-manager": "5.8.0", + "@typescript-eslint/scope-manager": "5.10.0", + "@typescript-eslint/type-utils": "5.10.0", + "@typescript-eslint/utils": "5.10.0", "debug": "^4.3.2", "functional-red-black-tree": "^1.0.1", "ignore": "^5.1.8", @@ -788,81 +789,81 @@ "tsutils": "^3.21.0" } }, - "@typescript-eslint/experimental-utils": { - "version": "5.8.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-5.8.0.tgz", - "integrity": "sha512-KN5FvNH71bhZ8fKtL+lhW7bjm7cxs1nt+hrDZWIqb6ViCffQcWyLunGrgvISgkRojIDcXIsH+xlFfI4RCDA0xA==", + "@typescript-eslint/parser": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.10.0.tgz", + "integrity": "sha512-pJB2CCeHWtwOAeIxv8CHVGJhI5FNyJAIpx5Pt72YkK3QfEzt6qAlXZuyaBmyfOdM62qU0rbxJzNToPTVeJGrQw==", "dev": true, "requires": { - "@types/json-schema": "^7.0.9", - "@typescript-eslint/scope-manager": "5.8.0", - "@typescript-eslint/types": "5.8.0", - "@typescript-eslint/typescript-estree": "5.8.0", - "eslint-scope": "^5.1.1", - "eslint-utils": "^3.0.0" + "@typescript-eslint/scope-manager": "5.10.0", + "@typescript-eslint/types": "5.10.0", + "@typescript-eslint/typescript-estree": "5.10.0", + "debug": "^4.3.2" } }, - "@typescript-eslint/parser": { - "version": "5.8.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.8.0.tgz", - "integrity": "sha512-Gleacp/ZhRtJRYs5/T8KQR3pAQjQI89Dn/k+OzyCKOsLiZH2/Vh60cFBTnFsHNI6WAD+lNUo/xGZ4NeA5u0Ipw==", + "@typescript-eslint/scope-manager": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.10.0.tgz", + "integrity": "sha512-tgNgUgb4MhqK6DoKn3RBhyZ9aJga7EQrw+2/OiDk5hKf3pTVZWyqBi7ukP+Z0iEEDMF5FDa64LqODzlfE4O/Dg==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "5.8.0", - "@typescript-eslint/types": "5.8.0", - "@typescript-eslint/typescript-estree": "5.8.0", - "debug": "^4.3.2" + "@typescript-eslint/types": "5.10.0", + "@typescript-eslint/visitor-keys": "5.10.0" } }, - "@typescript-eslint/scope-manager": { - "version": "5.8.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.8.0.tgz", - "integrity": "sha512-x82CYJsLOjPCDuFFEbS6e7K1QEWj7u5Wk1alw8A+gnJiYwNnDJk0ib6PCegbaPMjrfBvFKa7SxE3EOnnIQz2Gg==", + "@typescript-eslint/type-utils": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.10.0.tgz", + "integrity": "sha512-TzlyTmufJO5V886N+hTJBGIfnjQDQ32rJYxPaeiyWKdjsv2Ld5l8cbS7pxim4DeNs62fKzRSt8Q14Evs4JnZyQ==", "dev": true, "requires": { - "@typescript-eslint/types": "5.8.0", - "@typescript-eslint/visitor-keys": "5.8.0" + "@typescript-eslint/utils": "5.10.0", + "debug": "^4.3.2", + "tsutils": "^3.21.0" } }, "@typescript-eslint/types": { - "version": "5.8.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.8.0.tgz", - "integrity": "sha512-LdCYOqeqZWqCMOmwFnum6YfW9F3nKuxJiR84CdIRN5nfHJ7gyvGpXWqL/AaW0k3Po0+wm93ARAsOdzlZDPCcXg==", + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.10.0.tgz", + "integrity": "sha512-wUljCgkqHsMZbw60IbOqT/puLfyqqD5PquGiBo1u1IS3PLxdi3RDGlyf032IJyh+eQoGhz9kzhtZa+VC4eWTlQ==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "5.8.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.8.0.tgz", - "integrity": "sha512-srfeZ3URdEcUsSLbkOFqS7WoxOqn8JNil2NSLO9O+I2/Uyc85+UlfpEvQHIpj5dVts7KKOZnftoJD/Fdv0L7nQ==", + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.10.0.tgz", + "integrity": "sha512-x+7e5IqfwLwsxTdliHRtlIYkgdtYXzE0CkFeV6ytAqq431ZyxCFzNMNR5sr3WOlIG/ihVZr9K/y71VHTF/DUQA==", "dev": true, "requires": { - "@typescript-eslint/types": "5.8.0", - "@typescript-eslint/visitor-keys": "5.8.0", + "@typescript-eslint/types": "5.10.0", + "@typescript-eslint/visitor-keys": "5.10.0", "debug": "^4.3.2", "globby": "^11.0.4", "is-glob": "^4.0.3", "semver": "^7.3.5", "tsutils": "^3.21.0" - }, - "dependencies": { - "is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dev": true, - "requires": { - "is-extglob": "^2.1.1" - } - } + } + }, + "@typescript-eslint/utils": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.10.0.tgz", + "integrity": "sha512-IGYwlt1CVcFoE2ueW4/ioEwybR60RAdGeiJX/iDAw0t5w0wK3S7QncDwpmsM70nKgGTuVchEWB8lwZwHqPAWRg==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.9", + "@typescript-eslint/scope-manager": "5.10.0", + "@typescript-eslint/types": "5.10.0", + "@typescript-eslint/typescript-estree": "5.10.0", + "eslint-scope": "^5.1.1", + "eslint-utils": "^3.0.0" } }, "@typescript-eslint/visitor-keys": { - "version": "5.8.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.8.0.tgz", - "integrity": "sha512-+HDIGOEMnqbxdAHegxvnOqESUH6RWFRR2b8qxP1W9CZnnYh4Usz6MBL+2KMAgPk/P0o9c1HqnYtwzVH6GTIqug==", + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.10.0.tgz", + "integrity": "sha512-GMxj0K1uyrFLPKASLmZzCuSddmjZVbVj3Ouy5QVuIGKZopxvOr24JsS7gruz6C3GExE01mublZ3mIBOaon9zuQ==", "dev": true, "requires": { - "@typescript-eslint/types": "5.8.0", + "@typescript-eslint/types": "5.10.0", "eslint-visitor-keys": "^3.0.0" } }, @@ -873,9 +874,9 @@ "dev": true }, "acorn": { - "version": "8.6.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.6.0.tgz", - "integrity": "sha512-U1riIR+lBSNi3IbxtaHOIKdH8sLFv3NYfNv8sg7ZsNhcfl4HF2++BfqqrNAxoCLQW1iiylOj76ecnaUxz+z9yw==", + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz", + "integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==", "dev": true }, "acorn-jsx": { @@ -992,6 +993,21 @@ "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", "dev": true }, + "axios": { + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.25.0.tgz", + "integrity": "sha512-cD8FOb0tRH3uuEe6+evtAbgJtfxr7ly3fQjYcMcuPlgkwVS9xboaVIpcDV+cYQe+yGykgwZCs1pzjntcGa6l5g==", + "requires": { + "follow-redirects": "^1.14.7" + }, + "dependencies": { + "follow-redirects": { + "version": "1.14.7", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.7.tgz", + "integrity": "sha512-+hbxoLbFMbRKDwohX8GkTataGqO6Jb7jGwpAlwgy2bIz25XtRm7KEzJM76R1WiNT5SwZkX4Y75SwBolkpmE7iQ==" + } + } + }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", @@ -1117,9 +1133,9 @@ "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=" }, "chalk": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", - "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, "requires": { "ansi-styles": "^4.1.0", @@ -1434,15 +1450,6 @@ "once": "^1.4.0" } }, - "enquirer": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", - "integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==", - "dev": true, - "requires": { - "ansi-colors": "^4.1.1" - } - }, "error-ex": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", @@ -1470,9 +1477,9 @@ "dev": true }, "eslint": { - "version": "8.5.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.5.0.tgz", - "integrity": "sha512-tVGSkgNbOfiHyVte8bCM8OmX+xG9PzVG/B4UCF60zx7j61WIVY/AqJECDgpLD4DbbESD0e174gOg3ZlrX15GDg==", + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.7.0.tgz", + "integrity": "sha512-ifHYzkBGrzS2iDU7KjhCAVMGCvF6M3Xfs8X8b37cgrUlDt6bWRTpRh6T/gtSXv1HJ/BUGgmjvNvOEGu85Iif7w==", "dev": true, "requires": { "@eslint/eslintrc": "^1.0.5", @@ -1482,12 +1489,11 @@ "cross-spawn": "^7.0.2", "debug": "^4.3.2", "doctrine": "^3.0.0", - "enquirer": "^2.3.5", "escape-string-regexp": "^4.0.0", "eslint-scope": "^7.1.0", "eslint-utils": "^3.0.0", - "eslint-visitor-keys": "^3.1.0", - "espree": "^9.2.0", + "eslint-visitor-keys": "^3.2.0", + "espree": "^9.3.0", "esquery": "^1.4.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", @@ -1495,7 +1501,7 @@ "functional-red-black-tree": "^1.0.1", "glob-parent": "^6.0.1", "globals": "^13.6.0", - "ignore": "^4.0.6", + "ignore": "^5.2.0", "import-fresh": "^3.0.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", @@ -1506,9 +1512,7 @@ "minimatch": "^3.0.4", "natural-compare": "^1.4.0", "optionator": "^0.9.1", - "progress": "^2.0.0", "regexpp": "^3.2.0", - "semver": "^7.2.1", "strip-ansi": "^6.0.1", "strip-json-comments": "^3.1.0", "text-table": "^0.2.0", @@ -1567,25 +1571,8 @@ "dev": true, "requires": { "is-glob": "^4.0.3" - }, - "dependencies": { - "is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dev": true, - "requires": { - "is-extglob": "^2.1.1" - } - } } }, - "ignore": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", - "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", - "dev": true - }, "js-yaml": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", @@ -1679,18 +1666,18 @@ } }, "eslint-visitor-keys": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.1.0.tgz", - "integrity": "sha512-yWJFpu4DtjsWKkt5GeNBBuZMlNcYVs6vRCLoCVEJrTjaSB6LC98gFipNK/erM2Heg/E8mIK+hXG/pJMLK+eRZA==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.2.0.tgz", + "integrity": "sha512-IOzT0X126zn7ALX0dwFiUQEdsfzrm4+ISsQS8nukaJXwEyYKRSnEIIDULYg1mCtGp7UUXgfGl7BIolXREQK+XQ==", "dev": true }, "espree": { - "version": "9.2.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.2.0.tgz", - "integrity": "sha512-oP3utRkynpZWF/F2x/HZJ+AGtnIclaR7z1pYPxy7NYM2fSO6LgK/Rkny8anRSPK/VwEA1eqm2squui0T7ZMOBg==", + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.3.0.tgz", + "integrity": "sha512-d/5nCsb0JcqsSEeQzFZ8DH1RmxPcglRWh24EFTlUEmCKoehXGdpsx0RkHDubqUI8LSAIKMQp4r9SzQ3n+sm4HQ==", "dev": true, "requires": { - "acorn": "^8.6.0", + "acorn": "^8.7.0", "acorn-jsx": "^5.3.1", "eslint-visitor-keys": "^3.1.0" } @@ -1856,25 +1843,15 @@ } }, "expect": { - "version": "27.4.2", - "resolved": "https://registry.npmjs.org/expect/-/expect-27.4.2.tgz", - "integrity": "sha512-BjAXIDC6ZOW+WBFNg96J22D27Nq5ohn+oGcuP2rtOtcjuxNoV9McpQ60PcQWhdFOSBIQdR72e+4HdnbZTFSTyg==", + "version": "27.4.6", + "resolved": "https://registry.npmjs.org/expect/-/expect-27.4.6.tgz", + "integrity": "sha512-1M/0kAALIaj5LaG66sFJTbRsWTADnylly82cu4bspI0nl+pgP4E6Bh/aqdHlTUjul06K7xQnnrAoqfxVU0+/ag==", "dev": true, "requires": { "@jest/types": "^27.4.2", - "ansi-styles": "^5.0.0", "jest-get-type": "^27.4.0", - "jest-matcher-utils": "^27.4.2", - "jest-message-util": "^27.4.2", - "jest-regex-util": "^27.4.0" - }, - "dependencies": { - "ansi-styles": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", - "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", - "dev": true - } + "jest-matcher-utils": "^27.4.6", + "jest-message-util": "^27.4.6" } }, "fast-deep-equal": { @@ -1890,9 +1867,9 @@ "dev": true }, "fast-glob": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.7.tgz", - "integrity": "sha512-rYGMRwip6lUMvYD3BTScMwT1HtAs2d71SMv66Vrxs0IekGZEjhM0pcMfjQPnknBt2zeCwQMEupiN02ZP4DiT1Q==", + "version": "3.2.11", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", + "integrity": "sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==", "dev": true, "requires": { "@nodelib/fs.stat": "^2.0.2", @@ -2215,16 +2192,16 @@ } }, "globby": { - "version": "11.0.4", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.4.tgz", - "integrity": "sha512-9O4MVG9ioZJ08ffbcyVYyLOJLk5JQ688pJ4eMGLpdWLHq/Wr1D9BlriLQyL0E+jbkuePVZXYFj47QM/v093wHg==", + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", "dev": true, "requires": { "array-union": "^2.1.0", "dir-glob": "^3.0.1", - "fast-glob": "^3.1.1", - "ignore": "^5.1.4", - "merge2": "^1.3.0", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", "slash": "^3.0.0" } }, @@ -2427,9 +2404,9 @@ } }, "is-glob": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", - "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", "dev": true, "requires": { "is-extglob": "^2.1.1" @@ -2643,15 +2620,15 @@ } }, "jest-diff": { - "version": "27.4.2", - "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-27.4.2.tgz", - "integrity": "sha512-ujc9ToyUZDh9KcqvQDkk/gkbf6zSaeEg9AiBxtttXW59H/AcqEYp1ciXAtJp+jXWva5nAf/ePtSsgWwE5mqp4Q==", + "version": "27.4.6", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-27.4.6.tgz", + "integrity": "sha512-zjaB0sh0Lb13VyPsd92V7HkqF6yKRH9vm33rwBt7rPYrpQvS1nCvlIy2pICbKta+ZjWngYLNn4cCK4nyZkjS/w==", "dev": true, "requires": { "chalk": "^4.0.0", "diff-sequences": "^27.4.0", "jest-get-type": "^27.4.0", - "pretty-format": "^27.4.2" + "pretty-format": "^27.4.6" } }, "jest-get-type": { @@ -2661,21 +2638,21 @@ "dev": true }, "jest-matcher-utils": { - "version": "27.4.2", - "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-27.4.2.tgz", - "integrity": "sha512-jyP28er3RRtMv+fmYC/PKG8wvAmfGcSNproVTW2Y0P/OY7/hWUOmsPfxN1jOhM+0u2xU984u2yEagGivz9OBGQ==", + "version": "27.4.6", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-27.4.6.tgz", + "integrity": "sha512-XD4PKT3Wn1LQnRAq7ZsTI0VRuEc9OrCPFiO1XL7bftTGmfNF0DcEwMHRgqiu7NGf8ZoZDREpGrCniDkjt79WbA==", "dev": true, "requires": { "chalk": "^4.0.0", - "jest-diff": "^27.4.2", + "jest-diff": "^27.4.6", "jest-get-type": "^27.4.0", - "pretty-format": "^27.4.2" + "pretty-format": "^27.4.6" } }, "jest-message-util": { - "version": "27.4.2", - "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-27.4.2.tgz", - "integrity": "sha512-OMRqRNd9E0DkBLZpFtZkAGYOXl6ZpoMtQJWTAREJKDOFa0M6ptB7L67tp+cszMBkvSgKOhNtQp2Vbcz3ZZKo/w==", + "version": "27.4.6", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-27.4.6.tgz", + "integrity": "sha512-0p5szriFU0U74czRSFjH6RyS7UYIAkn/ntwMuOwTGWrQIOh5NzXXrq72LOqIkJKKvFbPq+byZKuBz78fjBERBA==", "dev": true, "requires": { "@babel/code-frame": "^7.12.13", @@ -2684,17 +2661,11 @@ "chalk": "^4.0.0", "graceful-fs": "^4.2.4", "micromatch": "^4.0.4", - "pretty-format": "^27.4.2", + "pretty-format": "^27.4.6", "slash": "^3.0.0", "stack-utils": "^2.0.3" } }, - "jest-regex-util": { - "version": "27.4.0", - "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-27.4.0.tgz", - "integrity": "sha512-WeCpMpNnqJYMQoOjm1nTtsgbR4XHAk1u00qDoNBQoykM280+/TmgA5Qh5giC1ecy6a5d4hbSsHzpBtu5yvlbEg==", - "dev": true - }, "js-sha3": { "version": "0.8.0", "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", @@ -2907,9 +2878,9 @@ } }, "marked": { - "version": "3.0.8", - "resolved": "https://registry.npmjs.org/marked/-/marked-3.0.8.tgz", - "integrity": "sha512-0gVrAjo5m0VZSJb4rpL59K1unJAMb/hm8HRXqasD8VeC8m91ytDPMritgFSlKonfdt+rRYYpP/JfLxgIX8yoSw==", + "version": "4.0.10", + "resolved": "https://registry.npmjs.org/marked/-/marked-4.0.10.tgz", + "integrity": "sha512-+QvuFj0nGgO970fySghXGmuw+Fd0gD2x3+MqCWLIPf5oxdv1Ka6b2q+z9RP01P/IaKPMEramy+7cNy/Lw8c3hw==", "dev": true }, "md5.js": { @@ -2981,9 +2952,9 @@ "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" }, "mocha": { - "version": "9.1.3", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-9.1.3.tgz", - "integrity": "sha512-Xcpl9FqXOAYqI3j79pEtHBBnQgVXIhpULjGQa7DVb0Po+VzmSIK9kanAiWLHoRR/dbZ2qpdPshuXr8l1VaHCzw==", + "version": "9.1.4", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-9.1.4.tgz", + "integrity": "sha512-+q2aV5VlJZuLgCWoBvGI5zEwPF9eEI0kr/sAA9Jm4xMND7RfIEyF8JE7C0JIg8WXRG+P1sdIAb5ccoHPlXLzcw==", "dev": true, "requires": { "@ungap/promise-all-settled": "1.1.2", @@ -3013,9 +2984,9 @@ }, "dependencies": { "ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true }, "ansi-styles": { @@ -3154,23 +3125,23 @@ "dev": true }, "string-width": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", - "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "dev": true, "requires": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.0" + "strip-ansi": "^6.0.1" } }, "strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dev": true, "requires": { - "ansi-regex": "^5.0.0" + "ansi-regex": "^5.0.1" } }, "supports-color": { @@ -3203,9 +3174,9 @@ } }, "y18n": { - "version": "5.0.5", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.5.tgz", - "integrity": "sha512-hsRUr4FFrvhhRH12wOdfs38Gy7k2FFzB9qgN9v3aLykRq0dRcdcpz5C9FxdS2NuhOrI/628b/KSTJ3rwHysYSg==", + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", "dev": true }, "yargs": { @@ -3852,12 +3823,11 @@ } }, "pretty-format": { - "version": "27.4.2", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.4.2.tgz", - "integrity": "sha512-p0wNtJ9oLuvgOQDEIZ9zQjZffK7KtyR6Si0jnXULIDwrlNF8Cuir3AZP0hHv0jmKuNN/edOnbMjnzd4uTcmWiw==", + "version": "27.4.6", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.4.6.tgz", + "integrity": "sha512-NblstegA1y/RJW2VyML+3LlpFjzx62cUrtBIKIWDXEDkjNeleA7Od7nrzcs/VLQvAeV4CgSYhrN39DRN88Qi/g==", "dev": true, "requires": { - "@jest/types": "^27.4.2", "ansi-regex": "^5.0.1", "ansi-styles": "^5.0.0", "react-is": "^17.0.1" @@ -3886,12 +3856,6 @@ "fromentries": "^1.2.0" } }, - "progress": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", - "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", - "dev": true - }, "pump": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", @@ -4076,11 +4040,11 @@ "integrity": "sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA==" }, "secp256k1": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-4.0.2.tgz", - "integrity": "sha512-UDar4sKvWAksIlfX3xIaQReADn+WFnHvbVujpcbr+9Sf/69odMwy2MUsz5CKLQgX9nsIyrjuxL2imVyoNHa3fg==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-4.0.3.tgz", + "integrity": "sha512-NLZVf+ROMxwtEj3Xa562qgv2BK5e2WNmXPiOdVIPLgs6lyTzMvBq0aWTYMI5XCP9jZMVKOcqZLw/Wc4vDkuxhA==", "requires": { - "elliptic": "^6.5.2", + "elliptic": "^6.5.4", "node-addon-api": "^2.0.0", "node-gyp-build": "^4.2.0" } @@ -4135,9 +4099,9 @@ "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=" }, "shiki": { - "version": "0.9.15", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.9.15.tgz", - "integrity": "sha512-/Y0z9IzhJ8nD9nbceORCqu6NgT9X6I8Fk8c3SICHI5NbZRLdZYFaB233gwct9sU0vvSypyaL/qaKvzyQGJBZSw==", + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.10.0.tgz", + "integrity": "sha512-iczxaIYeBFHTFrQPb9DVy2SKgYxC4Wo7Iucm7C17cCh2Ge/refnvHscUOxM85u57MfLoNOtjoEFUWt9gBexblA==", "dev": true, "requires": { "jsonc-parser": "^3.0.0", @@ -8838,16 +8802,16 @@ } }, "typedoc": { - "version": "0.22.10", - "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.22.10.tgz", - "integrity": "sha512-hQYZ4WtoMZ61wDC6w10kxA42+jclWngdmztNZsDvIz7BMJg7F2xnT+uYsUa7OluyKossdFj9E9Ye4QOZKTy8SA==", + "version": "0.22.11", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.22.11.tgz", + "integrity": "sha512-pVr3hh6dkS3lPPaZz1fNpvcrqLdtEvXmXayN55czlamSgvEjh+57GUqfhAI1Xsuu/hNHUT1KNSx8LH2wBP/7SA==", "dev": true, "requires": { "glob": "^7.2.0", "lunr": "^2.3.9", - "marked": "^3.0.8", + "marked": "^4.0.10", "minimatch": "^3.0.4", - "shiki": "^0.9.12" + "shiki": "^0.10.0" }, "dependencies": { "glob": { @@ -8867,9 +8831,9 @@ } }, "typescript": { - "version": "4.5.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.4.tgz", - "integrity": "sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg==", + "version": "4.5.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz", + "integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==", "dev": true }, "universalify": { @@ -8939,18 +8903,18 @@ "dev": true }, "web3-eth-abi": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-1.6.1.tgz", - "integrity": "sha512-svhYrAlXP9XQtV7poWKydwDJq2CaNLMtmKydNXoOBLcQec6yGMP+v20pgrxF2H6wyTK+Qy0E3/5ciPOqC/VuoQ==", + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-1.7.0.tgz", + "integrity": "sha512-heqR0bWxgCJwjWIhq2sGyNj9bwun5+Xox/LdZKe+WMyTSy0cXDXEAgv3XKNkXC4JqdDt/ZlbTEx4TWak4TRMSg==", "requires": { "@ethersproject/abi": "5.0.7", - "web3-utils": "1.6.1" + "web3-utils": "1.7.0" } }, "web3-utils": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.6.1.tgz", - "integrity": "sha512-RidGKv5kOkcerI6jQqDFDoTllQQqV+rPhTzZHhmbqtFObbYpU93uc+yG1LHivRTQhA6llIx67iudc/vzisgO+w==", + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.7.0.tgz", + "integrity": "sha512-O8Tl4Ky40Sp6pe89Olk2FsaUkgHyb5QAXuaKo38ms3CxZZ4d3rPGfjP9DNKGm5+IUgAZBNpF1VmlSmNCqfDI1w==", "requires": { "bn.js": "^4.11.9", "ethereum-bloom-filters": "^1.0.6", @@ -9070,9 +9034,9 @@ }, "dependencies": { "camelcase": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.0.tgz", - "integrity": "sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg==", + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", "dev": true }, "decamelize": { diff --git a/package.json b/package.json index 2c9aff3e..65ef7b00 100644 --- a/package.json +++ b/package.json @@ -12,10 +12,12 @@ "sol-ast-compile": "dist/bin/compile.js" }, "scripts": { - "clean": "rm -rf dist/ src/ast/typestrings/typeString_parser.ts", + "clean": "rm -rf dist/ src/ast/typestrings/typeString_parser.ts src/compile/inference/file_level_definitions_parser.ts", "transpile": "tsc", "build-type-parser": "tspegjs -o src/types/typeStrings/typeString_parser.ts --custom-header-file src/types/typeStrings/typeString_parser_header.ts --cache src/types/typeStrings/typeString_grammar.pegjs", - "build": "npm run clean && npm run build-type-parser && npm run transpile", + "build-file-level-definitions-parser": "tspegjs -o src/compile/inference/file_level_definitions_parser.ts --custom-header-file src/compile/inference/file_level_definitions_parser_header.ts --cache src/compile/inference/file_level_definitions.pegjs", + "build-parsers": "npm run build-type-parser && npm run build-file-level-definitions-parser", + "build": "npm run clean && npm run build-parsers && npm run transpile", "lint": "eslint src/ test/ --ext=ts", "lint:fix": "eslint src/ test/ --ext=ts --fix", "test": "NODE_OPTIONS='--max-old-space-size=2048' nyc mocha", @@ -26,6 +28,7 @@ "prepare": "npm run build" }, "dependencies": { + "axios": "^0.25.0", "findup-sync": "^5.0.0", "fs-extra": "^10.0.0", "jsel": "^1.1.6", @@ -85,6 +88,8 @@ "solc-0.7.6": "npm:solc@0.7.6", "solc-0.8.0": "npm:solc@0.8.0", "solc-0.8.1": "npm:solc-0.8.1-fixed@0.8.1", + "solc-0.8.10": "npm:solc@0.8.10", + "solc-0.8.11": "npm:solc@0.8.11", "solc-0.8.2": "npm:solc@0.8.2", "solc-0.8.3": "npm:solc@0.8.3", "solc-0.8.4": "npm:solc@0.8.4", @@ -93,32 +98,30 @@ "solc-0.8.7": "npm:solc@0.8.7-fixed", "solc-0.8.8": "npm:solc@0.8.8", "solc-0.8.9": "npm:solc@0.8.9", - "solc-0.8.10": "npm:solc@0.8.10", - "solc-0.8.11": "npm:solc@0.8.11", "src-location": "^1.1.0", - "web3-eth-abi": "^1.6.1" + "web3-eth-abi": "^1.7.0" }, "devDependencies": { "@types/fs-extra": "^9.0.13", "@types/minimist": "^1.2.2", - "@types/mocha": "^9.0.0", - "@types/node": "^12.20.38", + "@types/mocha": "^9.1.0", + "@types/node": "^12.20.42", "@types/semver": "^7.3.9", - "@typescript-eslint/eslint-plugin": "^5.8.0", - "@typescript-eslint/parser": "^5.8.0", + "@typescript-eslint/eslint-plugin": "^5.10.0", + "@typescript-eslint/parser": "^5.10.0", "codecov": "^3.8.3", - "eslint": "^8.5.0", + "eslint": "^8.7.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-prettier": "^4.0.0", - "expect": "^27.4.2", - "mocha": "^9.1.3", + "expect": "^27.4.6", + "mocha": "^9.1.4", "nyc": "^15.1.0", "peggy": "^1.2.0", "prettier": "2.5.1", "ts-node": "^10.4.0", "ts-pegjs": "^1.2.1", - "typedoc": "^0.22.10", - "typescript": "^4.5.4" + "typedoc": "^0.22.11", + "typescript": "^4.5.5" }, "homepage": "https://consensys.github.io/solc-typed-ast", "bugs": "https://github.com/ConsenSys/solc-typed-ast/issues", diff --git a/src/bin/compile.ts b/src/bin/compile.ts index a8a87e64..404deb8e 100644 --- a/src/bin/compile.ts +++ b/src/bin/compile.ts @@ -13,6 +13,7 @@ import { compileJson, compileJsonData, CompileResult, + CompilerKind, CompilerVersions, compileSol, compileSourceString, @@ -23,6 +24,7 @@ import { getABIEncoderVersion, isExact, LatestCompilerVersion, + PossibleCompilerKinds, PrettyFormatter, SourceUnit, StateVariableVisibility, @@ -44,31 +46,40 @@ const cli = { "source" ], number: ["depth"], - string: ["mode", "compiler-version", "path-remapping", "xpath", "compiler-settings"], + string: [ + "mode", + "compiler-version", + "path-remapping", + "xpath", + "compiler-settings", + "compiler-kind" + ], default: { depth: Number.MAX_SAFE_INTEGER, mode: modes[0], - "compiler-version": "auto" + "compiler-version": "auto", + "compiler-kind": CompilerKind.WASM } }; -const args = minimist(process.argv.slice(2), cli); +(async function () { + const args = minimist(process.argv.slice(2), cli); -if (args.version) { - const { version } = require("../../package.json"); + if (args.version) { + const { version } = require("../../package.json"); - console.log(version); -} else if (args["solidity-versions"]) { - const message = [ - "Latest supported version: " + LatestCompilerVersion, - "", - `All supported versions (${CompilerVersions.length} total):`, - ...CompilerVersions - ].join("\n"); + console.log(version); + } else if (args["solidity-versions"]) { + const message = [ + "Latest supported version: " + LatestCompilerVersion, + "", + `All supported versions (${CompilerVersions.length} total):`, + ...CompilerVersions + ].join("\n"); - console.log(message); -} else if (args.help || (!args._.length && !args.stdin)) { - const message = `Compiles Solidity input and prints typed AST. + console.log(message); + } else if (args.help || (!args._.length && !args.stdin)) { + const message = `Compiles Solidity input and prints typed AST. USAGE: @@ -89,6 +100,8 @@ OPTIONS: - ${LatestCompilerVersion} (exact SemVer version specifier) - auto (try to detect suitable compiler version) Default value: ${cli.default["compiler-version"]} + --compiler-kind What type of Solidity compiler to use. Currently supported values are 'wasm' and 'native'. + Default value: ${cli.default["compiler-kind"]} --path-remapping Path remapping input for Solc. --compiler-settings Additional settings passed to the solc compiler in the form of a JSON string (e.g. '{"optimizer": {"enabled": true, "runs": 200}}'). @@ -104,285 +117,312 @@ OPTIONS: Default value: ${cli.default.depth} `; - console.log(message); -} else { - const stdin: boolean = args.stdin; - const mode: string = args.mode; + console.log(message); + } else { + const stdin: boolean = args.stdin; + const mode: string = args.mode; + const compilerKind: CompilerKind = args["compiler-kind"]; - if (!modes.includes(mode)) { - throw new Error(`Invalid mode "${mode}". Possible values: ${modes.join(", ")}.`); - } - - const compilerVersion: string = args["compiler-version"]; + if (!PossibleCompilerKinds.has(compilerKind)) { + throw new Error( + `Invalid compiler kind "${compilerKind}". Possible values: ${[ + ...PossibleCompilerKinds.values() + ].join(", ")}.` + ); + } - if (!(compilerVersion === "auto" || isExact(compilerVersion))) { - const message = [ - `Invalid compiler version "${compilerVersion}".`, - 'Possible values: "auto" or exact version string.' - ].join(" "); + if (!modes.includes(mode)) { + throw new Error(`Invalid mode "${mode}". Possible values: ${modes.join(", ")}.`); + } - throw new Error(message); - } + const compilerVersion: string = args["compiler-version"]; - const pathRemapping: string[] = args["path-remapping"] ? args["path-remapping"].split(";") : []; - let compilerSettings: any = undefined; + if (!(compilerVersion === "auto" || isExact(compilerVersion))) { + const message = [ + `Invalid compiler version "${compilerVersion}".`, + 'Possible values: "auto" or exact version string.' + ].join(" "); - if (args["compiler-settings"]) { - try { - compilerSettings = JSON.parse(args["compiler-settings"]); - } catch (e) { - throw new Error( - `Invalid compiler settings '${args["compiler-settings"]}'. Compiler settings must be a valid JSON object.(${e})` - ); + throw new Error(message); } - } - let fileName = args._[0]; - let result: CompileResult; - const compilationOutput: CompilationOutput[] = [CompilationOutput.ALL]; + const pathRemapping: string[] = args["path-remapping"] + ? args["path-remapping"].split(";") + : []; - try { - if (stdin) { - if (mode === "auto") { + let compilerSettings: any = undefined; + + if (args["compiler-settings"]) { + try { + compilerSettings = JSON.parse(args["compiler-settings"]); + } catch (e) { throw new Error( - 'Mode "auto" is not supported for the input from STDIN. Explicitly specify "mode" as "sol" or "json" instead.' + `Invalid compiler settings '${args["compiler-settings"]}'. Compiler settings must be a valid JSON object.(${e})` ); } + } - fileName = "stdin"; - - const content = fse.readFileSync(0, { encoding: "utf-8" }); - - result = - mode === "json" - ? compileJsonData( - fileName, - JSON.parse(content), - compilerVersion, - pathRemapping, - compilationOutput, - compilerSettings - ) - : compileSourceString( - fileName, - content, - compilerVersion, - pathRemapping, - compilationOutput, - compilerSettings - ); - } else { - fileName = path.resolve(process.cwd(), args._[0]); - - if (mode === "auto") { - const iFileName = fileName.toLowerCase(); - - if (iFileName.endsWith(".sol")) { - result = compileSol( - fileName, - compilerVersion, - pathRemapping, - compilationOutput, - compilerSettings - ); - } else if (iFileName.endsWith(".json")) { - result = compileJson( - fileName, - compilerVersion, - pathRemapping, - compilationOutput, - compilerSettings + const compilationOutput: CompilationOutput[] = [CompilationOutput.ALL]; + + let fileName = args._[0]; + let result: CompileResult; + + try { + if (stdin) { + if (mode === "auto") { + throw new Error( + 'Mode "auto" is not supported for the input from STDIN. Explicitly specify "mode" as "sol" or "json" instead.' ); - } else { - throw new Error("Unable to auto-detect mode for the file name: " + fileName); } - } else { + + fileName = "stdin"; + + const content = fse.readFileSync(0, { encoding: "utf-8" }); + result = mode === "json" - ? compileJson( + ? await compileJsonData( fileName, + JSON.parse(content), compilerVersion, - pathRemapping, compilationOutput, - compilerSettings + compilerSettings, + compilerKind ) - : compileSol( + : await compileSourceString( fileName, + content, compilerVersion, pathRemapping, compilationOutput, - compilerSettings + compilerSettings, + compilerKind ); + } else { + fileName = path.resolve(process.cwd(), args._[0]); + + if (mode === "auto") { + const iFileName = fileName.toLowerCase(); + + if (iFileName.endsWith(".sol")) { + result = await compileSol( + fileName, + compilerVersion, + pathRemapping, + compilationOutput, + compilerSettings, + compilerKind + ); + } else if (iFileName.endsWith(".json")) { + result = await compileJson( + fileName, + compilerVersion, + compilationOutput, + compilerSettings, + compilerKind + ); + } else { + throw new Error( + "Unable to auto-detect mode for the file name: " + fileName + ); + } + } else { + result = + mode === "json" + ? await compileJson( + fileName, + compilerVersion, + compilationOutput, + compilerSettings + ) + : await compileSol( + fileName, + compilerVersion, + pathRemapping, + compilationOutput, + compilerSettings + ); + } } - } - } catch (e) { - if (e instanceof CompileFailedError) { - console.error("Compile errors encountered:"); - - for (const failure of e.failures) { - console.error( - failure.compilerVersion - ? `SolcJS ${failure.compilerVersion}:` - : "Unknown compiler:" - ); + } catch (e) { + if (e instanceof CompileFailedError) { + console.error("Compile errors encountered:"); + + for (const failure of e.failures) { + console.error( + failure.compilerVersion + ? `SolcJS ${failure.compilerVersion}:` + : "Unknown compiler:" + ); - for (const error of failure.errors) { - console.error(error); + for (const error of failure.errors) { + console.error(error); + } } + + process.exit(1); } - process.exit(1); + throw e; } - throw e; - } + const { data, files } = result; - const { data, files } = result; + if (args.raw) { + if (args["with-sources"] && files.size > 0) { + if (!data.sources) { + data.sources = {}; + } - if (args.raw) { - if (args["with-sources"] && files.size > 0) { - if (!data.sources) { - data.sources = {}; - } + for (const [key, value] of files) { + if (!data.sources[key]) { + data.sources[key] = {}; + } - for (const [key, value] of files) { - if (!data.sources[key]) { - data.sources[key] = {}; + data.sources[key].source = value; } - - data.sources[key].source = value; } - } - const output = JSON.stringify(data, undefined, 4); + const output = JSON.stringify(data, undefined, 4); - console.log(output); - - process.exit(0); - } + console.log(output); - const separator = "-".repeat(60); - const depth = args.depth; + process.exit(0); + } - const reader = new ASTReader(); - const units = reader.read(data, ASTKind.Any, files); + const separator = "-".repeat(60); + const depth = args.depth; - if (args.tree) { - const INDENT = "| "; + const reader = new ASTReader(); + const units = reader.read(data, ASTKind.Any, files); - const encoderVersion = result.compilerVersion - ? getABIEncoderVersion(units, result.compilerVersion as string) - : undefined; + if (args.tree) { + const INDENT = "| "; - const walker: ASTNodeCallback = (node) => { - const level = node.getParents().length; - const indent = INDENT.repeat(level); + const encoderVersion = result.compilerVersion + ? getABIEncoderVersion(units, result.compilerVersion as string) + : undefined; - let message = node.type + " #" + node.id; + const walker: ASTNodeCallback = (node) => { + const level = node.getParents().length; + const indent = INDENT.repeat(level); - if (node instanceof SourceUnit) { - message += " -> " + node.absolutePath; - } else if (node instanceof ContractDefinition) { - message += " -> " + node.kind + " " + node.name; + let message = node.type + " #" + node.id; - const interfaceId = encoderVersion ? node.interfaceId(encoderVersion) : undefined; + if (node instanceof SourceUnit) { + message += " -> " + node.absolutePath; + } else if (node instanceof ContractDefinition) { + message += " -> " + node.kind + " " + node.name; - if (interfaceId !== undefined) { - message += ` [id: ${interfaceId}]`; - } - } else if (node instanceof FunctionDefinition) { - const signature = - node.vScope instanceof ContractDefinition && - (node.visibility === FunctionVisibility.Public || - node.visibility === FunctionVisibility.External) && - encoderVersion - ? node.canonicalSignature(encoderVersion) + const interfaceId = encoderVersion + ? node.interfaceId(encoderVersion) : undefined; - if (signature && encoderVersion) { - const selector = node.canonicalSignatureHash(encoderVersion); - - message += ` -> ${signature} [selector: ${selector}]`; - } else { - message += ` -> ${node.kind}`; + if (interfaceId !== undefined) { + message += ` [id: ${interfaceId}]`; + } + } else if (node instanceof FunctionDefinition) { + const signature = + node.vScope instanceof ContractDefinition && + (node.visibility === FunctionVisibility.Public || + node.visibility === FunctionVisibility.External) && + encoderVersion + ? node.canonicalSignature(encoderVersion) + : undefined; + + if (signature && encoderVersion) { + const selector = node.canonicalSignatureHash(encoderVersion); + + message += ` -> ${signature} [selector: ${selector}]`; + } else { + message += ` -> ${node.kind}`; + } + } else if (node instanceof VariableDeclaration) { + if (node.stateVariable) { + message += ` -> ${node.typeString} ${node.visibility} ${node.name}`; + + if (node.visibility === StateVariableVisibility.Public) { + const signature = encoderVersion + ? node.getterCanonicalSignature(encoderVersion) + : undefined; + + const selector = encoderVersion + ? node.getterCanonicalSignatureHash(encoderVersion) + : undefined; + + message += ` [getter: ${signature}, selector: ${selector}]`; + } + } else { + message += + node.name === "" + ? ` -> ${node.typeString}` + : ` -> ${node.typeString} ${node.name}`; + } } - } else if (node instanceof VariableDeclaration) { - if (node.stateVariable) { - message += ` -> ${node.typeString} ${node.visibility} ${node.name}`; - if (node.visibility === StateVariableVisibility.Public && encoderVersion) { - const signature = node.getterCanonicalSignature(encoderVersion); - const selector = node.getterCanonicalSignatureHash(encoderVersion); + console.log(indent + message); + }; - message += ` [getter: ${signature}, selector: ${selector}]`; - } - } else { - message += - node.name === "" - ? ` -> ${node.typeString}` - : ` -> ${node.typeString} ${node.name}`; - } + for (const unit of units) { + unit.walk(walker); + + console.log(); } - console.log(indent + message); - }; + process.exit(0); + } - for (const unit of units) { - unit.walk(walker); + if (args.xpath) { + const selector = args.xpath; + const formatter = new ASTNodeFormatter(); + + for (const unit of units) { + const xp = new XPath(unit); + const queryResult = xp.query(selector); + const output = + queryResult instanceof Array + ? queryResult.map((value) => formatter.format(value, depth)).join("\n") + : formatter.format(queryResult, depth); + + console.log(unit.sourceEntryKey); + console.log(separator); + console.log(output); + } - console.log(); + process.exit(0); } - process.exit(0); - } - - if (args.xpath) { - const selector = args.xpath; - const formatter = new ASTNodeFormatter(); + if (args.source) { + let targetCompilerVersion: string; - for (const unit of units) { - const xp = new XPath(unit); - const queryResult = xp.query(selector); - const output = - queryResult instanceof Array - ? queryResult.map((value) => formatter.format(value, depth)).join("\n") - : formatter.format(queryResult, depth); - - console.log(unit.sourceEntryKey); - console.log(separator); - console.log(output); - } + if (result.compilerVersion) { + targetCompilerVersion = result.compilerVersion; + } else if (compilerVersion !== "auto") { + targetCompilerVersion = compilerVersion; + } else { + targetCompilerVersion = LatestCompilerVersion; + } - process.exit(0); - } + const formatter = new PrettyFormatter(4, 0); + const writer = new ASTWriter(DefaultASTWriterMapping, formatter, targetCompilerVersion); - if (args.source) { - let targetCompilerVersion: string; + for (const unit of units) { + console.log("// " + separator); + console.log("// " + unit.absolutePath); + console.log("// " + separator); + console.log(writer.write(unit)); + } - if (result.compilerVersion) { - targetCompilerVersion = result.compilerVersion; - } else if (compilerVersion !== "auto") { - targetCompilerVersion = compilerVersion; - } else { - targetCompilerVersion = LatestCompilerVersion; + process.exit(0); } - const formatter = new PrettyFormatter(4, 0); - const writer = new ASTWriter(DefaultASTWriterMapping, formatter, targetCompilerVersion); - for (const unit of units) { - console.log("// " + separator); - console.log("// " + unit.absolutePath); - console.log("// " + separator); - console.log(writer.write(unit)); + console.log(unit.print(depth)); } process.exit(0); } - - for (const unit of units) { - console.log(unit.print(depth)); - } - - process.exit(0); -} +})().catch((reason) => { + console.error(reason); + process.exit(1); +}); diff --git a/src/compile/compiler_selection.ts b/src/compile/compiler_selection.ts index 9d6e8850..d1ead226 100644 --- a/src/compile/compiler_selection.ts +++ b/src/compile/compiler_selection.ts @@ -70,18 +70,22 @@ export class LatestAndFirstVersionInEachSeriesStrategy implements CompilerVersio } export class VersionDetectionStrategy implements CompilerVersionSelectionStrategy { - source: string; + sources: string[]; fallback: CompilerVersionSelectionStrategy; descending: boolean; - constructor(source: string, fallback: CompilerVersionSelectionStrategy, descending = true) { - this.source = source; + constructor(sources: string[], fallback: CompilerVersionSelectionStrategy, descending = true) { + this.sources = sources; this.fallback = fallback; this.descending = descending; } select(): Iterable { - const specifiers = extractSpecifiersFromSource(this.source); + const specifiers: string[] = []; + + for (const source of this.sources) { + specifiers.push(...extractSpecifiersFromSource(source)); + } if (specifiers.length) { const versions = getCompilerVersionsBySpecifiers(specifiers, CompilerVersions); diff --git a/src/compile/constants.ts b/src/compile/constants.ts index ba555b4f..c909d337 100644 --- a/src/compile/constants.ts +++ b/src/compile/constants.ts @@ -87,6 +87,11 @@ export const CompilerVersions = [ export const LatestCompilerVersion = CompilerVersions[CompilerVersions.length - 1]; +export enum CompilerKind { + WASM = "wasm", + Native = "native" +} + /** * Corresponds to the string constants used in "outputSelection" as described in * https://docs.soliditylang.org/en/latest/using-the-compiler.html#input-description @@ -116,3 +121,7 @@ export enum CompilationOutput { EWASM_WASM = "ewasm.wasm", ALL = "*" } + +export const PossibleCompilerKinds = new Set(Object.values(CompilerKind)); + +export const PossibleCompilationOutputs = new Set(Object.values(CompilationOutput)); diff --git a/src/compile/import_resolver.ts b/src/compile/import_resolver.ts index 031b7f41..f40b6d9a 100644 --- a/src/compile/import_resolver.ts +++ b/src/compile/import_resolver.ts @@ -15,32 +15,6 @@ export class FileSystemResolver implements ImportResolver { export type Remapping = [string, string, string]; -export class RemappingResolver extends FileSystemResolver { - private remapping: Remapping[]; - - constructor(remapping: Remapping[]) { - super(); - - this.remapping = remapping; - } - - resolve(fileName: string): string | undefined { - const remapped = this.getRemappedPath(fileName, this.remapping); - - return remapped ? super.resolve(remapped) : undefined; - } - - private getRemappedPath(filePath: string, remapping: Remapping[]): string | undefined { - for (const [, prefix, replacement] of remapping) { - if (filePath.startsWith(prefix)) { - return filePath.replace(prefix, replacement); - } - } - - return undefined; - } -} - export class LocalNpmResolver implements ImportResolver { private baseDir: string; diff --git a/src/compile/index.ts b/src/compile/index.ts index c5958eb2..ea7b78ad 100644 --- a/src/compile/index.ts +++ b/src/compile/index.ts @@ -1,5 +1,7 @@ export * from "./compiler_selection"; export * from "./constants"; export * from "./import_resolver"; +export * from "./inference"; +export * from "./kinds"; export * from "./utils"; export * from "./version"; diff --git a/src/compile/inference/file_level_definitions.pegjs b/src/compile/inference/file_level_definitions.pegjs new file mode 100644 index 00000000..ac00d7ab --- /dev/null +++ b/src/compile/inference/file_level_definitions.pegjs @@ -0,0 +1,354 @@ +SourceUnit = + __ flds: (t: FileLevelDefinition __ { return t; })* { + // Dummy uses to silence unused function TSC errors in auto-generated code + expected; + error; + + return flds as FileLevelNode[]; + } + +FileLevelDefinition = + Pragma + / ImportDirective + / Constant + / FreeFunction + / ContractDefinition + / EnumDef + / StructDef + / UserValueTypeDef + / ErrorDef + + +// ==== Pragma + +PragmaValue = + NonSemicolonSoup { return text().trim(); } + +Pragma = + PRAGMA __ name: Identifier __ value: PragmaValue __ ";" { + return { kind: FileLevelNodeKind.Pragma, location: location(), name, value } as FLPragma; + } + +// ==== Import Directives + +Symbol = + name: (Identifier) alias: (__ AS __ Identifier)? { + return { name, alias: alias !== null ? alias[3] : null } as SymbolDesc; + } + +SymbolList = + head: Symbol + tail: ( __ COMMA __ Symbol)* { + return tail.reduce( + (acc: SymbolDesc[], el: [any, any, any, SymbolDesc]) => { + acc.push(el[3]); + + return acc; + }, + [head] + ); + } + +ImportDirective = + IMPORT __ path: StringLiteral __ SEMICOLON { + return { kind: FileLevelNodeKind.Import, location: location(), path, unitAlias: null, symbols: [] } as FLImportDirective; + } + / IMPORT __ path: StringLiteral __ AS __ unitAlias: Identifier __ SEMICOLON { + return { kind: FileLevelNodeKind.Import, location: location(), path, unitAlias, symbols: [] } as FLImportDirective; + } + / IMPORT __ ASTERISK __ AS __ unitAlias: Identifier __ FROM __ path: StringLiteral __ SEMICOLON { + return { kind: FileLevelNodeKind.Import, location: location(), path, unitAlias, symbols: [] } as FLImportDirective; + } + / IMPORT __ LBRACE __ symbols: SymbolList __ RBRACE __ FROM __ path: StringLiteral __ SEMICOLON { + return { kind: FileLevelNodeKind.Import, location: location(), symbols, path, unitAlias: null } as FLImportDirective; + } + +// ==== Global Constants + +// global constants don't support reference types I think? +ConstantType = + Identifier (__ LBRACKET Number? RBRACKET)* { return text(); } + +Constant = ConstantType __ CONSTANT __ name: Identifier __ EQUAL __ value: NonSemicolonSoup __ SEMICOLON { + return { kind: FileLevelNodeKind.Constant, location: location(), name, value } as FLConstant; +} + +// ==== Free Functions + +FreeFunArgs = LPAREN __ ParenSoup __ RPAREN { return text(); } +FreeFunMut = (!RETURNS Identifier __)* { return text(); } +FreeFunBody = LBRACE __ BraceSoup __ RBRACE { return text(); } + +FreeFunReturns = RETURNS __ FreeFunArgs { return text(); } + +FreeFunction = FUNCTION __ name: Identifier __ args: FreeFunArgs __ mutability: FreeFunMut returns: FreeFunReturns? __ body: FreeFunBody { + return { + kind: FileLevelNodeKind.Function, + location: location(), + name, + args , + mutability: mutability.trim(), + returns, + body + } as FLFreeFunction; +} + +// ==== Contract definitions + +IdentifierPath = + head: Identifier tail: ("." Identifier)* { return text(); } + +BaseArgs = LPAREN __ ParenSoup __ RPAREN + +BaseClassList = + head: IdentifierPath __ BaseArgs? tail: (__ COMMA __ IdentifierPath __ BaseArgs?)* { return text(); } + +ContractBody = LBRACE __ BraceSoup __ RBRACE { return text(); } + +ContractDefinition = abstract: (ABSTRACT __)? kind: (CONTRACT / LIBRARY / INTERFACE) __ name: Identifier bases: (__ IS __ BaseClassList)? __ body: ContractBody { + return { + abstract: abstract !== null, + kind: FileLevelNodeKind.Contract, + location: location(), + contractKind: kind, + name, + bases: bases !== null ? bases[3].trim() : null, + body + } as FLContractDefinition +} + +// ==== Struct definitions + +StructBody = LBRACE __ BraceSoup __ RBRACE { return text(); } +StructDef = STRUCT __ name: Identifier __ body: StructBody { + return { + kind: FileLevelNodeKind.Struct, + location: location(), + name, + body + } as FLStructDefinition +} + +// ==== Enum definitions + +EnumDefBody = LBRACE __ BraceSoup __ RBRACE { return text(); } +EnumDef = ENUM __ name: Identifier __ body: EnumDefBody { + return { + kind: FileLevelNodeKind.Enum, + location: location(), + name, + body + } as FLEnumDefinition +} + +// ==== User-defined value types + +UserValueTypeDef = TYPE __ name: Identifier __ IS __ valueType: NonSemicolonSoup __ SEMICOLON { + return { + kind: FileLevelNodeKind.UserValueType, + location: location(), + name, + valueType + } as FLUserValueType +} + +// ==== Error + +ErrorArgs = LPAREN __ ParenSoup __ RPAREN { return text(); } +ErrorDef = ERROR __ name: Identifier __ args: ErrorArgs __ SEMICOLON { + return { + kind: FileLevelNodeKind.Error, + location: location(), + name, + args + } as FLErrorDefinition; +} + +// ==== Soups - helper rules for matching semi-structured text with comments and strings inside, +// that still try to account for either matching () or matching {}, or for an ending semicolon. +NonSemicolonSoup = + ( + ([^"'/;]+ ("/" [^/'"*;])?) // non-comment, non-string-literal, non-semicolon anything + / StringLiteral // string literal + / Comment // comment + )* { return text(); } + +ParenSoup = + ( + ( + ([^"'()/]+ ("/" [^/*"'()])?) // non-comment, non-string literal, non-parenthesis anything + / StringLiteral // string literal + / Comment // comment + ) + / LPAREN __ ParenSoup __ RPAREN + )* + +BraceSoup = + ( + ( + ([^"'{}/]+ ("/" [^/*'"{}])?) // non-comment, non string literal, non-braces anything + / StringLiteral // string literal + / Comment // comment + ) + / LBRACE __ BraceSoup __ RBRACE + )* + +// ==== White space + +PrimitiveWhiteSpace = + "\t" + / "\v" + / "\f" + / " " + / "\u00A0" + / "\uFEFF" + / Zs + +// Separator, Space +Zs = + [\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000] + +LineTerminator = + [\n\r\u2028\u2029] + +LineTerminatorSequence = + "\n" + / "\r\n" + / "\r" + / "\u2028" + / "\u2029" + +__ = + (PrimitiveWhiteSpace / LineTerminator / Comment)* + +// ==== Comments + +NonLineTerminator = + [^\n\r\u2028\u2029] + +EndOfLineComment = + "//" "/"* NonLineTerminator* { return text() } + +// This is hacky but it works. TODO: find a simpler expression thats more obviously correct. +EnclosedComment = "/*" ([^*]+ / ("*"+ [^/*]))* "*"+ "/" { return text(); } + +Comment = EndOfLineComment / EnclosedComment + +// ==== Keywords + +IMPORT = "import" +AS = "as" +FROM = "from" +SEMICOLON = ";" +ASTERISK = "*" +LPAREN = "(" +RPAREN = ")" +LBRACE = "{" +RBRACE = "}" +LBRACKET = "[" +RBRACKET = "]" +COMMA = "," +EQUAL = "=" +ABSTRACT = "abstract" +CONTRACT = "contract" +LIBRARY = "library" +INTERFACE = "interface" +STRUCT = "struct" +ENUM = "enum" +CONSTANT = "constant" +FUNCTION = "function" +IS = "is" +TYPE = "type" +RETURNS = "returns" +PRAGMA = "pragma" +ERROR = "error" + +// ==== String literals + +StringLiteral = + "'" chars: SingleStringChar* "'" { return chars.join(""); } + / '"' chars: DoubleStringChar* '"' { return chars.join(""); } + +AnyChar = + . + +DoubleStringChar = + !('"' / "\\" / LineTerminator) AnyChar { return text(); } + / "\\" sequence: EscapeSequence { return sequence; } + / LineContinuation + +SingleStringChar = + !("'" / "\\" / LineTerminator) AnyChar { return text(); } + / "\\" sequence: EscapeSequence { return sequence; } + / LineContinuation + +LineContinuation = + "\\" LineTerminatorSequence { return ""; } + +EscapeSequence = + CharEscapeSequence + / "0" !DecDigit { return "\0"; } + / HexEscapeSequence + / UnicodeEscapeSequence + / AnyChar // Allow invalid hex sequences as a fallback + +CharEscapeSequence = + SingleEscapeChar + / NonEscapeChar + +SingleEscapeChar = + "'" + / '"' + / "\\" + / "b" { return "\b"; } + / "f" { return "\f"; } + / "n" { return "\n"; } + / "r" { return "\r"; } + / "t" { return "\t"; } + / "v" { return "\v"; } + +NonEscapeChar = + !(EscapeChar / LineTerminator) AnyChar { return text(); } + +HexDigit = + [0-9a-f]i + +DecDigit = + [0-9] + +EscapeChar = + SingleEscapeChar + / DecDigit + / "x" + / "u" + +HexEscapeSequence = + "x" digits:$(HexDigit HexDigit) { + return String.fromCharCode(parseInt(digits, 16)); + } + +UnicodeEscapeSequence = + "u" digits:$(HexDigit HexDigit HexDigit HexDigit) { + return String.fromCharCode(parseInt(digits, 16)); + } + +HexNumber = + "0x"i digits: HexDigit+ + +ExponentIndicator = + "e" / "E" + +SignedInteger = + [+-]? DecDigit+ + +ExponentPart = + ExponentIndicator SignedInteger + +DecNumber = + DecDigit+ ExponentPart? + +Number = + value: (HexNumber / DecNumber) + +Identifier = + id: ([a-zA-Z$_][a-zA-Z$0-9_]*) { return text(); } diff --git a/src/compile/inference/file_level_definitions_parser_header.ts b/src/compile/inference/file_level_definitions_parser_header.ts new file mode 100644 index 00000000..e79468b9 --- /dev/null +++ b/src/compile/inference/file_level_definitions_parser_header.ts @@ -0,0 +1,89 @@ +import { Range } from "../../misc/node"; + +export enum FileLevelNodeKind { + Pragma = "pragma", + Import = "import", + Constant = "constant", + Function = "function", + Contract = "contract", + Struct = "struct", + Enum = "enum", + UserValueType = "userValueType", + Error = "error" +} + +export interface FileLevelNode { + kind: T; + location: Range; +} + +export interface FLPragma extends FileLevelNode { + name: string; + value: string; +} + +export interface SymbolDesc { + name: string; + alias: string | null; +} + +export interface FLImportDirective extends FileLevelNode { + path: string; + symbols: SymbolDesc[]; + unitAlias: string | null; +} + +export interface FLConstant extends FileLevelNode { + name: string; + value: string; +} + +export interface FLFreeFunction extends FileLevelNode { + name: string; + args: string; + mutability: string; + returns: string | null; + body: string; +} + +export interface FLContractDefinition extends FileLevelNode { + abstract: boolean; + contractKind: "contract" | "library" | "interface"; + name: string; + bases: string | null; + body: string; +} + +export interface FLStructDefinition extends FileLevelNode { + name: string; + body: string; +} + +export interface FLEnumDefinition extends FileLevelNode { + name: string; + body: string; +} + +export interface FLUserValueType extends FileLevelNode { + name: string; + valueType: string; +} + +export type AnyFileLevelNode = FLPragma + | FLImportDirective + | FLConstant + | FLFreeFunction + | FLContractDefinition + | FLStructDefinition + | FLEnumDefinition + | FLUserValueType; + +export interface FLErrorDefinition extends FileLevelNode { + name: string; + args: string; +} + +export function parseFileLevelDefinitions(contents: string): Array { + // @ts-ignore + return parse(contents); +} diff --git a/src/compile/inference/imports.ts b/src/compile/inference/imports.ts new file mode 100644 index 00000000..e6ff4fc7 --- /dev/null +++ b/src/compile/inference/imports.ts @@ -0,0 +1,146 @@ +import fse from "fs-extra"; +import { dirname, isAbsolute, join, normalize } from "path"; +import { CompileInferenceError, ImportResolver, Remapping } from ".."; +import { + AnyFileLevelNode, + FileLevelNodeKind, + parseFileLevelDefinitions, + SyntaxError +} from "./file_level_definitions_parser"; + +/** + * Apply the first remapping in `remappings` that fits `path` and + * return the updated path. + */ +function applyRemappings(remappings: Remapping[], path: string): string { + for (const [, prefix, mapped_prefix] of remappings) { + if (path.startsWith(prefix)) { + return path.replace(prefix, mapped_prefix); + } + } + + return path; +} + +export function normalizeImportPath(path: string): string { + const normalized = normalize(path); + + return isAbsolute(normalized) ? normalized : "./" + normalized; +} + +/** + * Check that `path` starts with a relative prefix "." or "./". Note that we + * don't use `!path.isAbsolute(path)` on purpose. Otherwise it might consider + * paths like `@open-zeppelin/...` as relative. + */ +function isPathWithRelativePrefix(path: string): boolean { + return path.startsWith("./") || path.startsWith("../"); +} + +/** + * Given the `importer` unit path, and the path `imported` of an import directive + * inside the unit, compute the real path of the imported unit. + * + * This takes into account remappings, relative and absolute paths. + * Note: The returned path is not neccessarily absolute! + */ +function computeRealPath( + importer: string | undefined, + imported: string, + remappings: Remapping[] +): string { + let result = applyRemappings(remappings, imported); + + if (importer !== undefined && isPathWithRelativePrefix(result)) { + const importingFileDir = dirname(importer); + + result = normalizeImportPath(join(importingFileDir, result)); + } + + return result; +} + +/** + * Given a partial map `files` from file names to file contents, a list of + * `remappings` and a list of `ImportResolver`s `resolvers`, find and return all + * ADDITIONAL files that are imported from the starting set `files` but are + * missing in `files`. The return value is also a map from file names to file + * contents. + */ +export function findAllFiles( + files: Map, + remappings: Remapping[], + resolvers: ImportResolver[] +): Map { + const queue: Array<[string | undefined, string]> = []; + + for (const fileName of files.keys()) { + queue.push([undefined, fileName]); + } + + const visited = new Set(); + const result = new Map(); + + while (queue.length > 0) { + const [importer, imported] = queue.pop() as [string | undefined, string]; + + const realPath = computeRealPath(importer, imported, remappings); + + /** + * Skip already processed imports + */ + if (visited.has(realPath)) { + continue; + } + + let content = files.get(realPath); + + if (content === undefined) { + for (const resolver of resolvers) { + const resolvedPath = resolver.resolve(realPath); + + if (resolvedPath !== undefined) { + content = fse.readFileSync(resolvedPath, { encoding: "utf-8" }); + + break; + } + } + + if (content === undefined) { + throw new CompileInferenceError( + `Couldn't find ${realPath} imported from ${importer}` + ); + } + + result.set(isPathWithRelativePrefix(imported) ? realPath : imported, content); + } + + visited.add(realPath); + + let flds: AnyFileLevelNode[]; + + try { + flds = parseFileLevelDefinitions(content); + } catch (e: any) { + if (e instanceof SyntaxError) { + const start = e.location.start.offset; + const end = e.location.end.offset; + const length = end - start; + + throw new CompileInferenceError( + `Failed parsing imports at ${realPath}:${start}:${length} - ${e.message}` + ); + } + + throw e; + } + + for (const fld of flds) { + if (fld.kind === FileLevelNodeKind.Import) { + queue.push([realPath, fld.path]); + } + } + } + + return result; +} diff --git a/src/compile/inference/index.ts b/src/compile/inference/index.ts new file mode 100644 index 00000000..2fa73e74 --- /dev/null +++ b/src/compile/inference/index.ts @@ -0,0 +1,2 @@ +export * from "./imports"; +export { parseFileLevelDefinitions } from "./file_level_definitions_parser"; diff --git a/src/compile/input.ts b/src/compile/input.ts new file mode 100644 index 00000000..12f416a3 --- /dev/null +++ b/src/compile/input.ts @@ -0,0 +1,93 @@ +import { lt } from "semver"; +import { CompilationOutput, CompilerKind } from "./constants"; + +export interface PartialSolcInput { + language: "Solidity"; + settings: { outputSelection: any; [otherKeys: string]: any }; + [otherKeys: string]: any; +} + +export interface Solc04Input extends PartialSolcInput { + sources: { [fileName: string]: string }; +} + +export interface Solc05Input extends PartialSolcInput { + sources: { [fileName: string]: { content: string } }; +} + +export type SolcInput = Solc04Input | Solc05Input; + +function mergeCompilerSettings(input: T, settings: any): T { + if (settings !== undefined) { + for (const key in settings) { + if (key === "outputSelection") { + continue; + } + + input.settings[key] = settings[key]; + } + } + + return input; +} + +/** + * Create valid standard JSON input for the solidity compiler as specified in + * https://docs.soliditylang.org/en/latest/using-the-compiler.html. + * + * This handles the differences in the JSON input between different compiler versions. + */ +export function createCompilerInput( + files: Map, + version: string, + kind: CompilerKind, + output: CompilationOutput[], + compilerSettings: any +): SolcInput { + let fileOutput: string[] = []; + let contractOutput: string[] = []; + + for (const outputSel of output) { + if (outputSel === CompilationOutput.ALL) { + fileOutput = [CompilationOutput.ALL]; + contractOutput = [CompilationOutput.ALL]; + break; + } + + if (outputSel === CompilationOutput.AST) { + fileOutput.push(outputSel); + } else { + contractOutput.push(outputSel); + } + } + + const partialInp: PartialSolcInput = { + language: "Solidity", + settings: { + outputSelection: { + "*": { + "*": contractOutput, + "": fileOutput + } + } + } + }; + + partialInp.sources = {}; + + // Note that prior to 0.5.0 the WASM compiler had a slightly + // different format for specifying versions. + if (lt(version, "0.5.0") && kind === CompilerKind.WASM) { + for (const [fileName, content] of files.entries()) { + partialInp.sources[fileName] = content; + } + } else { + for (const [fileName, content] of files.entries()) { + partialInp.sources[fileName] = { content }; + } + } + + const input = partialInp as Solc04Input | Solc05Input; + + return mergeCompilerSettings(input, compilerSettings); +} diff --git a/src/compile/kinds/compiler.ts b/src/compile/kinds/compiler.ts new file mode 100644 index 00000000..6d3f2877 --- /dev/null +++ b/src/compile/kinds/compiler.ts @@ -0,0 +1,14 @@ +import { assert } from "../../misc"; +import { SolcInput } from "../input"; +import { isExact } from "../version"; + +export abstract class Compiler { + constructor(public readonly version: string) { + assert( + isExact(version), + "Version string must contain exact SemVer-formatted version without any operators" + ); + } + + abstract compile(inputJson: SolcInput): Promise; +} diff --git a/src/compile/kinds/index.ts b/src/compile/kinds/index.ts new file mode 100644 index 00000000..3e1464bd --- /dev/null +++ b/src/compile/kinds/index.ts @@ -0,0 +1,4 @@ +export * from "./compiler"; +export * from "./native"; +export * from "./wasm"; +export * from "./md"; diff --git a/src/compile/kinds/md.ts b/src/compile/kinds/md.ts new file mode 100644 index 00000000..c0b3a8ad --- /dev/null +++ b/src/compile/kinds/md.ts @@ -0,0 +1,83 @@ +import axios from "axios"; +import { assert } from "console"; +import fse from "fs-extra"; +import os from "os"; +import path, { isAbsolute, relative } from "path"; + +export function getCompilerPrefixForOs(): string | undefined { + const arch = os.arch(); + + /** + * Only 64 bit native compilers built + */ + if (arch !== "x64") { + return undefined; + } + + const type = os.type(); + + if (type === "Linux") { + return "linux-amd64"; + } + + if (type === "Windows_NT") { + return "windows-amd64"; + } + + if (type === "Darwin") { + return "macosx-amd64"; + } + + return undefined; +} + +export interface CompilerPlatformMetadata { + builds: VersionListEntry[]; + releases: { [version: string]: string }; +} + +export interface VersionListEntry { + path: string; + version: string; + longVersion: string; + keccak256: string; + sha256: string; + urls: string[]; +} + +const cacheDirDefault = path.join(__dirname, "..", "..", "..", ".compiler_cache"); +const cacheDirCustom = process.env["SOL_AST_COMPILER_CACHE"]; + +export const CACHE_DIR = cacheDirCustom === undefined ? cacheDirDefault : cacheDirCustom; +export const BINARIES_URL = "https://binaries.soliditylang.org"; + +/** + * Return true IFF child is a subdirectory of parent. + */ +export function isSubDir(child: string, parent: string): boolean { + const relPath = relative(parent, child); + return !isAbsolute(relPath) && !relPath.startsWith(".."); +} + +export async function getCompilerMDForPlatform(prefix: string): Promise { + const cachedListPath = path.join(CACHE_DIR, prefix, "list.json"); + assert( + isSubDir(cachedListPath, CACHE_DIR), + `Path ${cachedListPath} escapes from cache dir ${CACHE_DIR}` + ); + + if (fse.existsSync(cachedListPath)) { + return fse.readJSONSync(cachedListPath) as CompilerPlatformMetadata; + } + + const response = await axios.get( + `${BINARIES_URL}/${prefix}/list.json` + ); + + const metaData = response.data; + + fse.ensureDirSync(path.join(CACHE_DIR, prefix)); + fse.writeJSONSync(cachedListPath, metaData); + + return metaData; +} diff --git a/src/compile/kinds/native.ts b/src/compile/kinds/native.ts new file mode 100644 index 00000000..a8e28e26 --- /dev/null +++ b/src/compile/kinds/native.ts @@ -0,0 +1,103 @@ +import { spawn } from "child_process"; +import axios from "axios"; +import * as stream from "stream"; +import { promisify } from "util"; +import { SolcInput } from "../input"; +import { Compiler } from "./compiler"; +import { + BINARIES_URL, + CACHE_DIR, + getCompilerMDForPlatform, + getCompilerPrefixForOs, + isSubDir +} from "./md"; +import fse from "fs-extra"; +import path from "path"; +import { assert } from "../../misc/utils"; + +class NativeCompiler extends Compiler { + constructor(public readonly version: string, public readonly path: string) { + super(version); + } + + async compile(inputJson: SolcInput): Promise { + const child = spawn(this.path, ["--standard-json"], {}); + + return new Promise((resolve, reject) => { + child.stdin.write(JSON.stringify(inputJson), "utf-8"); + child.stdin.end(); + + let stdout = ""; + let stderr = ""; + + child.stdout.on("data", (data) => { + stdout += data; + }); + + child.stderr.on("data", (data) => { + stderr += data; + }); + + child.on("close", (code) => { + if (code !== 0) { + reject(`Compiler exited with code ${code}, stderr: ${stderr}`); + return; + } + + if (stderr !== "") { + reject(`Compiler exited with non-empty stderr: ${stderr}`); + return; + } + + let outJson: any; + + try { + outJson = JSON.parse(stdout); + } catch (e) { + reject(e); + return; + } + + resolve(outJson); + }); + }); + } +} + +export async function getNativeCompilerForVersion( + version: string +): Promise { + const prefix = getCompilerPrefixForOs(); + + if (prefix === undefined) { + return undefined; + } + + const md = await getCompilerMDForPlatform(prefix); + const compilerFileName = md.releases[version]; + + if (compilerFileName === undefined) { + return undefined; + } + + const compilerLocalPath = path.join(CACHE_DIR, prefix, compilerFileName); + assert( + isSubDir(compilerLocalPath, CACHE_DIR), + `Path ${compilerLocalPath} escapes from cache dir ${CACHE_DIR}` + ); + + if (!fse.existsSync(compilerLocalPath)) { + const response = await axios({ + method: "GET", + url: `${BINARIES_URL}/${prefix}/${compilerFileName}`, + responseType: "stream" + }); + + const target = fse.createWriteStream(compilerLocalPath, { mode: 0o555 }); + const pipeline = promisify(stream.pipeline); + + await pipeline(response.data, target); + } + + return new NativeCompiler(version, compilerLocalPath); +} diff --git a/src/compile/kinds/wasm.ts b/src/compile/kinds/wasm.ts new file mode 100644 index 00000000..f178682b --- /dev/null +++ b/src/compile/kinds/wasm.ts @@ -0,0 +1,83 @@ +import { gte, satisfies } from "semver"; +import { isExact } from ".."; +import { assert } from "../../misc"; +import { SolcInput } from "../input"; +import { Compiler } from "./compiler"; + +/** + * Imports are handled by the preprecessing parser, + * so there is no need to use finder callbacks. + */ +const nullFinder = (): { error: string } => { + return { error: "Finders not supported" }; +}; + +export abstract class WasmCompiler extends Compiler { + get moduleName(): string { + return `solc-${this.version}`; + } + + get module(): any { + return require(this.moduleName); + } +} + +export class WasmCompiler04 extends WasmCompiler { + constructor(version: string) { + super(version); + + assert(satisfies(version, "0.4"), `Can't build WasmCompiler04 with version ${version}`); + } + + async compile(inputJson: SolcInput): Promise { + return this.module.compile(inputJson, 1, nullFinder); + } +} + +export class WasmCompiler05 extends WasmCompiler { + constructor(version: string) { + super(version); + + assert(satisfies(version, "0.5"), `Can't build WasmCompiler04 with version ${version}`); + } + + async compile(inputJson: SolcInput): Promise { + const output = this.module.compile(JSON.stringify(inputJson), nullFinder); + + return JSON.parse(output); + } +} + +export class WasmCompiler06OrNewer extends WasmCompiler { + constructor(version: string) { + super(version); + + assert(gte(version, "0.6.0"), `Can't build WasmCompiler04 with version ${version}`); + } + + async compile(inputJson: SolcInput): Promise { + const callbacks = { import: nullFinder }; + + const output = this.module.compile(JSON.stringify(inputJson), callbacks); + + return JSON.parse(output); + } +} + +export function getWasmCompilerForVersion(version: string): WasmCompiler { + if (!isExact(version)) { + throw new Error( + "Wasm compiler version string must contain exact SemVer-formatted version without any operators" + ); + } + + if (satisfies(version, "0.4")) { + return new WasmCompiler04(version); + } + + if (satisfies(version, "0.5")) { + return new WasmCompiler05(version); + } + + return new WasmCompiler06OrNewer(version); +} diff --git a/src/compile/utils.ts b/src/compile/utils.ts index 09167f8a..291e4011 100644 --- a/src/compile/utils.ts +++ b/src/compile/utils.ts @@ -1,21 +1,18 @@ import fse from "fs-extra"; import path from "path"; -import { lt, satisfies } from "semver"; +import { FileSystemResolver, ImportResolver, LocalNpmResolver } from "."; import { CompilerVersionSelectionStrategy, LatestVersionInEachSeriesStrategy, RangeVersionStrategy, VersionDetectionStrategy } from "./compiler_selection"; -import { CompilationOutput } from "./constants"; -import { - FileSystemResolver, - ImportResolver, - LocalNpmResolver, - Remapping, - RemappingResolver -} from "./import_resolver"; -import { isExact } from "./version"; +import { CompilationOutput, CompilerKind } from "./constants"; +import { Remapping } from "./import_resolver"; +import { findAllFiles, normalizeImportPath } from "./inference"; +import { createCompilerInput } from "./input"; +import { getNativeCompilerForVersion, getWasmCompilerForVersion } from "./kinds"; +import { getCompilerPrefixForOs } from "./kinds/md"; export interface MemoryStorage { [path: string]: { @@ -34,6 +31,8 @@ export interface CompileFailure { compilerVersion?: string; } +export class CompileInferenceError extends Error {} + export class CompileFailedError extends Error { failures: CompileFailure[]; @@ -41,115 +40,56 @@ export class CompileFailedError extends Error { super(); this.failures = entries; - } -} -export type ImportFinder = (filePath: string) => { contents: string } | { error: string }; + const formattedErrorStr = entries.map( + (entry) => `==== ${entry.compilerVersion} ===:\n ${entry.errors.join("\n")}\n` + ); -export function getCompilerForVersion(version: string): any { - if (isExact(version)) { - return require("solc-" + version); + this.message = `Compiler Errors: ${formattedErrorStr}`; } - - throw new Error( - "Version string must contain exact SemVer-formatted version without any operators" - ); } -interface PartialSolcInput { - language: "Solidity"; - settings: { remappings: string[]; outputSelection: any; [otherKeys: string]: any }; - [otherKeys: string]: any; -} - -interface Solc04Input extends PartialSolcInput { - sources: { [fileName: string]: string }; -} - -interface Solc05Input extends PartialSolcInput { - sources: { [fileName: string]: { content: string } }; -} - -function mergeCompilerSettings(input: T, settings: any): T { - if (settings !== undefined) { - for (const key in settings) { - if (key === "remappings" || key === "outputSelection") { - continue; - } +function consistentlyContainsOneOf( + sources: { [key: string]: any }, + ...properties: string[] +): boolean { + const sections = Object.values(sources); - input.settings[key] = settings[key]; + for (const property of properties) { + if (sections.every((section) => property in section)) { + return true; } } - return input; + return false; } -function createCompilerInput( - fileName: string, - version: string, - content: string, - output: CompilationOutput[], - remappings: string[], - compilerSettings: any -): Solc04Input | Solc05Input { - let fileOutput: string[] = []; - let contractOutput: string[] = []; - - for (const outputSel of output) { - if (outputSel === CompilationOutput.ALL) { - fileOutput = [CompilationOutput.ALL]; - contractOutput = [CompilationOutput.ALL]; - break; - } - - if (outputSel === CompilationOutput.AST) { - fileOutput.push(outputSel); - } else { - contractOutput.push(outputSel); - } - } +export function parsePathRemapping(remapping: string[]): Remapping[] { + const rxRemapping = /^(([^:]*):)?([^=]*)=(.+)$/; + const result: Array<[string, string, string]> = remapping.map((entry) => { + const matches = entry.match(rxRemapping); - const partialInp: PartialSolcInput = { - language: "Solidity", - settings: { - remappings, - outputSelection: { - "*": { - "*": contractOutput, - "": fileOutput - } - } + if (matches === null) { + throw new Error(`Invalid remapping entry "${entry}"`); } - }; - - if (lt(version, "0.5.0")) { - partialInp.sources = { - [fileName]: content - }; - } else { - partialInp.sources = { - [fileName]: { content } - }; - } - const inp = partialInp as Solc04Input | Solc05Input; + return [matches[2] === undefined ? "" : matches[2], matches[3], matches[4]]; + }); - return mergeCompilerSettings(inp, compilerSettings); + return result; } -function consistentlyContainsOneOf( - sources: { [key: string]: any }, - ...properties: string[] -): boolean { - const sections = Object.values(sources); +export function resolveFiles( + files: Map, + remapping: string[], + resolvers: ImportResolver[] +): void { + const parsedRemapping = parsePathRemapping(remapping); + const additionalFiles = findAllFiles(files, parsedRemapping, resolvers); - for (const property of properties) { - if (sections.every((section) => property in section)) { - return true; - } + for (const [fileName, source] of additionalFiles) { + files.set(fileName, source); } - - return false; } function fillFilesFromSources( @@ -163,34 +103,12 @@ function fillFilesFromSources( } } -function detectMainFileName(data: any): string | undefined { - if (data.sources) { - const sources = data.sources; - - if (data.mainSource && data.mainSource in sources) { - return data.mainSource; - } - - const main = Object.values(sources).find((section: any) => section.main); - - if (main) { - for (const key in sources) { - if (sources[key] === main) { - return key; - } - } - } - } - - return undefined; -} - function getCompilerVersionStrategy( - sourceCode: string, + sources: string[], versionOrStrategy: string | CompilerVersionSelectionStrategy ): CompilerVersionSelectionStrategy { if (versionOrStrategy === "auto") { - return new VersionDetectionStrategy(sourceCode, new LatestVersionInEachSeriesStrategy()); + return new VersionDetectionStrategy(sources, new LatestVersionInEachSeriesStrategy()); } if (typeof versionOrStrategy === "string") { @@ -200,116 +118,40 @@ function getCompilerVersionStrategy( return versionOrStrategy; } -export function parsePathRemapping(remapping: string[]): Remapping[] { - const rxRemapping = /^(([^:]*):)?([^=]*)=(.+)$/; - const result: Array<[string, string, string]> = remapping.map((entry) => { - const matches = entry.match(rxRemapping); - - if (matches === null) { - throw new Error(`Invalid remapping entry "${entry}"`); - } - - return [matches[2] === undefined ? "" : matches[2], matches[3], matches[4]]; - }); - - return result; -} - -export function createFileSystemImportFinder( - fileName: string, +export async function compile( files: Map, - remapping: Remapping[] -): ImportFinder { - const basePath = path.dirname(fileName); - const resolvers: ImportResolver[] = [ - new FileSystemResolver(), - new RemappingResolver(remapping), - new LocalNpmResolver(basePath) - ]; - - return (filePath) => { - try { - for (const resolver of resolvers) { - const resolvedPath = resolver.resolve(filePath); - - if (resolvedPath) { - const contents = fse.readFileSync(resolvedPath).toString(); - - files.set(filePath, contents); - - return { contents }; - } - } - - throw new Error(`Unable to find import path "${filePath}"`); - } catch (e: any) { - return { error: e.message }; - } - }; -} - -export function createMemoryImportFinder( - storage: MemoryStorage, - files: Map -): ImportFinder { - if (storage === null || storage === undefined) { - throw new Error("Storage must be an object"); - } - - return (filePath) => { - const entry = storage[filePath]; - - if (!entry) { - return { error: `Import path "${filePath}" not found in storage` }; - } - - if (entry.source === undefined) { - return { error: `Entry at "${filePath}" contains no "source" property` }; - } - - const contents = entry.source; - - files.set(filePath, contents); - - return { contents }; - }; -} - -export function compile( - fileName: string, - content: string, version: string, - finder: ImportFinder, - remapping: string[], compilationOutput: CompilationOutput[] = [CompilationOutput.ALL], - compilerSettings?: any -): any { - const compiler = getCompilerForVersion(version); - const input = createCompilerInput( - fileName, + compilerSettings?: any, + kind = CompilerKind.WASM +): Promise { + const compilerInput = createCompilerInput( + files, version, - content, + kind, compilationOutput, - remapping, compilerSettings ); - if (satisfies(version, "0.4")) { - const output = compiler.compile(input, 1, finder); + if (kind === CompilerKind.WASM) { + const compiler = getWasmCompilerForVersion(version); - return output; + return compiler.compile(compilerInput); } - if (satisfies(version, "0.5")) { - const output = compiler.compile(JSON.stringify(input), finder); + if (kind === CompilerKind.Native) { + const compiler = await getNativeCompilerForVersion(version); - return JSON.parse(output); - } + if (compiler === undefined) { + throw new Error( + `Couldn't find native compiler for version ${version} for current platform ${getCompilerPrefixForOs()}` + ); + } - const callbacks = { import: finder }; - const output = compiler.compile(JSON.stringify(input), callbacks); + return compiler.compile(compilerInput); + } - return JSON.parse(output); + throw new Error(`Unsupported compiler kind "${kind}"`); } export function detectCompileErrors(data: any): string[] { @@ -340,34 +182,35 @@ export function detectCompileErrors(data: any): string[] { return errors; } -export function compileSourceString( +export async function compileSourceString( fileName: string, sourceCode: string, version: string | CompilerVersionSelectionStrategy, remapping: string[], compilationOutput: CompilationOutput[] = [CompilationOutput.ALL], - compilerSettings?: any -): CompileResult { - const compilerVersionStrategy = getCompilerVersionStrategy(sourceCode, version); - const files = new Map([[fileName, sourceCode]]); + compilerSettings?: any, + kind?: CompilerKind +): Promise { + const entryFileName = normalizeImportPath(fileName); + const entryFileDir = path.dirname(entryFileName); + + const files = new Map([[entryFileName, sourceCode]]); + const resolvers = [new FileSystemResolver(), new LocalNpmResolver(entryFileDir)]; + + resolveFiles(files, remapping, resolvers); + + const compilerVersionStrategy = getCompilerVersionStrategy([...files.values()], version); const failures: CompileFailure[] = []; for (const compilerVersion of compilerVersionStrategy.select()) { - const finder = createFileSystemImportFinder( - fileName, + const data = await compile( files, - satisfies(compilerVersion, "0.4") ? parsePathRemapping(remapping) : [] - ); - - const data = compile( - fileName, - sourceCode, compilerVersion, - finder, - remapping, compilationOutput, - compilerSettings + compilerSettings, + kind ); + const errors = detectCompileErrors(data); if (errors.length === 0) { @@ -380,33 +223,35 @@ export function compileSourceString( throw new CompileFailedError(failures); } -export function compileSol( +export async function compileSol( fileName: string, version: string | CompilerVersionSelectionStrategy, remapping: string[], compilationOutput: CompilationOutput[] = [CompilationOutput.ALL], - compilerSettings?: any -): CompileResult { - const source = fse.readFileSync(fileName, { encoding: "utf-8" }); + compilerSettings?: any, + kind?: CompilerKind +): Promise { + const sourceCode = fse.readFileSync(fileName, { encoding: "utf-8" }); return compileSourceString( fileName, - source, + sourceCode, version, remapping, compilationOutput, - compilerSettings + compilerSettings, + kind ); } -export function compileJsonData( +export async function compileJsonData( fileName: string, data: any, version: string | CompilerVersionSelectionStrategy, - remapping: string[], compilationOutput: CompilationOutput[] = [CompilationOutput.ALL], - compilerSettings?: any -): CompileResult { + compilerSettings?: any, + kind?: CompilerKind +): Promise { const files = new Map(); if (!(data instanceof Object && data.sources instanceof Object)) { @@ -429,31 +274,20 @@ export function compileJsonData( } if (consistentlyContainsOneOf(sources, "source")) { - const mainFileName = detectMainFileName(data); - const sourceCode: string | undefined = mainFileName - ? sources[mainFileName].source - : undefined; - - if (!(mainFileName && sourceCode)) { - throw new Error("Unable to detect main source to compile"); + for (const [fileName, fileData] of Object.entries<{ source: string }>(sources)) { + files.set(fileName, fileData.source); } - const compilerVersionStrategy = getCompilerVersionStrategy(sourceCode, version); - - files.set(mainFileName, sourceCode); - - const finder = createMemoryImportFinder(sources, files); + const compilerVersionStrategy = getCompilerVersionStrategy([...files.values()], version); const failures: CompileFailure[] = []; for (const compilerVersion of compilerVersionStrategy.select()) { - const compileData = compile( - mainFileName, - sourceCode, + const compileData = await compile( + files, compilerVersion, - finder, - remapping, compilationOutput, - compilerSettings + compilerSettings, + kind ); const errors = detectCompileErrors(compileData); @@ -473,14 +307,14 @@ export function compileJsonData( ); } -export function compileJson( +export async function compileJson( fileName: string, version: string | CompilerVersionSelectionStrategy, - remapping: string[], compilationOutput: CompilationOutput[] = [CompilationOutput.ALL], - compilerSettings?: any -): CompileResult { + compilerSettings?: any, + kind?: CompilerKind +): Promise { const data = fse.readJSONSync(fileName); - return compileJsonData(fileName, data, version, remapping, compilationOutput, compilerSettings); + return compileJsonData(fileName, data, version, compilationOutput, compilerSettings, kind); } diff --git a/src/types/abi.ts b/src/types/abi.ts index 6f0577aa..91a20369 100644 --- a/src/types/abi.ts +++ b/src/types/abi.ts @@ -1,11 +1,4 @@ -import { - AddressType, - enumToIntType, - PointerType, - typeNameToTypeNode, - TypeNode, - UserDefinedType -} from "."; +import { AddressType, enumToIntType, PointerType, TypeNode, UserDefinedType } from "."; import { ContractDefinition, DataLocation, @@ -24,7 +17,11 @@ import { StringType, TupleType } from "./ast"; -import { getUserDefinedTypeFQName, variableDeclarationToTypeNode } from "./utils"; +import { + getUserDefinedTypeFQName, + typeNameToTypeNode, + variableDeclarationToTypeNode +} from "./utils"; export enum ABIEncoderVersion { V1 = "ABIEncoderV1", @@ -48,7 +45,7 @@ export function toABIEncodedType( normalizePointers = false ): TypeNode { if (type instanceof MappingType) { - throw new Error("Cannnot abi-encode mapping types"); + throw new Error("Cannot abi-encode mapping types"); } if (type instanceof ArrayType) { @@ -80,7 +77,7 @@ export function toABIEncodedType( if (type.definition instanceof StructDefinition) { assert( encoderVersion !== ABIEncoderVersion.V1, - "Getters of struct return type are not supported by ABI encoder v1." + "Getters of struct return type are not supported by ABI encoder v1" ); const fieldTs = type.definition.vMembers.map((fieldT) => @@ -129,7 +126,7 @@ export function abiTypeToCanonicalName(t: TypeNode): string { return abiTypeToCanonicalName(t.to); } - assert(false, "Unexpected ABI Type {0}", t); + assert(false, "Unexpected ABI Type: {0}", t); } /** @@ -150,7 +147,7 @@ export function abiTypeToLibraryCanonicalName(t: TypeNode): string { // Payable is ignored in canonical names if (t instanceof AddressType) { - return `address`; + return "address"; } if (t instanceof ArrayType) { @@ -167,6 +164,7 @@ export function abiTypeToLibraryCanonicalName(t: TypeNode): string { // Go figure... if (t instanceof PointerType) { const toName = abiTypeToLibraryCanonicalName(t.to); + return t.location === DataLocation.Storage ? `${toName} storage` : toName; } @@ -181,5 +179,5 @@ export function abiTypeToLibraryCanonicalName(t: TypeNode): string { return `mapping(${keyName} => ${valueName})`; } - assert(false, `Unexpected ABI Type ${t.pp()}`); + assert(false, "Unexpected ABI Type: {0}", t); } diff --git a/src/types/typeStrings/typeString_grammar.pegjs b/src/types/typeStrings/typeString_grammar.pegjs index ecb1f439..7b9958c8 100644 --- a/src/types/typeStrings/typeString_grammar.pegjs +++ b/src/types/typeStrings/typeString_grammar.pegjs @@ -195,10 +195,10 @@ UnicodeEscapeSequence = } Identifier = - !(Keyword [^a-zA-Z0-9_]) id: ([a-zA-Z_][a-zA-Z$0-9_]*) { return text(); } + !(Keyword [^a-zA-Z0-9_]) id: ([a-zA-Z_$][a-zA-Z$0-9_]*) { return text(); } Word = - id: ([a-zA-Z_][a-zA-Z0-9$_]*) { return text(); } + id: ([a-zA-Z_$][a-zA-Z$0-9_]*) { return text(); } Number = [0-9]+ { return BigInt(text()); } diff --git a/test/integration/compile/04.spec.ts b/test/integration/compile/04.spec.ts index 86f1ec89..a076c97d 100644 --- a/test/integration/compile/04.spec.ts +++ b/test/integration/compile/04.spec.ts @@ -2,9 +2,11 @@ import expect from "expect"; import fse from "fs-extra"; import { ASTReader, + CompilerKind, CompilerVersions04, compileSol, detectCompileErrors, + PossibleCompilerKinds, SourceUnit } from "../../../src"; import { createImprint } from "./common"; @@ -50,57 +52,66 @@ const encounters = new Map([ describe(`Compile ${sample} with any available 0.4.x compiler`, () => { for (const version of CompilerVersions04) { - describe(`Solc ${version}`, () => { - let data: any = {}; - let sourceUnits: SourceUnit[]; + for (const kind of PossibleCompilerKinds) { + describe(`[${kind}] ${version}`, () => { + let data: any = {}; + let sourceUnits: SourceUnit[]; + + before("Compile", async () => { + const result = await compileSol( + sample, + version, + [], + undefined, + undefined, + kind as CompilerKind + ); - before("Compile", () => { - const result = compileSol(sample, version, []); + expect(result.compilerVersion).toEqual(version); + expect(result.files).toEqual(expectedFiles); - expect(result.compilerVersion).toEqual(version); - expect(result.files).toEqual(expectedFiles); + const errors = detectCompileErrors(result.data); - const errors = detectCompileErrors(result.data); + expect(errors).toHaveLength(0); - expect(errors).toHaveLength(0); + data = result.data; + }); - data = result.data; - }); + it("Process compiler output", () => { + const reader = new ASTReader(); - it("Process compiler output", () => { - const reader = new ASTReader(); + sourceUnits = reader.read(data); - sourceUnits = reader.read(data); + expect(sourceUnits.length).toEqual(1); - expect(sourceUnits.length).toEqual(1); + const sourceUnit = sourceUnits[0]; - const sourceUnit = sourceUnits[0]; + expect(sourceUnit.id).toEqual(212); + expect(sourceUnit.src).toEqual("0:1580:0"); + expect(sourceUnit.absolutePath).toEqual(sample); + expect(sourceUnit.children.length).toEqual(2); + expect(sourceUnit.getChildren().length).toEqual(211); + }); - expect(sourceUnit.id).toEqual(212); - expect(sourceUnit.src).toEqual("0:1580:0"); - expect(sourceUnit.absolutePath).toEqual(sample); - expect(sourceUnit.children.length).toEqual(2); - expect(sourceUnit.getChildren().length).toEqual(211); - }); + it("Validate processed output", () => { + const sourceUnit = sourceUnits[0]; + const sourceUnitImprint = createImprint(sourceUnit); - it("Validate processed output", () => { - const sourceUnit = sourceUnits[0]; - const sourceUnitImprint = createImprint(sourceUnit); + expect(sourceUnitImprint.ASTNode).toBeUndefined(); - expect(sourceUnitImprint.ASTNode).toBeUndefined(); + for (const [type, count] of encounters.entries()) { + expect(sourceUnitImprint[type]).toBeDefined(); + expect(sourceUnitImprint[type].length).toEqual(count); - for (const [type, count] of encounters.entries()) { - expect(sourceUnitImprint[type]).toBeDefined(); - expect(sourceUnitImprint[type].length).toEqual(count); - - const nodes = sourceUnit.getChildrenBySelector( - (node) => node.type === type, - type === "SourceUnit" - ); + const nodes = sourceUnit.getChildrenBySelector( + (node) => node.type === type, + type === "SourceUnit" + ); - expect(nodes.length).toEqual(count); - } + expect(nodes.length).toEqual(count); + } + }); }); - }); + } } }); diff --git a/test/integration/compile/05.spec.ts b/test/integration/compile/05.spec.ts index ecc0f5c5..1e7a16ef 100644 --- a/test/integration/compile/05.spec.ts +++ b/test/integration/compile/05.spec.ts @@ -3,9 +3,11 @@ import fse from "fs-extra"; import { ASTKind, ASTReader, + CompilerKind, CompilerVersions05, compileSol, detectCompileErrors, + PossibleCompilerKinds, SourceUnit } from "../../../src"; import { createImprint } from "./common"; @@ -50,59 +52,68 @@ const encounters = new Map([ describe(`Compile ${sample} with any available 0.5.x compiler`, () => { for (const version of CompilerVersions05) { - describe(`Solc ${version}`, () => { - let data: any = {}; - let sourceUnits: SourceUnit[]; + for (const compilerKind of PossibleCompilerKinds) { + describe(`[${compilerKind}] ${version}`, () => { + let data: any = {}; + let sourceUnits: SourceUnit[]; - before("Compile", () => { - const result = compileSol(sample, version, []); + before("Compile", async () => { + const result = await compileSol( + sample, + version, + [], + undefined, + undefined, + compilerKind as CompilerKind + ); - expect(result.compilerVersion).toEqual(version); - expect(result.files).toEqual(expectedFiles); + expect(result.compilerVersion).toEqual(version); + expect(result.files).toEqual(expectedFiles); - const errors = detectCompileErrors(result.data); + const errors = detectCompileErrors(result.data); - expect(errors).toHaveLength(0); + expect(errors).toHaveLength(0); - data = result.data; - }); + data = result.data; + }); - for (const kind of [ASTKind.Modern, ASTKind.Legacy]) { - it(`Process compiler output (${kind})`, () => { - const reader = new ASTReader(); + for (const astKind of [ASTKind.Modern, ASTKind.Legacy]) { + it(`Process compiler output (${astKind})`, () => { + const reader = new ASTReader(); - sourceUnits = reader.read(data, kind); + sourceUnits = reader.read(data, astKind); - expect(sourceUnits.length).toEqual(1); + expect(sourceUnits.length).toEqual(1); - const sourceUnit = sourceUnits[0]; + const sourceUnit = sourceUnits[0]; - expect(sourceUnit.id).toEqual(207); - expect(sourceUnit.src).toEqual("0:1581:0"); - expect(sourceUnit.absolutePath).toEqual(sample); - expect(sourceUnit.children.length).toEqual(2); - expect(sourceUnit.getChildren().length).toEqual(206); - }); + expect(sourceUnit.id).toEqual(207); + expect(sourceUnit.src).toEqual("0:1581:0"); + expect(sourceUnit.absolutePath).toEqual(sample); + expect(sourceUnit.children.length).toEqual(2); + expect(sourceUnit.getChildren().length).toEqual(206); + }); - it(`Validate processed output (${kind})`, () => { - const sourceUnit = sourceUnits[0]; - const sourceUnitImprint = createImprint(sourceUnit); + it(`Validate processed output (${astKind})`, () => { + const sourceUnit = sourceUnits[0]; + const sourceUnitImprint = createImprint(sourceUnit); - expect(sourceUnitImprint.ASTNode).toBeUndefined(); + expect(sourceUnitImprint.ASTNode).toBeUndefined(); - for (const [type, count] of encounters.entries()) { - expect(sourceUnitImprint[type]).toBeDefined(); - expect(sourceUnitImprint[type].length).toEqual(count); + for (const [type, count] of encounters.entries()) { + expect(sourceUnitImprint[type]).toBeDefined(); + expect(sourceUnitImprint[type].length).toEqual(count); - const nodes = sourceUnit.getChildrenBySelector( - (node) => node.type === type, - type === "SourceUnit" - ); + const nodes = sourceUnit.getChildrenBySelector( + (node) => node.type === type, + type === "SourceUnit" + ); - expect(nodes.length).toEqual(count); - } - }); - } - }); + expect(nodes.length).toEqual(count); + } + }); + } + }); + } } }); diff --git a/test/integration/compile/06.spec.ts b/test/integration/compile/06.spec.ts index e0f328a9..f504071c 100644 --- a/test/integration/compile/06.spec.ts +++ b/test/integration/compile/06.spec.ts @@ -3,9 +3,11 @@ import fse from "fs-extra"; import { ASTKind, ASTReader, + CompilerKind, CompilerVersions06, compileSol, detectCompileErrors, + PossibleCompilerKinds, SourceUnit } from "../../../src"; import { createImprint } from "./common"; @@ -53,59 +55,68 @@ const encounters = new Map([ describe(`Compile ${sample} with any available 0.6.x compiler`, () => { for (const version of CompilerVersions06) { - describe(`Solc ${version}`, () => { - let data: any = {}; - let sourceUnits: SourceUnit[]; + for (const compilerKind of PossibleCompilerKinds) { + describe(`[${compilerKind}] ${version}`, () => { + let data: any = {}; + let sourceUnits: SourceUnit[]; - before("Compile", () => { - const result = compileSol(sample, version, []); + before("Compile", async () => { + const result = await compileSol( + sample, + version, + [], + undefined, + undefined, + compilerKind as CompilerKind + ); - expect(result.compilerVersion).toEqual(version); - expect(result.files).toEqual(expectedFiles); + expect(result.compilerVersion).toEqual(version); + expect(result.files).toEqual(expectedFiles); - const errors = detectCompileErrors(result.data); + const errors = detectCompileErrors(result.data); - expect(errors).toHaveLength(0); + expect(errors).toHaveLength(0); - data = result.data; - }); + data = result.data; + }); - for (const kind of [ASTKind.Modern, ASTKind.Legacy]) { - it(`Process compiler output (${kind})`, () => { - const reader = new ASTReader(); + for (const astKind of [ASTKind.Modern, ASTKind.Legacy]) { + it(`Process compiler output (${astKind})`, () => { + const reader = new ASTReader(); - sourceUnits = reader.read(data, kind); + sourceUnits = reader.read(data, astKind); - expect(sourceUnits.length).toEqual(1); + expect(sourceUnits.length).toEqual(1); - const sourceUnit = sourceUnits[0]; + const sourceUnit = sourceUnits[0]; - expect(sourceUnit.id).toEqual(223); - expect(sourceUnit.src).toEqual("0:1586:0"); - expect(sourceUnit.absolutePath).toEqual(sample); - expect(sourceUnit.children.length).toEqual(7); - expect(sourceUnit.getChildren().length).toEqual(222); - }); + expect(sourceUnit.id).toEqual(223); + expect(sourceUnit.src).toEqual("0:1586:0"); + expect(sourceUnit.absolutePath).toEqual(sample); + expect(sourceUnit.children.length).toEqual(7); + expect(sourceUnit.getChildren().length).toEqual(222); + }); - it(`Validate processed output (${kind})`, () => { - const sourceUnit = sourceUnits[0]; - const sourceUnitImprint = createImprint(sourceUnit); + it(`Validate processed output (${astKind})`, () => { + const sourceUnit = sourceUnits[0]; + const sourceUnitImprint = createImprint(sourceUnit); - expect(sourceUnitImprint.ASTNode).toBeUndefined(); + expect(sourceUnitImprint.ASTNode).toBeUndefined(); - for (const [type, count] of encounters.entries()) { - expect(sourceUnitImprint[type]).toBeDefined(); - expect(sourceUnitImprint[type].length).toEqual(count); + for (const [type, count] of encounters.entries()) { + expect(sourceUnitImprint[type]).toBeDefined(); + expect(sourceUnitImprint[type].length).toEqual(count); - const nodes = sourceUnit.getChildrenBySelector( - (node) => node.type === type, - type === "SourceUnit" - ); + const nodes = sourceUnit.getChildrenBySelector( + (node) => node.type === type, + type === "SourceUnit" + ); - expect(nodes.length).toEqual(count); - } - }); - } - }); + expect(nodes.length).toEqual(count); + } + }); + } + }); + } } }); diff --git a/test/integration/compile/kinds.spec.ts b/test/integration/compile/kinds.spec.ts new file mode 100644 index 00000000..f7486947 --- /dev/null +++ b/test/integration/compile/kinds.spec.ts @@ -0,0 +1,200 @@ +import expect from "expect"; +import fse from "fs-extra"; +import { + CompilationOutput, + CompileFailedError, + CompileResult, + CompilerKind, + compileSol, + LatestVersionInEachSeriesStrategy, + VersionDetectionStrategy +} from "../../../src"; +import { searchRecursive } from "../../utils"; + +/** + * Invoke `cb` for all `Objects` in `json`. + */ +function walkObjects(json: any, cb: (o: Record) => void): void { + if (json instanceof Array) { + for (const el of json) { + walkObjects(el, cb); + } + } else if (json instanceof Object) { + cb(json); + + for (const field of Object.values(json)) { + walkObjects(field, cb); + } + } +} + +/** + * Given a `CompileResult` or `CompileFailedError` normalize it to something + * that we can use for comparison. For `CompileResult` we just normalize the + * ASTs for all files a little (see comments below), and for + * `CompileFailedError` we return just the message. + */ +function normalizeOutput(output: CompileResult | CompileFailedError): any { + if (output instanceof CompileFailedError) { + return output.message; + } + + const sources = output.data.sources; + const res: any = { + compilerVersion: output.compilerVersion, + sources: {} + }; + + // 1) Normalize native AST output for 0.4.x to wasm's + for (const file in sources) { + const fileAST = sources[file]; + + if ("ast" in fileAST && "legacyAST" in fileAST) { + /// 0.4.x native output + res.sources[file] = { AST: fileAST["legacyAST"] }; + } else if ("AST" in fileAST) { + /// 0.4.x wasm output or >= 0.5.x native/wasm output + res.sources[file] = fileAST; + } + } + + /** + * 2) In 0.8.x wasm outputs negative + * referencedDeclaration(s)/overloadedDeclarations as negative, while native + * casts them to uint. So wasm would output -1, while native would output + * 4294967295. Normalize to native. + * + * 3) The src fields of entries inside the `externalReferences` array of + * `InlineAssembly` nodes differ between native and wasm. Ignore those for now (set to "") + * + * 4) The order of the `externalReferences` in `InlineAssembly` nodes differs sometimes + * between native and wasm (no idea why) + */ + walkObjects(res.sources, (n) => { + const refDecl = n["referencedDeclaration"]; + + if (refDecl !== undefined && typeof refDecl === "number" && refDecl < 0) { + n["referencedDeclaration"] += 4294967296; + } + + const overlDecls = n["overloadedDeclarations"]; + + if (overlDecls instanceof Array) { + for (let i = 0; i < overlDecls.length; i++) { + if (overlDecls[i] < 0) { + overlDecls[i] += 4294967296; + } + } + } + + if ( + n.name === "InlineAssembly" && + n.attributes instanceof Object && + n.attributes.externalReferences instanceof Array + ) { + walkObjects(n.attributes.externalReferences, (n) => { + if ("src" in n) { + n.src = ""; + } + }); + + n.attributes.externalReferences.sort((a: any, b: any) => { + const aStr = JSON.stringify(a); + const bStr = JSON.stringify(b); + + return aStr < bStr ? -1 : aStr === bStr ? 0 : 1; + }); + } + }); + + return res; +} + +describe(`Native and WASM compilers produce the same results for all files`, () => { + const samples = searchRecursive("test/samples/solidity/", (name) => name.endsWith(".sol")); + + /** + * Skip samples, that are causing one of the compilers to crash or lead to OOM. + */ + const skipSamples = new Set(["test/samples/solidity/latest_08.sourced.sol"]); + + const defaultCompilationOutput = [CompilationOutput.ALL]; + const defaultCompilerSettings = { optimizer: { enabled: false } }; + + const additionalArgs = new Map([ + [ + "test/samples/solidity/path_remapping/entry.sol", + [["@missing=./local"], defaultCompilationOutput, defaultCompilerSettings] + ] + ]); + + for (const sample of samples) { + const fileName = sample.replace(process.cwd() + "/", ""); + + if (skipSamples.has(fileName)) { + continue; + } + + it(fileName, async () => { + const source = fse.readFileSync(sample, { encoding: "utf8" }); + const args = additionalArgs.get(fileName); + const versionStrategy = new VersionDetectionStrategy( + [source], + new LatestVersionInEachSeriesStrategy() + ); + + const [remappings, outputs, settings] = + args === undefined ? [[], defaultCompilationOutput, defaultCompilerSettings] : args; + + let wasmResult: CompileResult | CompileFailedError; + let nativeResult: CompileResult | CompileFailedError; + + // Uncomment next line to see what file caused compiler crash: + // console.log(fileName); + + try { + wasmResult = await compileSol( + fileName, + versionStrategy, + remappings, + outputs, + settings, + CompilerKind.WASM + ); + } catch (e) { + if (e instanceof CompileFailedError) { + wasmResult = e; + } else { + throw e; + } + } + + try { + nativeResult = await compileSol( + fileName, + versionStrategy, + remappings, + outputs, + settings, + CompilerKind.Native + ); + } catch (e) { + if (e instanceof CompileFailedError) { + nativeResult = e; + } else { + throw e; + } + } + + /** + * Comparing the compiler outputs is tricky as there are subtle differences. + * See comment on `normalizeOutput` for details. + */ + + const normalizedWasmResult = normalizeOutput(wasmResult); + const normalizedNativeResult = normalizeOutput(nativeResult); + + expect(normalizedWasmResult).toEqual(normalizedNativeResult); + }); + } +}); diff --git a/test/integration/compile/latest_06.spec.ts b/test/integration/compile/latest_06.spec.ts index a3a38020..5721a81e 100644 --- a/test/integration/compile/latest_06.spec.ts +++ b/test/integration/compile/latest_06.spec.ts @@ -3,9 +3,11 @@ import fse from "fs-extra"; import { ASTKind, ASTReader, + CompilerKind, CompilerVersions06, compileSol, detectCompileErrors, + PossibleCompilerKinds, SourceUnit } from "../../../src"; import { createImprint } from "./common"; @@ -60,57 +62,66 @@ const encounters = new Map([ ["ForStatement", 3] ]); -describe(`Compile ${sample} with ${compilerVersion} compiler`, () => { - let data: any = {}; - let sourceUnits: SourceUnit[]; +for (const compilerKind of PossibleCompilerKinds) { + describe(`Compile ${sample} with ${compilerKind} ${compilerVersion} compiler`, () => { + let data: any = {}; + let sourceUnits: SourceUnit[]; - before("Compile", () => { - const result = compileSol(sample, "auto", []); + before("Compile", async () => { + const result = await compileSol( + sample, + "auto", + [], + undefined, + undefined, + compilerKind as CompilerKind + ); - expect(result.compilerVersion).toEqual(compilerVersion); - expect(result.files).toEqual(expectedFiles); + expect(result.compilerVersion).toEqual(compilerVersion); + expect(result.files).toEqual(expectedFiles); - const errors = detectCompileErrors(result.data); + const errors = detectCompileErrors(result.data); - expect(errors).toHaveLength(0); + expect(errors).toHaveLength(0); - data = result.data; - }); + data = result.data; + }); - for (const kind of [ASTKind.Modern, ASTKind.Legacy]) { - it(`Parse compiler output (${kind})`, () => { - const reader = new ASTReader(); + for (const astKind of [ASTKind.Modern, ASTKind.Legacy]) { + it(`Parse compiler output (${astKind})`, () => { + const reader = new ASTReader(); - sourceUnits = reader.read(data, kind); + sourceUnits = reader.read(data, astKind); - expect(sourceUnits.length).toEqual(1); + expect(sourceUnits.length).toEqual(1); - const sourceUnit = sourceUnits[0]; + const sourceUnit = sourceUnits[0]; - expect(sourceUnit.id).toEqual(664); - expect(sourceUnit.src).toEqual("0:5704:0"); - expect(sourceUnit.absolutePath).toEqual(sample); - expect(sourceUnit.children.length).toEqual(14); - expect(sourceUnit.getChildren().length).toEqual(646); - }); + expect(sourceUnit.id).toEqual(664); + expect(sourceUnit.src).toEqual("0:5704:0"); + expect(sourceUnit.absolutePath).toEqual(sample); + expect(sourceUnit.children.length).toEqual(14); + expect(sourceUnit.getChildren().length).toEqual(646); + }); - it(`Validate parsed output (${kind})`, () => { - const sourceUnit = sourceUnits[0]; - const sourceUnitImprint = createImprint(sourceUnit); + it(`Validate parsed output (${astKind})`, () => { + const sourceUnit = sourceUnits[0]; + const sourceUnitImprint = createImprint(sourceUnit); - expect(sourceUnitImprint.ASTNode).toBeUndefined(); + expect(sourceUnitImprint.ASTNode).toBeUndefined(); - for (const [type, count] of encounters.entries()) { - expect(sourceUnitImprint[type]).toBeDefined(); - expect(sourceUnitImprint[type].length).toEqual(count); + for (const [type, count] of encounters.entries()) { + expect(sourceUnitImprint[type]).toBeDefined(); + expect(sourceUnitImprint[type].length).toEqual(count); - const nodes = sourceUnit.getChildrenBySelector( - (node) => node.type === type, - type === "SourceUnit" - ); + const nodes = sourceUnit.getChildrenBySelector( + (node) => node.type === type, + type === "SourceUnit" + ); - expect(nodes.length).toEqual(count); - } - }); - } -}); + expect(nodes.length).toEqual(count); + } + }); + } + }); +} diff --git a/test/integration/compile/latest_07.spec.ts b/test/integration/compile/latest_07.spec.ts index 550f96bc..5cf0bd5d 100644 --- a/test/integration/compile/latest_07.spec.ts +++ b/test/integration/compile/latest_07.spec.ts @@ -3,9 +3,11 @@ import fse from "fs-extra"; import { ASTKind, ASTReader, + CompilerKind, CompilerVersions07, compileSol, detectCompileErrors, + PossibleCompilerKinds, SourceUnit } from "../../../src"; import { createImprint } from "./common"; @@ -51,57 +53,66 @@ const encounters = new Map([ ["ElementaryTypeNameExpression", 1] ]); -describe(`Compile ${sample} with ${compilerVersion} compiler`, () => { - let data: any = {}; - let sourceUnits: SourceUnit[]; +for (const compilerKind of PossibleCompilerKinds) { + describe(`Compile ${sample} with ${compilerKind} ${compilerVersion} compiler`, () => { + let data: any = {}; + let sourceUnits: SourceUnit[]; - before("Compile", () => { - const result = compileSol(sample, "auto", []); + before("Compile", async () => { + const result = await compileSol( + sample, + "auto", + [], + undefined, + undefined, + compilerKind as CompilerKind + ); - expect(result.compilerVersion).toEqual(compilerVersion); - expect(result.files).toEqual(expectedFiles); + expect(result.compilerVersion).toEqual(compilerVersion); + expect(result.files).toEqual(expectedFiles); - const errors = detectCompileErrors(result.data); + const errors = detectCompileErrors(result.data); - expect(errors).toHaveLength(0); + expect(errors).toHaveLength(0); - data = result.data; - }); + data = result.data; + }); - for (const kind of [ASTKind.Modern, ASTKind.Legacy]) { - it(`Parse compiler output (${kind})`, () => { - const reader = new ASTReader(); + for (const astKind of [ASTKind.Modern, ASTKind.Legacy]) { + it(`Parse compiler output (${astKind})`, () => { + const reader = new ASTReader(); - sourceUnits = reader.read(data, kind); + sourceUnits = reader.read(data, astKind); - expect(sourceUnits.length).toEqual(1); + expect(sourceUnits.length).toEqual(1); - const sourceUnit = sourceUnits[0]; + const sourceUnit = sourceUnits[0]; - expect(sourceUnit.id).toEqual(353); - expect(sourceUnit.src).toEqual("0:2428:0"); - expect(sourceUnit.absolutePath).toEqual(sample); - expect(sourceUnit.children.length).toEqual(14); - expect(sourceUnit.getChildren().length).toEqual(348); - }); + expect(sourceUnit.id).toEqual(353); + expect(sourceUnit.src).toEqual("0:2428:0"); + expect(sourceUnit.absolutePath).toEqual(sample); + expect(sourceUnit.children.length).toEqual(14); + expect(sourceUnit.getChildren().length).toEqual(348); + }); - it(`Validate parsed output (${kind})`, () => { - const sourceUnit = sourceUnits[0]; - const sourceUnitImprint = createImprint(sourceUnit); + it(`Validate parsed output (${astKind})`, () => { + const sourceUnit = sourceUnits[0]; + const sourceUnitImprint = createImprint(sourceUnit); - expect(sourceUnitImprint.ASTNode).toBeUndefined(); + expect(sourceUnitImprint.ASTNode).toBeUndefined(); - for (const [type, count] of encounters.entries()) { - expect(sourceUnitImprint[type]).toBeDefined(); - expect(sourceUnitImprint[type].length).toEqual(count); + for (const [type, count] of encounters.entries()) { + expect(sourceUnitImprint[type]).toBeDefined(); + expect(sourceUnitImprint[type].length).toEqual(count); - const nodes = sourceUnit.getChildrenBySelector( - (node) => node.type === type, - type === "SourceUnit" - ); + const nodes = sourceUnit.getChildrenBySelector( + (node) => node.type === type, + type === "SourceUnit" + ); - expect(nodes.length).toEqual(count); - } - }); - } -}); + expect(nodes.length).toEqual(count); + } + }); + } + }); +} diff --git a/test/integration/compile/latest_08.spec.ts b/test/integration/compile/latest_08.spec.ts index 865884f1..01ea361a 100644 --- a/test/integration/compile/latest_08.spec.ts +++ b/test/integration/compile/latest_08.spec.ts @@ -3,9 +3,11 @@ import fse from "fs-extra"; import { ASTKind, ASTReader, + CompilerKind, CompilerVersions08, compileSol, detectCompileErrors, + PossibleCompilerKinds, SourceUnit } from "../../../src"; import { createImprint } from "./common"; @@ -73,66 +75,75 @@ const encounters = new Map([ ["FunctionTypeName", 1] ]); -describe(`Compile ${mainSample} with ${compilerVersion} compiler`, () => { - const kind = ASTKind.Modern; - - let data: any = {}; - let sourceUnits: SourceUnit[]; - - before("Compile", () => { - const result = compileSol(mainSample, "auto", []); +for (const compilerKind of PossibleCompilerKinds) { + describe(`Compile ${mainSample} with ${compilerKind} ${compilerVersion} compiler`, () => { + const astKind = ASTKind.Modern; + + let data: any = {}; + let sourceUnits: SourceUnit[]; + + before("Compile", async () => { + const result = await compileSol( + mainSample, + "auto", + [], + undefined, + undefined, + compilerKind as CompilerKind + ); - expect(result.compilerVersion).toEqual(compilerVersion); - expect(result.files).toEqual(expectedFiles); + expect(result.compilerVersion).toEqual(compilerVersion); + expect(result.files).toEqual(expectedFiles); - const errors = detectCompileErrors(result.data); + const errors = detectCompileErrors(result.data); - expect(errors).toHaveLength(0); + expect(errors).toHaveLength(0); - data = result.data; - }); + data = result.data; + }); - it(`Parse compiler output (${kind})`, () => { - const reader = new ASTReader(); + it(`Parse compiler output (${astKind})`, () => { + const reader = new ASTReader(); - sourceUnits = reader.read(data, kind); + sourceUnits = reader.read(data, astKind); - expect(sourceUnits.length).toEqual(2); + expect(sourceUnits.length).toEqual(2); - const sourceUnit = sourceUnits[0]; + const sourceUnit = sourceUnits[0]; - // Uncomment following lines to get the current state of unit: - // console.log(sourceUnit.print()); - // console.log(sourceUnit.getChildren().length); + // Uncomment following lines to get the current state of unit: + // console.log(sourceUnit.print()); + // console.log(sourceUnit.getChildren().length); - expect(sourceUnit.id).toEqual(513); - expect(sourceUnit.src).toEqual("0:6507:0"); - expect(sourceUnit.absolutePath).toEqual(mainSample); - expect(sourceUnit.children.length).toEqual(20); - expect(sourceUnit.getChildren().length).toEqual(507); - }); + expect(sourceUnit.id).toEqual(513); + expect(sourceUnit.src).toEqual("0:6507:0"); + expect(sourceUnit.absolutePath).toEqual(mainSample); + expect(sourceUnit.children.length).toEqual(20); + expect(sourceUnit.getChildren().length).toEqual(507); + }); - it(`Validate parsed output (${kind})`, () => { - const sourceUnit = sourceUnits[0]; - const sourceUnitImprint = createImprint(sourceUnit); + it(`Validate parsed output (${astKind})`, () => { + const sourceUnit = sourceUnits[0]; + const sourceUnitImprint = createImprint(sourceUnit); - expect(sourceUnitImprint.ASTNode).toBeUndefined(); + expect(sourceUnitImprint.ASTNode).toBeUndefined(); - // Uncomment following lines to get the current unit snapshot data: - // for (const [type, nodes] of Object.entries(sourceUnitImprint)) { - // console.log(`["${type}", ${nodes.length}],`); - // } + // Uncomment following lines to get the current unit snapshot data: + // for (const [type, nodes] of Object.entries(sourceUnitImprint)) { + // console.log(`["${type}", ${nodes.length}],`); + // } - for (const [type, count] of encounters.entries()) { - expect(sourceUnitImprint[type]).toBeDefined(); - expect(sourceUnitImprint[type].length).toEqual(count); + for (const [type, count] of encounters.entries()) { + expect(sourceUnitImprint[type]).toBeDefined(); + expect(sourceUnitImprint[type].length).toEqual(count); - const nodes = sourceUnit.getChildrenBySelector( - (node) => node.type === type, - type === "SourceUnit" - ); + const nodes = sourceUnit.getChildrenBySelector( + (node) => node.type === type, + type === "SourceUnit" + ); - expect(nodes.length).toEqual(count); - } + expect(nodes.length).toEqual(count); + } + }); }); -}); +} diff --git a/test/integration/factory/copy.spec.ts b/test/integration/factory/copy.spec.ts index 8c19d6c2..039c21f4 100644 --- a/test/integration/factory/copy.spec.ts +++ b/test/integration/factory/copy.spec.ts @@ -5,59 +5,74 @@ import { ASTNodeFactory, ASTReader, compileJson, + CompilerKind, compileSol, detectCompileErrors } from "../../../src"; -const cases: Array<[string, string]> = [ +const cases: Array<[string, Array<[CompilerKind, string]>]> = [ [ "./test/samples/solidity/declarations/contract_050.json", - "./test/samples/solidity/declarations/contract_050.nodes.txt" + [ + [CompilerKind.WASM, "./test/samples/solidity/declarations/contract_050.nodes.wasm.txt"], + [ + CompilerKind.Native, + "./test/samples/solidity/declarations/contract_050.nodes.native.txt" + ] + ] ], - ["./test/samples/solidity/latest_08.sol", "./test/samples/solidity/latest_08.nodes.txt"] + [ + "./test/samples/solidity/latest_08.sol", + [ + [CompilerKind.WASM, "./test/samples/solidity/latest_08.nodes.wasm.txt"], + [CompilerKind.Native, "./test/samples/solidity/latest_08.nodes.native.txt"] + ] + ] ]; describe(`ASTNodeFactory.copy() validation`, () => { - for (const [sample, snapshot] of cases) { - describe(`Validate copy of ${sample} by snapshot ${snapshot}`, () => { - let data: any = {}; + for (const [sample, setups] of cases) { + for (const [kind, snapshot] of setups) { + describe(`[${kind}] ${sample} -> ${snapshot}`, () => { + let data: any = {}; - before("Compile", () => { - const result = sample.endsWith(".sol") - ? compileSol(sample, "auto", []) - : compileJson(sample, "auto", []); + before("Compile", async () => { + const result = await (sample.endsWith(".sol") + ? compileSol(sample, "auto", [], undefined, undefined, kind) + : compileJson(sample, "auto", undefined, undefined, kind)); - const errors = detectCompileErrors(result.data); + const errors = detectCompileErrors(result.data); - expect(errors).toHaveLength(0); + expect(errors).toHaveLength(0); - data = result.data; - }); + data = result.data; + }); - it("Validate copying results", () => { - const context = new ASTContext(); + it("Validate copying results", () => { + const context = new ASTContext(); - context.id = 1000; + context.id = 1000; - const reader = new ASTReader(context); + const reader = new ASTReader(context); - const units = reader.read(data); + const units = reader.read(data); - const factory = new ASTNodeFactory(context); + const factory = new ASTNodeFactory(context); - const clones = units.map((unit) => factory.copy(unit)); - const result = clones - .map((unit) => unit.print(Number.MAX_SAFE_INTEGER)) - .join("\n") - .replace(new RegExp(process.cwd(), "g"), "."); + const clones = units.map((unit) => factory.copy(unit)); + const result = clones + .map((unit) => unit.print(Number.MAX_SAFE_INTEGER)) + .join("\n") + .replace(new RegExp(process.cwd(), "g"), "."); - // Uncomment next line to update snapshots - // fse.writeFileSync(snapshot, result, { encoding: "utf-8" }); + // Uncomment next line to update snapshots + // fse.writeFileSync(snapshot, result, { encoding: "utf-8" }); - const content = fse.readFileSync(snapshot, { encoding: "utf-8" }); + const content = fse.readFileSync(snapshot, { encoding: "utf-8" }); - expect(result).toEqual(content); + expect(result).toEqual(content); + }); }); - }); + } } }); diff --git a/test/integration/factory/replace_node.spec.ts b/test/integration/factory/replace_node.spec.ts index 7b76f099..9512bb2b 100644 --- a/test/integration/factory/replace_node.spec.ts +++ b/test/integration/factory/replace_node.spec.ts @@ -4,6 +4,7 @@ import { ASTNodeFactory, ASTReader, compileJson, + CompilerKind, compileSol, ContractDefinition, detectCompileErrors, @@ -12,6 +13,7 @@ import { FunctionDefinition, isSane, ModifierDefinition, + PossibleCompilerKinds, replaceNode, StructDefinition, UserDefinedValueTypeDefinition, @@ -70,60 +72,62 @@ const cases: string[] = [ describe(`replaceNode() validation`, () => { for (const sample of cases) { - describe(`Validate replaceNode on ${sample}`, () => { - let data: any = {}; + for (const kind of PossibleCompilerKinds) { + describe(`[${kind}] Validate replaceNode on ${sample}`, () => { + let data: any = {}; - before("Compile", () => { - const result = sample.endsWith(".sol") - ? compileSol(sample, "auto", []) - : compileJson(sample, "auto", []); + before("Compile", async () => { + const result = await (sample.endsWith(".sol") + ? compileSol(sample, "auto", [], undefined, undefined, kind as CompilerKind) + : compileJson(sample, "auto", undefined, undefined, kind as CompilerKind)); - const errors = detectCompileErrors(result.data); + const errors = detectCompileErrors(result.data); - expect(errors).toHaveLength(0); + expect(errors).toHaveLength(0); - data = result.data; - }); + data = result.data; + }); - it("Validate copying results", () => { - const context = new ASTContext(); + it("Validate copying results", () => { + const context = new ASTContext(); - context.id = 1000; + context.id = 1000; - const reader = new ASTReader(context); + const reader = new ASTReader(context); - const units = reader.read(data); + const units = reader.read(data); - const factory = new ASTNodeFactory(context); + const factory = new ASTNodeFactory(context); - for (const unit of units) { - for (const child of unit.getChildrenByType(Expression)) { - // Skip replacing nodes that may be referenced by vReferencedDeclaration - if ( - child instanceof ContractDefinition || - child instanceof FunctionDefinition || - child instanceof ModifierDefinition || - child instanceof StructDefinition || - child instanceof EnumDefinition || - child instanceof UserDefinedValueTypeDefinition || - child instanceof VariableDeclaration - ) { - continue; - } + for (const unit of units) { + for (const child of unit.getChildrenByType(Expression)) { + // Skip replacing nodes that may be referenced by vReferencedDeclaration + if ( + child instanceof ContractDefinition || + child instanceof FunctionDefinition || + child instanceof ModifierDefinition || + child instanceof StructDefinition || + child instanceof EnumDefinition || + child instanceof UserDefinedValueTypeDefinition || + child instanceof VariableDeclaration + ) { + continue; + } - const parent = child.parent; - const childCopy = factory.copy(child); + const parent = child.parent; + const childCopy = factory.copy(child); - expect(childCopy.parent).not.toEqual(parent); - expect(child.id).not.toEqual(childCopy.id); + expect(childCopy.parent).not.toEqual(parent); + expect(child.id).not.toEqual(childCopy.id); - expect(() => replaceNode(child, childCopy)).not.toThrow(); - expect(childCopy.parent == parent); - } + expect(() => replaceNode(child, childCopy)).not.toThrow(); + expect(childCopy.parent == parent); + } - expect(isSane(unit, context)).toBeTruthy(); - } + expect(isSane(unit, context)).toBeTruthy(); + } + }); }); - }); + } } }); diff --git a/test/integration/sol-ast-compile/_.spec.ts b/test/integration/sol-ast-compile/_.spec.ts index 5b59fa89..d6dd886c 100644 --- a/test/integration/sol-ast-compile/_.spec.ts +++ b/test/integration/sol-ast-compile/_.spec.ts @@ -8,14 +8,12 @@ describe(command, () => { let outData: string; let errData: string; - before((done) => { + before(() => { const result = SolAstCompileExec(); outData = result.stdout; errData = result.stderr; exitCode = result.status; - - done(); }); it("Exit code is valid", () => { diff --git a/test/integration/sol-ast-compile/_compile_errors.spec.ts b/test/integration/sol-ast-compile/_compile_errors.spec.ts index ab4a5fce..29944217 100644 --- a/test/integration/sol-ast-compile/_compile_errors.spec.ts +++ b/test/integration/sol-ast-compile/_compile_errors.spec.ts @@ -1,4 +1,5 @@ import expect from "expect"; +import { PossibleCompilerKinds } from "../../../src"; import { SolAstCompileCommand, SolAstCompileExec } from "./common"; const cases: Array<[string, string[]]> = [ @@ -29,36 +30,36 @@ const cases: Array<[string, string[]]> = [ ]; for (const [fileName, stdErr] of cases) { - const args = [fileName]; - const command = SolAstCompileCommand(...args); + for (const kind of PossibleCompilerKinds) { + const args = [fileName, "--compiler-kind", kind]; + const command = SolAstCompileCommand(...args); - describe(command, () => { - let exitCode: number | null; - let outData: string; - let errData: string; + describe(command, () => { + let exitCode: number | null; + let outData: string; + let errData: string; - before((done) => { - const result = SolAstCompileExec(...args); + before(() => { + const result = SolAstCompileExec(...args); - outData = result.stdout; - errData = result.stderr; - exitCode = result.status; + outData = result.stdout; + errData = result.stderr; + exitCode = result.status; + }); - done(); - }); - - it("Exit code is valid", () => { - expect(exitCode).toEqual(1); - }); + it("Exit code is valid", () => { + expect(exitCode).toEqual(1); + }); - it("STDERR is correct", () => { - for (const value of stdErr) { - expect(errData).toContain(value); - } - }); + it("STDERR is correct", () => { + for (const value of stdErr) { + expect(errData).toContain(value); + } + }); - it("STDOUT is empty", () => { - expect(outData).toEqual(""); + it("STDOUT is empty", () => { + expect(outData).toEqual(""); + }); }); - }); + } } diff --git a/test/integration/sol-ast-compile/common.ts b/test/integration/sol-ast-compile/common.ts index a6e3e602..8a6c5f92 100644 --- a/test/integration/sol-ast-compile/common.ts +++ b/test/integration/sol-ast-compile/common.ts @@ -23,6 +23,7 @@ export const options = [ "stdin", "mode", "compiler-version", + "compiler-kind", "path-remapping", "compiler-settings", "raw", diff --git a/test/integration/sol-ast-compile/compiler-settings/invalid.spec.ts b/test/integration/sol-ast-compile/compiler-settings/invalid.spec.ts index 7454237a..3b55c830 100644 --- a/test/integration/sol-ast-compile/compiler-settings/invalid.spec.ts +++ b/test/integration/sol-ast-compile/compiler-settings/invalid.spec.ts @@ -1,42 +1,44 @@ import expect from "expect"; +import { PossibleCompilerKinds } from "../../../../src"; import { SolAstCompileCommand, SolAstCompileExec } from "../common"; const sample = "test/samples/solidity/missing_pragma.sol"; -const badArgsSamples = [ +const badArgsSamples: Array<[string[], string]> = [ [ [sample, "--compiler-settings", "{blahblah}"], `Error: Invalid compiler settings '{blahblah}'. Compiler settings must be a valid JSON object.` ] ]; -for (const [args, expectedError] of badArgsSamples) { - const command = SolAstCompileCommand(...args); +for (const [sampleArgs, expectedError] of badArgsSamples) { + for (const kind of PossibleCompilerKinds) { + const args = [...sampleArgs, "--compiler-kind", kind]; + const command = SolAstCompileCommand(...args); - describe(command, () => { - let exitCode: number | null; - let outData = ""; - let errData = ""; + describe(command, () => { + let exitCode: number | null; + let outData = ""; + let errData = ""; - before((done) => { - const result = SolAstCompileExec(...args); + before(() => { + const result = SolAstCompileExec(...args); - outData = result.stdout; - errData = result.stderr; - exitCode = result.status; + outData = result.stdout; + errData = result.stderr; + exitCode = result.status; + }); - done(); - }); - - it("Exit code is valid", () => { - expect(exitCode).toEqual(1); - }); + it("Exit code is valid", () => { + expect(exitCode).toEqual(1); + }); - it("STDERR is correct", () => { - expect(errData).toContain(expectedError); - }); + it("STDERR is correct", () => { + expect(errData).toContain(expectedError); + }); - it("STDOUT is empty", () => { - expect(outData).toEqual(""); + it("STDOUT is empty", () => { + expect(outData).toEqual(""); + }); }); - }); + } } diff --git a/test/integration/sol-ast-compile/compiler-settings/valid.spec.ts b/test/integration/sol-ast-compile/compiler-settings/valid.spec.ts index ee9b0e7e..657d5779 100644 --- a/test/integration/sol-ast-compile/compiler-settings/valid.spec.ts +++ b/test/integration/sol-ast-compile/compiler-settings/valid.spec.ts @@ -1,4 +1,5 @@ import expect from "expect"; +import { PossibleCompilerKinds } from "../../../../src"; import { SolAstCompileCommand, SolAstCompileExec } from "../common"; const sample = "test/samples/solidity/missing_pragma.sol"; @@ -25,41 +26,43 @@ const values = [ 'value: "1"' ]; -const args = [ +const sampleArgs = [ sample, "--compiler-settings", `{"optimizer": {"enabled": true, "runs": 1}}`, "--compiler-version", "0.6.0" ]; -const command = SolAstCompileCommand(...args); -describe(command, () => { - let exitCode: number | null; - let outData: string; - let errData: string; +for (const kind of PossibleCompilerKinds) { + const args = [...sampleArgs, "--compiler-kind", kind]; + const command = SolAstCompileCommand(...args); - before((done) => { - const result = SolAstCompileExec(...args); + describe(command, () => { + let exitCode: number | null; + let outData: string; + let errData: string; - outData = result.stdout; - errData = result.stderr; - exitCode = result.status; + before(() => { + const result = SolAstCompileExec(...args); - done(); - }); + outData = result.stdout; + errData = result.stderr; + exitCode = result.status; + }); - it("Exit code is valid", () => { - expect(exitCode).toEqual(0); - }); + it("Exit code is valid", () => { + expect(exitCode).toEqual(0); + }); - it("STDERR is empty", () => { - expect(errData).toEqual(""); - }); + it("STDERR is empty", () => { + expect(errData).toEqual(""); + }); - it("STDOUT is correct", () => { - for (const value of values) { - expect(outData).toContain(value); - } + it("STDOUT is correct", () => { + for (const value of values) { + expect(outData).toContain(value); + } + }); }); -}); +} diff --git a/test/integration/sol-ast-compile/compiler-version/invalid.spec.ts b/test/integration/sol-ast-compile/compiler-version/invalid.spec.ts index 8c1c7fd4..f453a15c 100644 --- a/test/integration/sol-ast-compile/compiler-version/invalid.spec.ts +++ b/test/integration/sol-ast-compile/compiler-version/invalid.spec.ts @@ -1,36 +1,38 @@ import expect from "expect"; +import { PossibleCompilerKinds } from "../../../../src"; import { SolAstCompileCommand, SolAstCompileExec } from "../common"; const sample = "test/samples/solidity/missing_pragma.sol"; -const args = [sample, "--compiler-version", "^0.4.0"]; -const command = SolAstCompileCommand(...args); -describe(command, () => { - let exitCode: number | null; - let outData = ""; - let errData = ""; +for (const kind of PossibleCompilerKinds) { + const args = [sample, "--compiler-kind", kind, "--compiler-version", "^0.4.0"]; + const command = SolAstCompileCommand(...args); - before((done) => { - const result = SolAstCompileExec(...args); + describe(command, () => { + let exitCode: number | null; + let outData = ""; + let errData = ""; - outData = result.stdout; - errData = result.stderr; - exitCode = result.status; + before(() => { + const result = SolAstCompileExec(...args); - done(); - }); + outData = result.stdout; + errData = result.stderr; + exitCode = result.status; + }); - it("Exit code is valid", () => { - expect(exitCode).toEqual(1); - }); + it("Exit code is valid", () => { + expect(exitCode).toEqual(1); + }); - it("STDERR is correct", () => { - expect(errData).toContain( - 'Error: Invalid compiler version "^0.4.0". Possible values: "auto" or exact version string.' - ); - }); + it("STDERR is correct", () => { + expect(errData).toContain( + 'Error: Invalid compiler version "^0.4.0". Possible values: "auto" or exact version string.' + ); + }); - it("STDOUT is empty", () => { - expect(outData).toEqual(""); + it("STDOUT is empty", () => { + expect(outData).toEqual(""); + }); }); -}); +} diff --git a/test/integration/sol-ast-compile/compiler-version/valid.spec.ts b/test/integration/sol-ast-compile/compiler-version/valid.spec.ts index 765e4298..6bc2f72b 100644 --- a/test/integration/sol-ast-compile/compiler-version/valid.spec.ts +++ b/test/integration/sol-ast-compile/compiler-version/valid.spec.ts @@ -1,5 +1,5 @@ import expect from "expect"; -import { LatestAndFirstVersionInEachSeriesStrategy } from "../../../../src"; +import { LatestAndFirstVersionInEachSeriesStrategy, PossibleCompilerKinds } from "../../../../src"; import { SolAstCompileCommand, SolAstCompileExec } from "../common"; const sample = "test/samples/solidity/missing_pragma.sol"; @@ -28,36 +28,36 @@ const values = [ ]; for (const version of versions) { - const args = [sample, "--compiler-version", version]; - const command = SolAstCompileCommand(...args); - - describe(command, () => { - let exitCode: number | null; - let outData: string; - let errData: string; - - before((done) => { - const result = SolAstCompileExec(...args); - - outData = result.stdout; - errData = result.stderr; - exitCode = result.status; - - done(); - }); - - it("Exit code is valid", () => { - expect(exitCode).toEqual(0); - }); - - it("STDERR is empty", () => { - expect(errData).toEqual(""); - }); - - it("STDOUT is correct", () => { - for (const value of values) { - expect(outData).toContain(value); - } + for (const kind of PossibleCompilerKinds) { + const args = [sample, "--compiler-kind", kind, "--compiler-version", version]; + const command = SolAstCompileCommand(...args); + + describe(command, () => { + let exitCode: number | null; + let outData: string; + let errData: string; + + before(() => { + const result = SolAstCompileExec(...args); + + outData = result.stdout; + errData = result.stderr; + exitCode = result.status; + }); + + it("Exit code is valid", () => { + expect(exitCode).toEqual(0); + }); + + it("STDERR is empty", () => { + expect(errData).toEqual(""); + }); + + it("STDOUT is correct", () => { + for (const value of values) { + expect(outData).toContain(value); + } + }); }); - }); + } } diff --git a/test/integration/sol-ast-compile/help.spec.ts b/test/integration/sol-ast-compile/help.spec.ts index 30643f89..e3e6972b 100644 --- a/test/integration/sol-ast-compile/help.spec.ts +++ b/test/integration/sol-ast-compile/help.spec.ts @@ -9,14 +9,12 @@ describe(command, () => { let outData: string; let errData: string; - before((done) => { + before(() => { const result = SolAstCompileExec(...args); outData = result.stdout; errData = result.stderr; exitCode = result.status; - - done(); }); it("Exit code is valid", () => { diff --git a/test/integration/sol-ast-compile/mode/invalid.spec.ts b/test/integration/sol-ast-compile/mode/invalid.spec.ts index 760f3325..0dd596da 100644 --- a/test/integration/sol-ast-compile/mode/invalid.spec.ts +++ b/test/integration/sol-ast-compile/mode/invalid.spec.ts @@ -10,14 +10,12 @@ describe(command, () => { let outData: string; let errData: string; - before((done) => { + before(() => { const result = SolAstCompileExec(...args); outData = result.stdout; errData = result.stderr; exitCode = result.status; - - done(); }); it("Exit code is valid", () => { diff --git a/test/integration/sol-ast-compile/mode/valid.spec.ts b/test/integration/sol-ast-compile/mode/valid.spec.ts index 41af9421..752f9d9c 100644 --- a/test/integration/sol-ast-compile/mode/valid.spec.ts +++ b/test/integration/sol-ast-compile/mode/valid.spec.ts @@ -1,4 +1,5 @@ import expect from "expect"; +import { PossibleCompilerKinds } from "../../../../src"; import { SolAstCompileCommand, SolAstCompileExec } from "../common"; const error = "Error: Unable to auto-detect mode for the file name"; @@ -16,36 +17,36 @@ const cases: Array<[string, string, number, string, string[]]> = [ ]; for (const [fileName, mode, expectedExitCode, stdErr, stdOut] of cases) { - const args = [fileName, "--mode", mode]; - const command = SolAstCompileCommand(...args); - - describe(command, () => { - let exitCode: number | null; - let outData: string; - let errData: string; - - before((done) => { - const result = SolAstCompileExec(...args); - - outData = result.stdout; - errData = result.stderr; - exitCode = result.status; - - done(); - }); - - it("Exit code is valid", () => { - expect(exitCode).toEqual(expectedExitCode); - }); - - it("STDERR is correct", () => { - expect(errData).toContain(stdErr); - }); - - it("STDOUT is correct", () => { - for (const value of stdOut) { - expect(outData).toContain(value); - } + for (const kind of PossibleCompilerKinds) { + const args = [fileName, "--compiler-kind", kind, "--mode", mode]; + const command = SolAstCompileCommand(...args); + + describe(command, () => { + let exitCode: number | null; + let outData: string; + let errData: string; + + before(() => { + const result = SolAstCompileExec(...args); + + outData = result.stdout; + errData = result.stderr; + exitCode = result.status; + }); + + it("Exit code is valid", () => { + expect(exitCode).toEqual(expectedExitCode); + }); + + it("STDERR is correct", () => { + expect(errData).toContain(stdErr); + }); + + it("STDOUT is correct", () => { + for (const value of stdOut) { + expect(outData).toContain(value); + } + }); }); - }); + } } diff --git a/test/integration/sol-ast-compile/raw.spec.ts b/test/integration/sol-ast-compile/raw.spec.ts index 4a8fbd49..ade60190 100644 --- a/test/integration/sol-ast-compile/raw.spec.ts +++ b/test/integration/sol-ast-compile/raw.spec.ts @@ -1,38 +1,40 @@ import expect from "expect"; +import { PossibleCompilerKinds } from "../../../src"; import { SolAstCompileCommand, SolAstCompileExec } from "./common"; const sample = "test/samples/solidity/missing_pragma.sol"; -const args = [sample, "--raw"]; -const command = SolAstCompileCommand(...args); -describe(command, () => { - let exitCode: number | null; - let outData: string; - let errData: string; +for (const kind of PossibleCompilerKinds) { + const args = [sample, "--compiler-kind", kind, "--raw"]; + const command = SolAstCompileCommand(...args); - before((done) => { - const result = SolAstCompileExec(...args); + describe(command, () => { + let exitCode: number | null; + let outData: string; + let errData: string; - outData = result.stdout; - errData = result.stderr; - exitCode = result.status; + before(() => { + const result = SolAstCompileExec(...args); - done(); - }); + outData = result.stdout; + errData = result.stderr; + exitCode = result.status; + }); - it("Exit code is valid", () => { - expect(exitCode).toEqual(0); - }); + it("Exit code is valid", () => { + expect(exitCode).toEqual(0); + }); - it("STDERR is empty", () => { - expect(errData).toEqual(""); - }); + it("STDERR is empty", () => { + expect(errData).toEqual(""); + }); - it("STDOUT is correct", () => { - const data = JSON.parse(outData); + it("STDOUT is correct", () => { + const data = JSON.parse(outData); - expect(data).toBeInstanceOf(Object); - expect(data.sources).toBeInstanceOf(Object); - expect(Object.keys(data.sources)).toHaveLength(1); + expect(data).toBeInstanceOf(Object); + expect(data.sources).toBeInstanceOf(Object); + expect(Object.keys(data.sources)).toHaveLength(1); + }); }); -}); +} diff --git a/test/integration/sol-ast-compile/solidity_versions.spec.ts b/test/integration/sol-ast-compile/solidity_versions.spec.ts index 9594f7c7..3e70c557 100644 --- a/test/integration/sol-ast-compile/solidity_versions.spec.ts +++ b/test/integration/sol-ast-compile/solidity_versions.spec.ts @@ -10,14 +10,12 @@ describe(command, () => { let outData: string; let errData: string; - before((done) => { + before(() => { const result = SolAstCompileExec(...args); outData = result.stdout; errData = result.stderr; exitCode = result.status; - - done(); }); it("Exit code is valid", () => { diff --git a/test/integration/sol-ast-compile/source/compile.spec.ts b/test/integration/sol-ast-compile/source/compile.spec.ts index d954576a..349953b4 100644 --- a/test/integration/sol-ast-compile/source/compile.spec.ts +++ b/test/integration/sol-ast-compile/source/compile.spec.ts @@ -1,5 +1,6 @@ import { spawnSync } from "child_process"; import expect from "expect"; +import { PossibleCompilerKinds } from "../../../../src"; import { SolAstCompileExec } from "../common"; const samples: string[] = [ @@ -30,36 +31,42 @@ const samples: string[] = [ export type CompiledBytecode = any; for (const fileName of samples) { - const args = [fileName, "--source"]; + for (const kind of PossibleCompilerKinds) { + const args = [fileName, "--compiler-kind", kind, "--source"]; - describe(`Check re-written ${fileName} compiles`, () => { - let exitCode: number | null; - let outData: string; - let errData: string; + describe(`[${kind}] Check re-written ${fileName} compiles`, () => { + let exitCode: number | null; + let outData: string; + let errData: string; - before(() => { - const result = SolAstCompileExec(...args); + before(() => { + const result = SolAstCompileExec(...args); - outData = result.stdout; - errData = result.stderr; - exitCode = result.status; - }); - - it("Exit code is valid", () => { - expect(exitCode).toEqual(0); - }); + outData = result.stdout; + errData = result.stderr; + exitCode = result.status; + }); - it("STDERR is empty", () => { - expect(errData).toContain(""); - }); + it("Exit code is valid", () => { + expect(exitCode).toEqual(0); + }); - it("Written source compiles", () => { - const result = spawnSync("sol-ast-compile", ["--mode", "sol", "--stdin", "--tree"], { - input: outData, - encoding: "utf8" + it("STDERR is empty", () => { + expect(errData).toContain(""); }); - expect(result.status).toEqual(0); + it("Written source compiles", () => { + const result = spawnSync( + "sol-ast-compile", + ["--mode", "sol", "--stdin", "--tree", "--compiler-kind", kind], + { + input: outData, + encoding: "utf8" + } + ); + + expect(result.status).toEqual(0); + }); }); - }); + } } diff --git a/test/integration/sol-ast-compile/source/snapshot.spec.ts b/test/integration/sol-ast-compile/source/snapshot.spec.ts index a7943439..a99d9245 100644 --- a/test/integration/sol-ast-compile/source/snapshot.spec.ts +++ b/test/integration/sol-ast-compile/source/snapshot.spec.ts @@ -1,5 +1,6 @@ import expect from "expect"; import fse from "fs-extra"; +import { PossibleCompilerKinds } from "../../../../src"; import { SolAstCompileCommand, SolAstCompileExec } from "../common"; const cases: Array<[string, string]> = [ @@ -65,39 +66,40 @@ const cases: Array<[string, string]> = [ ]; for (const [fileName, sample] of cases) { - const args = [fileName, "--source"]; - const command = SolAstCompileCommand(...args); + for (const kind of PossibleCompilerKinds) { + const args = [fileName, "--compiler-kind", kind, "--source"]; + const command = SolAstCompileCommand(...args); - describe(command, () => { - let exitCode: number | null; - let outData: string; - let errData: string; + describe(command, () => { + let exitCode: number | null; + let outData: string; + let errData: string; - before(() => { - const result = SolAstCompileExec(...args); + before(() => { + const result = SolAstCompileExec(...args); - outData = result.stdout; - errData = result.stderr; - exitCode = result.status; - }); - - it("Exit code is valid", () => { - expect(exitCode).toEqual(0); - }); + outData = result.stdout; + errData = result.stderr; + exitCode = result.status; + }); - it("STDERR is empty", () => { - expect(errData).toContain(""); - }); + it("Exit code is valid", () => { + expect(exitCode).toEqual(0); + }); - it("STDOUT is correct", () => { - const result = outData.replace(new RegExp(process.cwd(), "g"), ""); + it("STDERR is empty", () => { + expect(errData).toContain(""); + }); - // Uncomment next line to update snapshots - // fse.writeFileSync(sample, result, { encoding: "utf-8" }); + it("STDOUT is correct", () => { + const content = fse.readFileSync(sample, { encoding: "utf-8" }); + const result = outData.replace(new RegExp(process.cwd(), "g"), ""); - const content = fse.readFileSync(sample, { encoding: "utf-8" }); + // Uncomment next line to update snapshots + // fse.writeFileSync(sample, result, { encoding: "utf-8" }); - expect(result).toEqual(content); + expect(result).toEqual(content); + }); }); - }); + } } diff --git a/test/integration/sol-ast-compile/stdin.spec.ts b/test/integration/sol-ast-compile/stdin.spec.ts index 115065d1..f60bf8a8 100644 --- a/test/integration/sol-ast-compile/stdin.spec.ts +++ b/test/integration/sol-ast-compile/stdin.spec.ts @@ -1,6 +1,7 @@ import { spawnSync } from "child_process"; import expect from "expect"; import fse from "fs-extra"; +import { PossibleCompilerKinds } from "../../../src"; import { SolAstCompileCommand } from "./common"; const error = @@ -15,39 +16,39 @@ const cases: Array<[string, string, number, string, string[]]> = [ ]; for (const [fileName, mode, expectedExitCode, stdErr, stdOut] of cases) { - const args = ["--stdin", "--mode", mode]; - const command = SolAstCompileCommand(...args) + " < " + fileName; - - describe(command, () => { - let exitCode: number | null; - let outData: string; - let errData: string; - - before((done) => { - const result = spawnSync("sol-ast-compile", args, { - input: fse.readFileSync(fileName), - encoding: "utf8" + for (const kind of PossibleCompilerKinds) { + const args = ["--compiler-kind", kind, "--stdin", "--mode", mode]; + const command = SolAstCompileCommand(...args) + " < " + fileName; + + describe(command, () => { + let exitCode: number | null; + let outData: string; + let errData: string; + + before(() => { + const result = spawnSync("sol-ast-compile", args, { + input: fse.readFileSync(fileName), + encoding: "utf8" + }); + + outData = result.stdout; + errData = result.stderr; + exitCode = result.status; }); - outData = result.stdout; - errData = result.stderr; - exitCode = result.status; - - done(); - }); - - it("Exit code is valid", () => { - expect(exitCode).toEqual(expectedExitCode); - }); + it("Exit code is valid", () => { + expect(exitCode).toEqual(expectedExitCode); + }); - it("STDERR is correct", () => { - expect(errData).toContain(stdErr); - }); + it("STDERR is correct", () => { + expect(errData).toContain(stdErr); + }); - it("STDOUT is correct", () => { - for (const value of stdOut) { - expect(outData).toContain(value); - } + it("STDOUT is correct", () => { + for (const value of stdOut) { + expect(outData).toContain(value); + } + }); }); - }); + } } diff --git a/test/integration/sol-ast-compile/tree.spec.ts b/test/integration/sol-ast-compile/tree.spec.ts index bb81819d..4594a5d4 100644 --- a/test/integration/sol-ast-compile/tree.spec.ts +++ b/test/integration/sol-ast-compile/tree.spec.ts @@ -1,5 +1,6 @@ import expect from "expect"; import fse from "fs-extra"; +import { PossibleCompilerKinds } from "../../../src"; import { SolAstCompileCommand, SolAstCompileExec } from "./common"; const cases = [ @@ -16,34 +17,36 @@ const cases = [ ]; for (const [sample, snapshot] of cases) { - const args = [sample, "--tree"]; - const command = SolAstCompileCommand(...args); + for (const kind of PossibleCompilerKinds) { + const args = [sample, "--compiler-kind", kind, "--tree"]; + const command = SolAstCompileCommand(...args); - describe(command, () => { - let exitCode: number | null; - let outData: string; - let errData: string; + describe(command, () => { + let exitCode: number | null; + let outData: string; + let errData: string; - before(() => { - const result = SolAstCompileExec(...args); + before(() => { + const result = SolAstCompileExec(...args); - outData = result.stdout; - errData = result.stderr; - exitCode = result.status; - }); + outData = result.stdout; + errData = result.stderr; + exitCode = result.status; + }); - it("Exit code is valid", () => { - expect(exitCode).toEqual(0); - }); + it("Exit code is valid", () => { + expect(exitCode).toEqual(0); + }); - it("STDERR is empty", () => { - expect(errData).toEqual(""); - }); + it("STDERR is empty", () => { + expect(errData).toEqual(""); + }); - it("STDOUT is correct", () => { - const snapshotData = fse.readFileSync(snapshot, { encoding: "utf8" }); + it("STDOUT is correct", () => { + const snapshotData = fse.readFileSync(snapshot, { encoding: "utf8" }); - expect(outData.replace(process.cwd(), "")).toContain(snapshotData); + expect(outData.replace(process.cwd(), "")).toContain(snapshotData); + }); }); - }); + } } diff --git a/test/integration/sol-ast-compile/version.spec.ts b/test/integration/sol-ast-compile/version.spec.ts index 71c98036..6ae3de51 100644 --- a/test/integration/sol-ast-compile/version.spec.ts +++ b/test/integration/sol-ast-compile/version.spec.ts @@ -12,14 +12,12 @@ describe(command, () => { let outData: string; let errData: string; - before((done) => { + before(() => { const result = SolAstCompileExec(...args); outData = result.stdout; errData = result.stderr; exitCode = result.status; - - done(); }); it("Exit code is valid", () => { diff --git a/test/integration/sol-ast-compile/with-source.spec.ts b/test/integration/sol-ast-compile/with-source.spec.ts index 170df84a..6c41ff01 100644 --- a/test/integration/sol-ast-compile/with-source.spec.ts +++ b/test/integration/sol-ast-compile/with-source.spec.ts @@ -1,45 +1,47 @@ import expect from "expect"; import fse from "fs-extra"; +import { PossibleCompilerKinds } from "../../../src"; import { SolAstCompileCommand, SolAstCompileExec } from "./common"; const sample = "test/samples/solidity/meta/imports/A.sol"; -const args = [sample, "--raw", "--with-sources"]; -const command = SolAstCompileCommand(...args); -describe(command, () => { - let exitCode: number | null; - let outData: string; - let errData: string; +for (const kind of PossibleCompilerKinds) { + const args = [sample, "--compiler-kind", kind, "--raw", "--with-sources"]; + const command = SolAstCompileCommand(...args); - before((done) => { - const result = SolAstCompileExec(...args); + describe(command, () => { + let exitCode: number | null; + let outData: string; + let errData: string; - outData = result.stdout; - errData = result.stderr; - exitCode = result.status; + before(() => { + const result = SolAstCompileExec(...args); - done(); - }); + outData = result.stdout; + errData = result.stderr; + exitCode = result.status; + }); - it("Exit code is valid", () => { - expect(exitCode).toEqual(0); - }); + it("Exit code is valid", () => { + expect(exitCode).toEqual(0); + }); - it("STDERR is empty", () => { - expect(errData).toEqual(""); - }); + it("STDERR is empty", () => { + expect(errData).toEqual(""); + }); - it("STDOUT is correct", () => { - const data = JSON.parse(outData); + it("STDOUT is correct", () => { + const data = JSON.parse(outData); - expect(data).toBeInstanceOf(Object); - expect(data.sources).toBeInstanceOf(Object); + expect(data).toBeInstanceOf(Object); + expect(data.sources).toBeInstanceOf(Object); - const entries: Iterable<[string, any]> = Object.entries(data.sources); - const options = { encoding: "utf-8" }; + const entries: Iterable<[string, any]> = Object.entries(data.sources); + const options = { encoding: "utf-8" }; - for (const [key, entry] of entries) { - expect(entry.source).toEqual(fse.readFileSync(key, options)); - } + for (const [key, entry] of entries) { + expect(entry.source).toEqual(fse.readFileSync(key, options)); + } + }); }); -}); +} diff --git a/test/integration/sol-ast-compile/xpath/contract_definitions.spec.ts b/test/integration/sol-ast-compile/xpath/contract_definitions.spec.ts index 2f6971dd..9a800832 100644 --- a/test/integration/sol-ast-compile/xpath/contract_definitions.spec.ts +++ b/test/integration/sol-ast-compile/xpath/contract_definitions.spec.ts @@ -1,53 +1,55 @@ import expect from "expect"; +import { PossibleCompilerKinds } from "../../../../src"; import { SolAstCompileCommand, SolAstCompileExec } from "../common"; const sample = "test/samples/solidity/reports/A.sol"; -const selector = "//ContractDefinition"; -const args = [sample, "--xpath", selector, "--depth", "0"]; -const command = SolAstCompileCommand(...args); -describe(command, () => { - let exitCode: number | null; - let outData: string; - let errData: string; - - before((done) => { - const result = SolAstCompileExec(...args); - - outData = result.stdout; - errData = result.stderr; - exitCode = result.status; - - done(); - }); - - it("Exit code is valid", () => { - expect(exitCode).toEqual(0); - }); - - it("STDERR is empty", () => { - expect(errData).toEqual(""); - }); - - it("STDOUT is correct", () => { - expect(outData).toContain("ContractDefinition #8"); - expect(outData).toContain("id: 8"); - expect(outData).toContain('src: "45:33:0"'); - expect(outData).toContain('type: "ContractDefinition"'); - expect(outData).toContain('name: "A"'); - expect(outData).toContain("vScope: SourceUnit #9"); - expect(outData).toContain("linearizedBaseContracts: Array(2) [ 8, 14 ]"); - - expect(outData).toContain("ContractDefinition #14"); - expect(outData).toContain("id: 14"); - expect(outData).toContain('src: "27:28:1"'); - expect(outData).toContain('type: "ContractDefinition"'); - expect(outData).toContain('name: "B"'); - expect(outData).toContain("vScope: SourceUnit #15"); - expect(outData).toContain("linearizedBaseContracts: Array(1) [ 14 ]"); - - expect(outData).not.toContain("id: 3"); - expect(outData).not.toContain("id: 7"); - expect(outData).not.toContain("id: 13"); +for (const kind of PossibleCompilerKinds) { + const selector = "//ContractDefinition"; + const args = [sample, "--compiler-kind", kind, "--xpath", selector, "--depth", "0"]; + const command = SolAstCompileCommand(...args); + + describe(command, () => { + let exitCode: number | null; + let outData: string; + let errData: string; + + before(() => { + const result = SolAstCompileExec(...args); + + outData = result.stdout; + errData = result.stderr; + exitCode = result.status; + }); + + it("Exit code is valid", () => { + expect(exitCode).toEqual(0); + }); + + it("STDERR is empty", () => { + expect(errData).toEqual(""); + }); + + it("STDOUT is correct", () => { + expect(outData).toContain("ContractDefinition #8"); + expect(outData).toContain("id: 8"); + expect(outData).toContain('src: "45:33:0"'); + expect(outData).toContain('type: "ContractDefinition"'); + expect(outData).toContain('name: "A"'); + expect(outData).toContain("vScope: SourceUnit #9"); + expect(outData).toContain("linearizedBaseContracts: Array(2) [ 8, 14 ]"); + + expect(outData).toContain("ContractDefinition #14"); + expect(outData).toContain("id: 14"); + expect(outData).toContain('src: "27:28:1"'); + expect(outData).toContain('type: "ContractDefinition"'); + expect(outData).toContain('name: "B"'); + expect(outData).toContain("vScope: SourceUnit #15"); + expect(outData).toContain("linearizedBaseContracts: Array(1) [ 14 ]"); + + expect(outData).not.toContain("id: 3"); + expect(outData).not.toContain("id: 7"); + expect(outData).not.toContain("id: 13"); + }); }); -}); +} diff --git a/test/integration/sol-ast-compile/xpath/contract_names.spec.ts b/test/integration/sol-ast-compile/xpath/contract_names.spec.ts index b461d8ba..841cb947 100644 --- a/test/integration/sol-ast-compile/xpath/contract_names.spec.ts +++ b/test/integration/sol-ast-compile/xpath/contract_names.spec.ts @@ -1,36 +1,38 @@ import expect from "expect"; +import { PossibleCompilerKinds } from "../../../../src"; import { SolAstCompileCommand, SolAstCompileExec } from "../common"; const sample = "test/samples/solidity/reports/A.sol"; -const selector = "//ContractDefinition/@name"; -const args = [sample, "--xpath", selector]; -const command = SolAstCompileCommand(...args); -describe(command, () => { - let exitCode: number | null; - let outData: string; - let errData: string; +for (const kind of PossibleCompilerKinds) { + const selector = "//ContractDefinition/@name"; + const args = [sample, "--compiler-kind", kind, "--xpath", selector]; + const command = SolAstCompileCommand(...args); - before((done) => { - const result = SolAstCompileExec(...args); + describe(command, () => { + let exitCode: number | null; + let outData: string; + let errData: string; - outData = result.stdout; - errData = result.stderr; - exitCode = result.status; + before(() => { + const result = SolAstCompileExec(...args); - done(); - }); + outData = result.stdout; + errData = result.stderr; + exitCode = result.status; + }); - it("Exit code is valid", () => { - expect(exitCode).toEqual(0); - }); + it("Exit code is valid", () => { + expect(exitCode).toEqual(0); + }); - it("STDERR is empty", () => { - expect(errData).toEqual(""); - }); + it("STDERR is empty", () => { + expect(errData).toEqual(""); + }); - it("STDOUT is correct", () => { - expect(outData).toContain("A"); - expect(outData).toContain("B"); + it("STDOUT is correct", () => { + expect(outData).toContain("A"); + expect(outData).toContain("B"); + }); }); -}); +} diff --git a/test/integration/sol-ast-compile/xpath/is_custom_function.spec.ts b/test/integration/sol-ast-compile/xpath/is_custom_function.spec.ts index 6360bb7a..b74f1c00 100644 --- a/test/integration/sol-ast-compile/xpath/is_custom_function.spec.ts +++ b/test/integration/sol-ast-compile/xpath/is_custom_function.spec.ts @@ -1,53 +1,55 @@ import expect from "expect"; +import { PossibleCompilerKinds } from "../../../../src"; import { SolAstCompileCommand, SolAstCompileExec } from "../common"; const sample = "test/samples/solidity/latest_06.sol"; -const selector = "//*[is(@abstract)]/@id"; -const args = [sample, "--xpath", selector, "--depth", "0"]; -const command = SolAstCompileCommand(...args); -describe(command, () => { - let exitCode: number | null; - let outData: string; - let errData: string; - - before((done) => { - const result = SolAstCompileExec(...args); - - outData = result.stdout; - errData = result.stderr; - exitCode = result.status; - - done(); - }); - - it("Exit code is valid", () => { - expect(exitCode).toEqual(0); - }); - - it("STDERR is empty", () => { - expect(errData).toEqual(""); - }); - - it("STDOUT is correct", () => { - const contracts = new Map([ - ["42", false], - ["51", false], - ["76", true], - ["78", false], - ["83", false], - ["521", false], - ["646", false], - ["652", false], - ["663", false] - ]); - - for (const [id, occurance] of contracts.entries()) { - if (occurance) { - expect(outData).toContain(id); - } else { - expect(outData).not.toContain(id); +for (const kind of PossibleCompilerKinds) { + const selector = "//*[is(@abstract)]/@id"; + const args = [sample, "--compiler-kind", kind, "--xpath", selector, "--depth", "0"]; + const command = SolAstCompileCommand(...args); + + describe(command, () => { + let exitCode: number | null; + let outData: string; + let errData: string; + + before(() => { + const result = SolAstCompileExec(...args); + + outData = result.stdout; + errData = result.stderr; + exitCode = result.status; + }); + + it("Exit code is valid", () => { + expect(exitCode).toEqual(0); + }); + + it("STDERR is empty", () => { + expect(errData).toEqual(""); + }); + + it("STDOUT is correct", () => { + const contracts = new Map([ + ["42", false], + ["51", false], + ["76", true], + ["78", false], + ["83", false], + ["521", false], + ["646", false], + ["652", false], + ["663", false] + ]); + + for (const [id, occurance] of contracts.entries()) { + if (occurance) { + expect(outData).toContain(id); + } else { + expect(outData).not.toContain(id); + } } - } + }); }); -}); +} diff --git a/test/integration/sol-ast-compile/xpath/struct_doc_recovery.spec.ts b/test/integration/sol-ast-compile/xpath/struct_doc_recovery.spec.ts index 69738036..f6458109 100644 --- a/test/integration/sol-ast-compile/xpath/struct_doc_recovery.spec.ts +++ b/test/integration/sol-ast-compile/xpath/struct_doc_recovery.spec.ts @@ -1,58 +1,69 @@ import expect from "expect"; +import { PossibleCompilerKinds } from "../../../../src"; import { SolAstCompileCommand, SolAstCompileExec } from "../common"; const sample = "test/samples/solidity/struct_doc_recovery.sol"; -const selector = '//StructuredDocumentation/@*[name()="src" or name()="text"]'; -const args = [sample, "--compiler-version", "0.4.24", "--xpath", selector]; -const command = SolAstCompileCommand(...args); -describe(command, () => { - let exitCode: number | null; - let outData: string; - let errData: string; +for (const kind of PossibleCompilerKinds) { + const selector = '//StructuredDocumentation/@*[name()="src" or name()="text"]'; + const args = [ + sample, + "--compiler-kind", + kind, + "--compiler-version", + "0.4.24", + "--xpath", + selector + ]; - before((done) => { - const result = SolAstCompileExec(...args); + const command = SolAstCompileCommand(...args); - outData = result.stdout; - errData = result.stderr; - exitCode = result.status; + describe(command, () => { + let exitCode: number | null; + let outData: string; + let errData: string; - done(); - }); + before(() => { + const result = SolAstCompileExec(...args); - it("Exit code is valid", () => { - expect(exitCode).toEqual(0); - }); + outData = result.stdout; + errData = result.stderr; + exitCode = result.status; + }); - it("STDERR is empty", () => { - expect(errData).toEqual(""); - }); + it("Exit code is valid", () => { + expect(exitCode).toEqual(0); + }); + + it("STDERR is empty", () => { + expect(errData).toEqual(""); + }); + + it("STDOUT is correct", () => { + const cases: Array<[string, string]> = [ + ["X\\nY\\nZ", "4:37:0"], + ["C", "85:5:0"], + ["A", "122:5:0"], + ["B", "184:20:0"], + ["A\\nB", "235:15:0"], + ["B", "291:20:0"], + ["C", "458:5:0"], + ["A", "482:5:0"], + ["B", "532:20:0"], + ["A\\nB", "571:15:0"], + ["B", "615:20:0"], + ["C", "746:5:0"], + ["A", "788:5:0"], + ["B", "855:20:0"], + ["A\\nB", "911:15:0"], + ["B", "972:20:0"] + ]; + + for (const [src, text] of cases) { + const sample = `"${src}"\n"${text}"`; - it("STDOUT is correct", () => { - const cases: Array<[string, string]> = [ - ["X\\nY\\nZ", "4:37:0"], - ["C", "85:5:0"], - ["A", "122:5:0"], - ["B", "184:20:0"], - ["A\\nB", "235:15:0"], - ["B", "291:20:0"], - ["C", "458:5:0"], - ["A", "482:5:0"], - ["B", "532:20:0"], - ["A\\nB", "571:15:0"], - ["B", "615:20:0"], - ["C", "746:5:0"], - ["A", "788:5:0"], - ["B", "855:20:0"], - ["A\\nB", "911:15:0"], - ["B", "972:20:0"] - ]; - - for (const [src, text] of cases) { - const sample = `"${src}"\n"${text}"`; - - expect(outData).toContain(sample); - } + expect(outData).toContain(sample); + } + }); }); -}); +} diff --git a/test/integration/sol-ast-compile/xpath/variables_count.spec.ts b/test/integration/sol-ast-compile/xpath/variables_count.spec.ts index 57c5686a..462611f2 100644 --- a/test/integration/sol-ast-compile/xpath/variables_count.spec.ts +++ b/test/integration/sol-ast-compile/xpath/variables_count.spec.ts @@ -1,43 +1,45 @@ import expect from "expect"; +import { PossibleCompilerKinds } from "../../../../src"; import { separator, SolAstCompileCommand, SolAstCompileExec } from "../common"; const sample = "test/samples/solidity/reports/A.sol"; -const selector = "count(//VariableDeclaration)"; -const args = [sample, "--xpath", selector]; -const command = SolAstCompileCommand(...args); -describe(command, () => { - let exitCode: number | null; - let outData: string; - let errData: string; +for (const kind of PossibleCompilerKinds) { + const selector = "count(//VariableDeclaration)"; + const args = [sample, "--compiler-kind", kind, "--xpath", selector]; + const command = SolAstCompileCommand(...args); - before((done) => { - const result = SolAstCompileExec(...args); + describe(command, () => { + let exitCode: number | null; + let outData: string; + let errData: string; - outData = result.stdout; - errData = result.stderr; - exitCode = result.status; + before(() => { + const result = SolAstCompileExec(...args); - done(); - }); + outData = result.stdout; + errData = result.stderr; + exitCode = result.status; + }); - it("Exit code is valid", () => { - expect(exitCode).toEqual(0); - }); + it("Exit code is valid", () => { + expect(exitCode).toEqual(0); + }); - it("STDERR is empty", () => { - expect(errData).toEqual(""); - }); + it("STDERR is empty", () => { + expect(errData).toEqual(""); + }); - it("STDOUT is correct", () => { - const parts = outData.split("\n"); + it("STDOUT is correct", () => { + const parts = outData.split("\n"); - expect(parts[0].endsWith("A.sol")).toEqual(true); - expect(parts[1]).toEqual(separator); - expect(parts[2]).toEqual("1"); + expect(parts[0].endsWith("A.sol")).toEqual(true); + expect(parts[1]).toEqual(separator); + expect(parts[2]).toEqual("1"); - expect(parts[3].endsWith("B.sol")).toEqual(true); - expect(parts[4]).toEqual(separator); - expect(parts[5]).toEqual("1"); + expect(parts[3].endsWith("B.sol")).toEqual(true); + expect(parts[4]).toEqual(separator); + expect(parts[5]).toEqual("1"); + }); }); -}); +} diff --git a/test/integration/sol-ast-compile/xpath/variables_of_specific_contract.spec.ts b/test/integration/sol-ast-compile/xpath/variables_of_specific_contract.spec.ts index e6b5acfc..25f74b17 100644 --- a/test/integration/sol-ast-compile/xpath/variables_of_specific_contract.spec.ts +++ b/test/integration/sol-ast-compile/xpath/variables_of_specific_contract.spec.ts @@ -1,52 +1,54 @@ import expect from "expect"; +import { PossibleCompilerKinds } from "../../../../src"; import { SolAstCompileCommand, SolAstCompileExec } from "../common"; const sample = "test/samples/solidity/reports/A.sol"; -const selector = '//ContractDefinition[@name="A"]//VariableDeclaration'; -const args = [sample, "--xpath", selector, "--depth", "100"]; -const command = SolAstCompileCommand(...args); -describe(command, () => { - let exitCode: number | null; - let outData: string; - let errData: string; - - before((done) => { - const result = SolAstCompileExec(...args); - - outData = result.stdout; - errData = result.stderr; - exitCode = result.status; - - done(); - }); - - it("Exit code is valid", () => { - expect(exitCode).toEqual(0); - }); - - it("STDERR is empty", () => { - expect(errData).toEqual(""); - }); - - it("STDOUT is correct", () => { - expect(outData).toContain("VariableDeclaration #7"); - expect(outData).toContain("id: 7"); - expect(outData).toContain('src: "64:10:0"'); - expect(outData).toContain('type: "VariableDeclaration"'); - expect(outData).toContain('name: "a"'); - - expect(outData).toContain("ElementaryTypeName #5"); - expect(outData).toContain("id: 5"); - expect(outData).toContain('src: "64:4:0"'); - expect(outData).toContain('type: "ElementaryTypeName"'); - expect(outData).toContain('typeString: "uint256"'); - expect(outData).toContain("constant: false"); - - expect(outData).toContain("Literal #6"); - expect(outData).toContain("id: 6"); - expect(outData).toContain('src: "73:1:0"'); - expect(outData).toContain('kind: "number"'); - expect(outData).toContain('value: "1"'); +for (const kind of PossibleCompilerKinds) { + const selector = '//ContractDefinition[@name="A"]//VariableDeclaration'; + const args = [sample, "--compiler-kind", kind, "--xpath", selector, "--depth", "100"]; + const command = SolAstCompileCommand(...args); + + describe(command, () => { + let exitCode: number | null; + let outData: string; + let errData: string; + + before(() => { + const result = SolAstCompileExec(...args); + + outData = result.stdout; + errData = result.stderr; + exitCode = result.status; + }); + + it("Exit code is valid", () => { + expect(exitCode).toEqual(0); + }); + + it("STDERR is empty", () => { + expect(errData).toEqual(""); + }); + + it("STDOUT is correct", () => { + expect(outData).toContain("VariableDeclaration #7"); + expect(outData).toContain("id: 7"); + expect(outData).toContain('src: "64:10:0"'); + expect(outData).toContain('type: "VariableDeclaration"'); + expect(outData).toContain('name: "a"'); + + expect(outData).toContain("ElementaryTypeName #5"); + expect(outData).toContain("id: 5"); + expect(outData).toContain('src: "64:4:0"'); + expect(outData).toContain('type: "ElementaryTypeName"'); + expect(outData).toContain('typeString: "uint256"'); + expect(outData).toContain("constant: false"); + + expect(outData).toContain("Literal #6"); + expect(outData).toContain("id: 6"); + expect(outData).toContain('src: "73:1:0"'); + expect(outData).toContain('kind: "number"'); + expect(outData).toContain('value: "1"'); + }); }); -}); +} diff --git a/test/integration/sourcemap/snapshot.spec.ts b/test/integration/sourcemap/snapshot.spec.ts index d3ce0246..b1741fc6 100644 --- a/test/integration/sourcemap/snapshot.spec.ts +++ b/test/integration/sourcemap/snapshot.spec.ts @@ -4,9 +4,11 @@ import { ASTNode, ASTReader, ASTWriter, + CompilerKind, compileSol, DefaultASTWriterMapping, LatestCompilerVersion, + PossibleCompilerKinds, PrettyFormatter, SourceUnit } from "../../../src"; @@ -24,49 +26,62 @@ const cases: Array<[string, string]> = [ describe("Source map snapshot tests", () => { for (const [fileName, sample] of cases) { - describe(fileName, () => { - let units: SourceUnit[]; - let compilerVersion: string; + for (const kind of PossibleCompilerKinds) { + describe(`[${kind}] ${fileName}`, () => { + let units: SourceUnit[]; + let compilerVersion: string; - before(() => { - const reader = new ASTReader(); - const result = compileSol(fileName, "auto", []); + before(async () => { + const reader = new ASTReader(); + const result = await compileSol( + fileName, + "auto", + [], + undefined, + undefined, + kind as CompilerKind + ); - compilerVersion = - result.compilerVersion === undefined - ? LatestCompilerVersion - : result.compilerVersion; + compilerVersion = + result.compilerVersion === undefined + ? LatestCompilerVersion + : result.compilerVersion; - units = reader.read(result.data); + units = reader.read(result.data); - expect(units.length).toBeGreaterThan(0); - }); + expect(units.length).toBeGreaterThan(0); + }); - it(`Matches expected output sample "${sample}"`, () => { - const formatter = new PrettyFormatter(4, 0); - const writer = new ASTWriter(DefaultASTWriterMapping, formatter, compilerVersion); + it(`Matches expected output sample "${sample}"`, () => { + const formatter = new PrettyFormatter(4, 0); + const writer = new ASTWriter( + DefaultASTWriterMapping, + formatter, + compilerVersion + ); - const parts = []; + const parts = []; - for (const unit of units) { - const sourceMap = new Map(); - const source = writer.write(unit, sourceMap); + for (const unit of units) { + const sourceMap = new Map(); + const source = writer.write(unit, sourceMap); - parts.push(source); + parts.push(source); - for (const [node, [offset, length]] of sourceMap.entries()) { - const nodeStr = node.type + "#" + node.id + " (" + node.src + ")"; - const coordsStr = offset + ":" + length + ":" + unit.sourceListIndex; + for (const [node, [offset, length]] of sourceMap.entries()) { + const nodeStr = node.type + "#" + node.id + " (" + node.src + ")"; + const coordsStr = offset + ":" + length + ":" + unit.sourceListIndex; - parts.push("// " + nodeStr + " -> " + coordsStr); + parts.push("// " + nodeStr + " -> " + coordsStr); + } } - } - const result = parts.join("\n") + "\n"; - const expectation = fse.readFileSync(sample, { encoding: "utf-8" }); + const result = parts.join("\n") + "\n"; + const expectation = fse.readFileSync(sample, { encoding: "utf-8" }); - expect(result).toEqual(expectation); + expect(result).toEqual(expectation); + }); }); - }); + } } }); diff --git a/test/integration/sourcemap/solc_comparison.spec.ts b/test/integration/sourcemap/solc_comparison.spec.ts index 2208a089..fa0549bb 100644 --- a/test/integration/sourcemap/solc_comparison.spec.ts +++ b/test/integration/sourcemap/solc_comparison.spec.ts @@ -3,6 +3,7 @@ import { ASTNode, ASTReader, ASTWriter, + CompilerKind, compileSol, compileSourceString, ContractDefinition, @@ -14,18 +15,23 @@ import { FunctionTypeName, ModifierDefinition, ParameterList, + PossibleCompilerKinds, PrettyFormatter, SourceUnit, VariableDeclaration } from "../../../src"; -function readAST(fileName: string, version: string, source?: string): SourceUnit[] { +async function readAST( + fileName: string, + version: string, + compilerKind: CompilerKind, + source?: string +): Promise { const reader = new ASTReader(); - const result = - source === undefined - ? compileSol(fileName, version, []) - : compileSourceString(fileName, source, version, []); + const result = await (source === undefined + ? compileSol(fileName, version, [], undefined, undefined, compilerKind) + : compileSourceString(fileName, source, version, [], undefined, undefined, compilerKind)); return reader.read(result.data); } @@ -67,86 +73,94 @@ const samples = [ ]; for (const [sample, version] of samples) { - describe(`Check mappings of ${sample} (version ${version})`, () => { - const units = readAST(sample, version); - - /** - * Remove StructuredDoumentation nodes due to unstable behavior, - * related to compiler bugs. - */ - removeStructuredDocumentationNodes(units); - - const [writtenSource] = writeAST(units, version); - - const writtenUnits = readAST(sample, version, writtenSource); - const [, sourceMap] = writeAST(writtenUnits, version); - - for (const unit of writtenUnits) { - for (const node of unit.getChildren(true)) { - const sourceInfo = node.sourceInfo; - - const solcStart = sourceInfo.offset; - const solcLen = sourceInfo.length; - - if (!sourceMap.has(node)) { - it(`Missing node ${node.type}#${node.id} must be an empty parameter list`, () => { - expect(node.type).toEqual("ParameterList"); - expect((node as ParameterList).vParameters.length).toEqual(0); - }); - - continue; - } - - const [compStart, compLen] = sourceMap.get(node) as [number, number]; - - /** - * Skip nodes without written source. - * Usually these nodes are empty return `ParameterList`s. - */ - if (solcLen === compLen && solcLen === 0) { - continue; - } - - const solcCoords = solcStart + ":" + solcLen; - const compCoords = compStart + ":" + compLen; - - const solcFragment = getSourceFragment(solcStart, solcLen, writtenSource); - const compFragment = getSourceFragment(compStart, compLen, writtenSource); - - if (compFragment === solcFragment && compCoords === solcCoords) { - continue; + for (const kind of PossibleCompilerKinds) { + describe(`Check mappings of ${sample} (version ${version}, kind ${kind})`, async () => { + const units = await readAST(sample, version, kind as CompilerKind); + + /** + * Remove StructuredDoumentation nodes due to unstable behavior, + * related to compiler bugs. + */ + removeStructuredDocumentationNodes(units); + + const [writtenSource] = writeAST(units, version); + + const writtenUnits = await readAST( + sample, + version, + kind as CompilerKind, + writtenSource + ); + + const [, sourceMap] = writeAST(writtenUnits, version); + + for (const unit of writtenUnits) { + for (const node of unit.getChildren(true)) { + const sourceInfo = node.sourceInfo; + + const solcStart = sourceInfo.offset; + const solcLen = sourceInfo.length; + + if (!sourceMap.has(node)) { + it(`Missing node ${node.type}#${node.id} must be an empty parameter list`, () => { + expect(node.type).toEqual("ParameterList"); + expect((node as ParameterList).vParameters.length).toEqual(0); + }); + + continue; + } + + const [compStart, compLen] = sourceMap.get(node) as [number, number]; + + /** + * Skip nodes without written source. + * Usually these nodes are empty return `ParameterList`s. + */ + if (solcLen === compLen && solcLen === 0) { + continue; + } + + const solcCoords = solcStart + ":" + solcLen; + const compCoords = compStart + ":" + compLen; + + const solcFragment = getSourceFragment(solcStart, solcLen, writtenSource); + const compFragment = getSourceFragment(compStart, compLen, writtenSource); + + if (compFragment === solcFragment && compCoords === solcCoords) { + continue; + } + + /** + * Known edge cases where we differ from solc + * + * Edge-case with typecast to `address payable` + */ + if ( + (node instanceof ElementaryTypeNameExpression || + node instanceof ElementaryTypeName) && + compFragment === "payable" && + solcFragment === "payable(" + ) { + continue; + } + + /** + * Edge-case with function typenames + */ + if (node instanceof FunctionTypeName) { + continue; + } + + console.log(`------ Solc ------ [${solcCoords}]`); + console.log(solcFragment); + console.log(`---- Computed ---- [${compCoords}]`); + console.log(compFragment); + console.log("------------------"); + + expect(compCoords).toEqual(solcCoords); + expect(compFragment).toEqual(solcFragment); } - - /** - * Known edge cases where we differ from solc - * - * Edge-case with typecast to `address payable` - */ - if ( - (node instanceof ElementaryTypeNameExpression || - node instanceof ElementaryTypeName) && - compFragment === "payable" && - solcFragment === "payable(" - ) { - continue; - } - - /** - * Edge-case with function typenames - */ - if (node instanceof FunctionTypeName) { - continue; - } - - console.log(`------ Solc ------ [${solcCoords}]`); - console.log(solcFragment); - console.log(`---- Computed ---- [${compCoords}]`); - console.log(compFragment); - console.log("------------------"); - - expect(compCoords).toEqual(solcCoords); - expect(compFragment).toEqual(solcFragment); } - } - }); + }); + } } diff --git a/test/samples/json/code_main_source.json b/test/samples/json/code_main_source.json index 5dbecbb1..8d8a1f0b 100644 --- a/test/samples/json/code_main_source.json +++ b/test/samples/json/code_main_source.json @@ -1,5 +1,4 @@ { - "mainSource": "./test/sol_files/json_code/B.sol", "sources": { "./test/sol_files/json_code/A.sol": { "source": "contract A {\n uint8 test;\n}\n" diff --git a/test/samples/json/code_main_source_invalid.json b/test/samples/json/code_main_source_invalid.json deleted file mode 100644 index 897fbb2d..00000000 --- a/test/samples/json/code_main_source_invalid.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "mainSource": "./test/sol_files/json_code/X.sol", - "sources": { - "./test/sol_files/json_code/A.sol": { - "source": "contract A {\n uint8 test;\n}\n" - }, - "./test/sol_files/json_code/B.sol": { - "source": "import './A.sol';\n\ncontract B {\n int16 test;\n}\n" - } - } -} diff --git a/test/samples/solidity/declarations/contract_050.nodes.txt b/test/samples/solidity/declarations/contract_050.nodes.native.txt similarity index 100% rename from test/samples/solidity/declarations/contract_050.nodes.txt rename to test/samples/solidity/declarations/contract_050.nodes.native.txt diff --git a/test/samples/solidity/declarations/contract_050.nodes.wasm.txt b/test/samples/solidity/declarations/contract_050.nodes.wasm.txt new file mode 100644 index 00000000..577c7138 --- /dev/null +++ b/test/samples/solidity/declarations/contract_050.nodes.wasm.txt @@ -0,0 +1,1534 @@ +SourceUnit #146 + id: 146 + src: "0:0:0" + sourceEntryKey: "./test/samples/solidity/declarations/contract_050.sol" + sourceListIndex: 0 + absolutePath: "./test/samples/solidity/declarations/contract_050.sol" + exportedSymbols: Map(3) { "A" -> 90, "B" -> 100, "C" -> 145 } + context: ASTContext #1000 + vPragmaDirectives: Array(0) + vImportDirectives: Array(0) + vContracts: Array(3) [ ContractDefinition #90, ContractDefinition #100, ContractDefinition #145 ] + vEnums: Array(0) + vErrors: Array(0) + vStructs: Array(0) + vFunctions: Array(0) + vVariables: Array(0) + vUserDefinedValueTypes: Array(0) + vExportedSymbols: Map(3) { "A" -> ContractDefinition #90, "B" -> ContractDefinition #100, "C" -> ContractDefinition #145 } + children: Array(3) [ ContractDefinition #90, ContractDefinition #100, ContractDefinition #145 ] + type: "SourceUnit" + firstChild: ContractDefinition #90 + lastChild: ContractDefinition #145 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ContractDefinition #90 + id: 90 + src: "0:0:0" + name: "A" + scope: 146 + kind: "library" + abstract: false + fullyImplemented: true + linearizedBaseContracts: Array(1) [ 90 ] + usedErrors: Array(0) + docString: undefined + nameLocation: undefined + context: ASTContext #1000 + parent: SourceUnit #146 + documentation: undefined + vScope: SourceUnit #146 + vLinearizedBaseContracts: Array(1) [ ContractDefinition #90 ] + vUsedErrors: Array(0) + vInheritanceSpecifiers: Array(0) + vStateVariables: Array(0) + vModifiers: Array(0) + vEvents: Array(0) + vErrors: Array(0) + vFunctions: Array(1) [ FunctionDefinition #89 ] + vUsingForDirectives: Array(0) + vStructs: Array(0) + vEnums: Array(0) + vUserDefinedValueTypes: Array(0) + vConstructor: undefined + children: Array(1) [ FunctionDefinition #89 ] + type: "ContractDefinition" + firstChild: FunctionDefinition #89 + lastChild: FunctionDefinition #89 + previousSibling: undefined + nextSibling: ContractDefinition #100 + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionDefinition #89 + id: 89 + src: "0:0:0" + implemented: true + virtual: false + scope: 90 + kind: "function" + name: "add" + visibility: "public" + stateMutability: "nonpayable" + isConstructor: false + documentation: undefined + nameLocation: undefined + vParameters: ParameterList #78 + vReturnParameters: ParameterList #81 + vModifiers: Array(0) + vOverrideSpecifier: undefined + vBody: Block #88 + context: ASTContext #1000 + parent: ContractDefinition #90 + children: Array(3) [ ParameterList #78, ParameterList #81, Block #88 ] + vScope: ContractDefinition #90 + type: "FunctionDefinition" + firstChild: ParameterList #78 + lastChild: Block #88 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #78 + id: 78 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #89 + vParameters: Array(2) [ VariableDeclaration #75, VariableDeclaration #77 ] + children: Array(2) [ VariableDeclaration #75, VariableDeclaration #77 ] + type: "ParameterList" + firstChild: VariableDeclaration #75 + lastChild: VariableDeclaration #77 + previousSibling: undefined + nextSibling: ParameterList #81 + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #75 + id: 75 + src: "0:0:0" + constant: false + indexed: false + name: "a" + scope: 89 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "uint256" + documentation: undefined + nameLocation: undefined + vType: ElementaryTypeName #74 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: ParameterList #78 + children: Array(1) [ ElementaryTypeName #74 ] + vScope: FunctionDefinition #89 + type: "VariableDeclaration" + firstChild: ElementaryTypeName #74 + lastChild: ElementaryTypeName #74 + previousSibling: undefined + nextSibling: VariableDeclaration #77 + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #74 + id: 74 + src: "0:0:0" + typeString: "uint256" + name: "uint" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: VariableDeclaration #75 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #77 + id: 77 + src: "0:0:0" + constant: false + indexed: false + name: "b" + scope: 89 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "uint256" + documentation: undefined + nameLocation: undefined + vType: ElementaryTypeName #76 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: ParameterList #78 + children: Array(1) [ ElementaryTypeName #76 ] + vScope: FunctionDefinition #89 + type: "VariableDeclaration" + firstChild: ElementaryTypeName #76 + lastChild: ElementaryTypeName #76 + previousSibling: VariableDeclaration #75 + nextSibling: undefined + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #76 + id: 76 + src: "0:0:0" + typeString: "uint256" + name: "uint" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: VariableDeclaration #77 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #81 + id: 81 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #89 + vParameters: Array(1) [ VariableDeclaration #80 ] + children: Array(1) [ VariableDeclaration #80 ] + type: "ParameterList" + firstChild: VariableDeclaration #80 + lastChild: VariableDeclaration #80 + previousSibling: ParameterList #78 + nextSibling: Block #88 + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #80 + id: 80 + src: "0:0:0" + constant: false + indexed: false + name: "c" + scope: 89 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "uint256" + documentation: undefined + nameLocation: undefined + vType: ElementaryTypeName #79 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: ParameterList #81 + children: Array(1) [ ElementaryTypeName #79 ] + vScope: FunctionDefinition #89 + type: "VariableDeclaration" + firstChild: ElementaryTypeName #79 + lastChild: ElementaryTypeName #79 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #79 + id: 79 + src: "0:0:0" + typeString: "uint256" + name: "uint" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: VariableDeclaration #80 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Block #88 + id: 88 + src: "0:0:0" + documentation: undefined + context: ASTContext #1000 + parent: FunctionDefinition #89 + vStatements: Array(1) [ ExpressionStatement #87 ] + children: Array(1) [ ExpressionStatement #87 ] + type: "Block" + firstChild: ExpressionStatement #87 + lastChild: ExpressionStatement #87 + previousSibling: ParameterList #81 + nextSibling: undefined + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ExpressionStatement #87 + id: 87 + src: "0:0:0" + documentation: undefined + vExpression: Assignment #86 + context: ASTContext #1000 + parent: Block #88 + children: Array(1) [ Assignment #86 ] + type: "ExpressionStatement" + firstChild: Assignment #86 + lastChild: Assignment #86 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Assignment #86 + id: 86 + src: "0:0:0" + typeString: "uint256" + operator: "=" + vLeftHandSide: Identifier #82 + vRightHandSide: BinaryOperation #85 + context: ASTContext #1000 + parent: ExpressionStatement #87 + children: Array(2) [ Identifier #82, BinaryOperation #85 ] + type: "Assignment" + firstChild: Identifier #82 + lastChild: BinaryOperation #85 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #82 + id: 82 + src: "0:0:0" + typeString: "uint256" + name: "c" + referencedDeclaration: 80 + context: ASTContext #1000 + parent: Assignment #86 + vReferencedDeclaration: VariableDeclaration #80 + vIdentifierType: "userDefined" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: BinaryOperation #85 + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + BinaryOperation #85 + id: 85 + src: "0:0:0" + typeString: "uint256" + operator: "+" + vLeftExpression: Identifier #83 + vRightExpression: Identifier #84 + context: ASTContext #1000 + parent: Assignment #86 + children: Array(2) [ Identifier #83, Identifier #84 ] + type: "BinaryOperation" + firstChild: Identifier #83 + lastChild: Identifier #84 + previousSibling: Identifier #82 + nextSibling: undefined + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #83 + id: 83 + src: "0:0:0" + typeString: "uint256" + name: "a" + referencedDeclaration: 75 + context: ASTContext #1000 + parent: BinaryOperation #85 + vReferencedDeclaration: VariableDeclaration #75 + vIdentifierType: "userDefined" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: Identifier #84 + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #84 + id: 84 + src: "0:0:0" + typeString: "uint256" + name: "b" + referencedDeclaration: 77 + context: ASTContext #1000 + parent: BinaryOperation #85 + vReferencedDeclaration: VariableDeclaration #77 + vIdentifierType: "userDefined" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: Identifier #83 + nextSibling: undefined + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ContractDefinition #100 + id: 100 + src: "0:0:0" + name: "B" + scope: 146 + kind: "interface" + abstract: false + fullyImplemented: false + linearizedBaseContracts: Array(1) [ 100 ] + usedErrors: Array(0) + docString: undefined + nameLocation: undefined + context: ASTContext #1000 + parent: SourceUnit #146 + documentation: undefined + vScope: SourceUnit #146 + vLinearizedBaseContracts: Array(1) [ ContractDefinition #100 ] + vUsedErrors: Array(0) + vInheritanceSpecifiers: Array(0) + vStateVariables: Array(0) + vModifiers: Array(0) + vEvents: Array(0) + vErrors: Array(0) + vFunctions: Array(1) [ FunctionDefinition #99 ] + vUsingForDirectives: Array(0) + vStructs: Array(0) + vEnums: Array(0) + vUserDefinedValueTypes: Array(0) + vConstructor: undefined + children: Array(1) [ FunctionDefinition #99 ] + type: "ContractDefinition" + firstChild: FunctionDefinition #99 + lastChild: FunctionDefinition #99 + previousSibling: ContractDefinition #90 + nextSibling: ContractDefinition #145 + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionDefinition #99 + id: 99 + src: "0:0:0" + implemented: false + virtual: false + scope: 100 + kind: "function" + name: "some" + visibility: "external" + stateMutability: "nonpayable" + isConstructor: false + documentation: undefined + nameLocation: undefined + vParameters: ParameterList #95 + vReturnParameters: ParameterList #98 + vModifiers: Array(0) + vOverrideSpecifier: undefined + vBody: undefined + context: ASTContext #1000 + parent: ContractDefinition #100 + children: Array(2) [ ParameterList #95, ParameterList #98 ] + vScope: ContractDefinition #100 + type: "FunctionDefinition" + firstChild: ParameterList #95 + lastChild: ParameterList #98 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #95 + id: 95 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #99 + vParameters: Array(2) [ VariableDeclaration #92, VariableDeclaration #94 ] + children: Array(2) [ VariableDeclaration #92, VariableDeclaration #94 ] + type: "ParameterList" + firstChild: VariableDeclaration #92 + lastChild: VariableDeclaration #94 + previousSibling: undefined + nextSibling: ParameterList #98 + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #92 + id: 92 + src: "0:0:0" + constant: false + indexed: false + name: "a" + scope: 99 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "uint256" + documentation: undefined + nameLocation: undefined + vType: ElementaryTypeName #91 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: ParameterList #95 + children: Array(1) [ ElementaryTypeName #91 ] + vScope: FunctionDefinition #99 + type: "VariableDeclaration" + firstChild: ElementaryTypeName #91 + lastChild: ElementaryTypeName #91 + previousSibling: undefined + nextSibling: VariableDeclaration #94 + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #91 + id: 91 + src: "0:0:0" + typeString: "uint256" + name: "uint" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: VariableDeclaration #92 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #94 + id: 94 + src: "0:0:0" + constant: false + indexed: false + name: "b" + scope: 99 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "uint256" + documentation: undefined + nameLocation: undefined + vType: ElementaryTypeName #93 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: ParameterList #95 + children: Array(1) [ ElementaryTypeName #93 ] + vScope: FunctionDefinition #99 + type: "VariableDeclaration" + firstChild: ElementaryTypeName #93 + lastChild: ElementaryTypeName #93 + previousSibling: VariableDeclaration #92 + nextSibling: undefined + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #93 + id: 93 + src: "0:0:0" + typeString: "uint256" + name: "uint" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: VariableDeclaration #94 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #98 + id: 98 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #99 + vParameters: Array(1) [ VariableDeclaration #97 ] + children: Array(1) [ VariableDeclaration #97 ] + type: "ParameterList" + firstChild: VariableDeclaration #97 + lastChild: VariableDeclaration #97 + previousSibling: ParameterList #95 + nextSibling: undefined + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #97 + id: 97 + src: "0:0:0" + constant: false + indexed: false + name: "" + scope: 99 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "uint256" + documentation: undefined + nameLocation: undefined + vType: ElementaryTypeName #96 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: ParameterList #98 + children: Array(1) [ ElementaryTypeName #96 ] + vScope: FunctionDefinition #99 + type: "VariableDeclaration" + firstChild: ElementaryTypeName #96 + lastChild: ElementaryTypeName #96 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #96 + id: 96 + src: "0:0:0" + typeString: "uint256" + name: "uint" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: VariableDeclaration #97 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ContractDefinition #145 + id: 145 + src: "0:0:0" + name: "C" + scope: 146 + kind: "contract" + abstract: false + fullyImplemented: true + linearizedBaseContracts: Array(2) [ 145, 100 ] + usedErrors: Array(0) + docString: undefined + nameLocation: undefined + context: ASTContext #1000 + parent: SourceUnit #146 + documentation: undefined + vScope: SourceUnit #146 + vLinearizedBaseContracts: Array(2) [ ContractDefinition #145, ContractDefinition #100 ] + vUsedErrors: Array(0) + vInheritanceSpecifiers: Array(1) [ InheritanceSpecifier #102 ] + vStateVariables: Array(1) [ VariableDeclaration #118 ] + vModifiers: Array(0) + vEvents: Array(1) [ EventDefinition #106 ] + vErrors: Array(0) + vFunctions: Array(2) [ FunctionDefinition #129, FunctionDefinition #144 ] + vUsingForDirectives: Array(1) [ UsingForDirective #116 ] + vStructs: Array(1) [ StructDefinition #109 ] + vEnums: Array(1) [ EnumDefinition #113 ] + vUserDefinedValueTypes: Array(0) + vConstructor: FunctionDefinition #129 + children: Array(8) [ InheritanceSpecifier #102, EventDefinition #106, StructDefinition #109, EnumDefinition #113, UsingForDirective #116, VariableDeclaration #118, FunctionDefinition #129, FunctionDefinition #144 ] + type: "ContractDefinition" + firstChild: InheritanceSpecifier #102 + lastChild: FunctionDefinition #144 + previousSibling: ContractDefinition #100 + nextSibling: undefined + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + InheritanceSpecifier #102 + id: 102 + src: "0:0:0" + vBaseType: UserDefinedTypeName #101 + vArguments: Array(0) + context: ASTContext #1000 + parent: ContractDefinition #145 + children: Array(1) [ UserDefinedTypeName #101 ] + type: "InheritanceSpecifier" + firstChild: UserDefinedTypeName #101 + lastChild: UserDefinedTypeName #101 + previousSibling: undefined + nextSibling: EventDefinition #106 + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + UserDefinedTypeName #101 + id: 101 + src: "0:0:0" + typeString: "contract B" + name: "B" + referencedDeclaration: 100 + path: undefined + context: ASTContext #1000 + parent: InheritanceSpecifier #102 + children: Array(0) + vReferencedDeclaration: ContractDefinition #100 + type: "UserDefinedTypeName" + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + EventDefinition #106 + id: 106 + src: "0:0:0" + anonymous: false + name: "Ev" + documentation: undefined + nameLocation: undefined + vParameters: ParameterList #105 + context: ASTContext #1000 + parent: ContractDefinition #145 + children: Array(1) [ ParameterList #105 ] + vScope: ContractDefinition #145 + type: "EventDefinition" + firstChild: ParameterList #105 + lastChild: ParameterList #105 + previousSibling: InheritanceSpecifier #102 + nextSibling: StructDefinition #109 + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #105 + id: 105 + src: "0:0:0" + context: ASTContext #1000 + parent: EventDefinition #106 + vParameters: Array(1) [ VariableDeclaration #104 ] + children: Array(1) [ VariableDeclaration #104 ] + type: "ParameterList" + firstChild: VariableDeclaration #104 + lastChild: VariableDeclaration #104 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #104 + id: 104 + src: "0:0:0" + constant: false + indexed: true + name: "addr" + scope: 106 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "address" + documentation: undefined + nameLocation: undefined + vType: ElementaryTypeName #103 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: ParameterList #105 + children: Array(1) [ ElementaryTypeName #103 ] + vScope: EventDefinition #106 + type: "VariableDeclaration" + firstChild: ElementaryTypeName #103 + lastChild: ElementaryTypeName #103 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #103 + id: 103 + src: "0:0:0" + typeString: "address" + name: "address" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: VariableDeclaration #104 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + StructDefinition #109 + id: 109 + src: "0:0:0" + name: "St" + scope: 145 + visibility: "public" + nameLocation: undefined + context: ASTContext #1000 + parent: ContractDefinition #145 + canonicalName: "C.St" + vMembers: Array(1) [ VariableDeclaration #108 ] + vScope: ContractDefinition #145 + children: Array(1) [ VariableDeclaration #108 ] + type: "StructDefinition" + firstChild: VariableDeclaration #108 + lastChild: VariableDeclaration #108 + previousSibling: EventDefinition #106 + nextSibling: EnumDefinition #113 + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #108 + id: 108 + src: "0:0:0" + constant: false + indexed: false + name: "a" + scope: 109 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "uint256" + documentation: undefined + nameLocation: undefined + vType: ElementaryTypeName #107 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: StructDefinition #109 + children: Array(1) [ ElementaryTypeName #107 ] + vScope: StructDefinition #109 + type: "VariableDeclaration" + firstChild: ElementaryTypeName #107 + lastChild: ElementaryTypeName #107 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #107 + id: 107 + src: "0:0:0" + typeString: "uint256" + name: "uint" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: VariableDeclaration #108 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + EnumDefinition #113 + id: 113 + src: "0:0:0" + name: "En" + nameLocation: undefined + context: ASTContext #1000 + parent: ContractDefinition #145 + canonicalName: "C.En" + vMembers: Array(3) [ EnumValue #110, EnumValue #111, EnumValue #112 ] + vScope: ContractDefinition #145 + children: Array(3) [ EnumValue #110, EnumValue #111, EnumValue #112 ] + type: "EnumDefinition" + firstChild: EnumValue #110 + lastChild: EnumValue #112 + previousSibling: StructDefinition #109 + nextSibling: UsingForDirective #116 + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + EnumValue #110 + id: 110 + src: "0:0:0" + name: "A" + nameLocation: undefined + context: ASTContext #1000 + parent: EnumDefinition #113 + type: "EnumValue" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: EnumValue #111 + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + EnumValue #111 + id: 111 + src: "0:0:0" + name: "B" + nameLocation: undefined + context: ASTContext #1000 + parent: EnumDefinition #113 + type: "EnumValue" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: EnumValue #110 + nextSibling: EnumValue #112 + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + EnumValue #112 + id: 112 + src: "0:0:0" + name: "C" + nameLocation: undefined + context: ASTContext #1000 + parent: EnumDefinition #113 + type: "EnumValue" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: EnumValue #111 + nextSibling: undefined + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + UsingForDirective #116 + id: 116 + src: "0:0:0" + vLibraryName: UserDefinedTypeName #114 + vTypeName: ElementaryTypeName #115 + context: ASTContext #1000 + parent: ContractDefinition #145 + children: Array(2) [ UserDefinedTypeName #114, ElementaryTypeName #115 ] + type: "UsingForDirective" + firstChild: UserDefinedTypeName #114 + lastChild: ElementaryTypeName #115 + previousSibling: EnumDefinition #113 + nextSibling: VariableDeclaration #118 + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + UserDefinedTypeName #114 + id: 114 + src: "0:0:0" + typeString: "library A" + name: "A" + referencedDeclaration: 90 + path: undefined + context: ASTContext #1000 + parent: UsingForDirective #116 + children: Array(0) + vReferencedDeclaration: ContractDefinition #90 + type: "UserDefinedTypeName" + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: ElementaryTypeName #115 + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #115 + id: 115 + src: "0:0:0" + typeString: "uint256" + name: "uint" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: UsingForDirective #116 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: UserDefinedTypeName #114 + nextSibling: undefined + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #118 + id: 118 + src: "0:0:0" + constant: false + indexed: false + name: "val" + scope: 145 + stateVariable: true + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "uint256" + documentation: undefined + nameLocation: undefined + vType: ElementaryTypeName #117 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: ContractDefinition #145 + children: Array(1) [ ElementaryTypeName #117 ] + vScope: ContractDefinition #145 + type: "VariableDeclaration" + firstChild: ElementaryTypeName #117 + lastChild: ElementaryTypeName #117 + previousSibling: UsingForDirective #116 + nextSibling: FunctionDefinition #129 + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #117 + id: 117 + src: "0:0:0" + typeString: "uint256" + name: "uint" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: VariableDeclaration #118 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionDefinition #129 + id: 129 + src: "0:0:0" + implemented: true + virtual: false + scope: 145 + kind: "constructor" + name: "" + visibility: "public" + stateMutability: "nonpayable" + isConstructor: true + documentation: undefined + nameLocation: undefined + vParameters: ParameterList #119 + vReturnParameters: ParameterList #120 + vModifiers: Array(0) + vOverrideSpecifier: undefined + vBody: Block #128 + context: ASTContext #1000 + parent: ContractDefinition #145 + children: Array(3) [ ParameterList #119, ParameterList #120, Block #128 ] + vScope: ContractDefinition #145 + type: "FunctionDefinition" + firstChild: ParameterList #119 + lastChild: Block #128 + previousSibling: VariableDeclaration #118 + nextSibling: FunctionDefinition #144 + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #119 + id: 119 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #129 + vParameters: Array(0) + children: Array(0) + type: "ParameterList" + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: ParameterList #120 + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #120 + id: 120 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #129 + vParameters: Array(0) + children: Array(0) + type: "ParameterList" + firstChild: undefined + lastChild: undefined + previousSibling: ParameterList #119 + nextSibling: Block #128 + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Block #128 + id: 128 + src: "0:0:0" + documentation: undefined + context: ASTContext #1000 + parent: FunctionDefinition #129 + vStatements: Array(1) [ ExpressionStatement #127 ] + children: Array(1) [ ExpressionStatement #127 ] + type: "Block" + firstChild: ExpressionStatement #127 + lastChild: ExpressionStatement #127 + previousSibling: ParameterList #120 + nextSibling: undefined + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ExpressionStatement #127 + id: 127 + src: "0:0:0" + documentation: undefined + vExpression: Assignment #126 + context: ASTContext #1000 + parent: Block #128 + children: Array(1) [ Assignment #126 ] + type: "ExpressionStatement" + firstChild: Assignment #126 + lastChild: Assignment #126 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Assignment #126 + id: 126 + src: "0:0:0" + typeString: "uint256" + operator: "=" + vLeftHandSide: Identifier #121 + vRightHandSide: FunctionCall #125 + context: ASTContext #1000 + parent: ExpressionStatement #127 + children: Array(2) [ Identifier #121, FunctionCall #125 ] + type: "Assignment" + firstChild: Identifier #121 + lastChild: FunctionCall #125 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #121 + id: 121 + src: "0:0:0" + typeString: "uint256" + name: "val" + referencedDeclaration: 118 + context: ASTContext #1000 + parent: Assignment #126 + vReferencedDeclaration: VariableDeclaration #118 + vIdentifierType: "userDefined" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: FunctionCall #125 + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionCall #125 + id: 125 + src: "0:0:0" + typeString: "uint256" + kind: "functionCall" + fieldNames: undefined + vExpression: Identifier #122 + vArguments: Array(2) [ Literal #123, Literal #124 ] + context: ASTContext #1000 + parent: Assignment #126 + children: Array(3) [ Identifier #122, Literal #123, Literal #124 ] + vIdentifier: "some" + vMemberName: undefined + vFunctionCallType: "userDefined" + vReferencedDeclaration: FunctionDefinition #144 + vFunctionName: "some" + vCallee: Identifier #122 + type: "FunctionCall" + firstChild: Identifier #122 + lastChild: Literal #124 + previousSibling: Identifier #121 + nextSibling: undefined + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #122 + id: 122 + src: "0:0:0" + typeString: "function (uint256,uint256) returns (uint256)" + name: "some" + referencedDeclaration: 144 + context: ASTContext #1000 + parent: FunctionCall #125 + vReferencedDeclaration: FunctionDefinition #144 + vIdentifierType: "userDefined" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: Literal #123 + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Literal #123 + id: 123 + src: "0:0:0" + typeString: "int_const 1" + kind: "number" + hexValue: "31" + value: "1" + subdenomination: undefined + context: ASTContext #1000 + parent: FunctionCall #125 + type: "Literal" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: Identifier #122 + nextSibling: Literal #124 + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Literal #124 + id: 124 + src: "0:0:0" + typeString: "int_const 2" + kind: "number" + hexValue: "32" + value: "2" + subdenomination: undefined + context: ASTContext #1000 + parent: FunctionCall #125 + type: "Literal" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: Literal #123 + nextSibling: undefined + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionDefinition #144 + id: 144 + src: "0:0:0" + implemented: true + virtual: false + scope: 145 + kind: "function" + name: "some" + visibility: "public" + stateMutability: "nonpayable" + isConstructor: false + documentation: undefined + nameLocation: undefined + vParameters: ParameterList #134 + vReturnParameters: ParameterList #137 + vModifiers: Array(0) + vOverrideSpecifier: undefined + vBody: Block #143 + context: ASTContext #1000 + parent: ContractDefinition #145 + children: Array(3) [ ParameterList #134, ParameterList #137, Block #143 ] + vScope: ContractDefinition #145 + type: "FunctionDefinition" + firstChild: ParameterList #134 + lastChild: Block #143 + previousSibling: FunctionDefinition #129 + nextSibling: undefined + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #134 + id: 134 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #144 + vParameters: Array(2) [ VariableDeclaration #131, VariableDeclaration #133 ] + children: Array(2) [ VariableDeclaration #131, VariableDeclaration #133 ] + type: "ParameterList" + firstChild: VariableDeclaration #131 + lastChild: VariableDeclaration #133 + previousSibling: undefined + nextSibling: ParameterList #137 + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #131 + id: 131 + src: "0:0:0" + constant: false + indexed: false + name: "a" + scope: 144 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "uint256" + documentation: undefined + nameLocation: undefined + vType: ElementaryTypeName #130 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: ParameterList #134 + children: Array(1) [ ElementaryTypeName #130 ] + vScope: FunctionDefinition #144 + type: "VariableDeclaration" + firstChild: ElementaryTypeName #130 + lastChild: ElementaryTypeName #130 + previousSibling: undefined + nextSibling: VariableDeclaration #133 + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #130 + id: 130 + src: "0:0:0" + typeString: "uint256" + name: "uint" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: VariableDeclaration #131 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #133 + id: 133 + src: "0:0:0" + constant: false + indexed: false + name: "b" + scope: 144 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "uint256" + documentation: undefined + nameLocation: undefined + vType: ElementaryTypeName #132 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: ParameterList #134 + children: Array(1) [ ElementaryTypeName #132 ] + vScope: FunctionDefinition #144 + type: "VariableDeclaration" + firstChild: ElementaryTypeName #132 + lastChild: ElementaryTypeName #132 + previousSibling: VariableDeclaration #131 + nextSibling: undefined + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #132 + id: 132 + src: "0:0:0" + typeString: "uint256" + name: "uint" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: VariableDeclaration #133 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #137 + id: 137 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #144 + vParameters: Array(1) [ VariableDeclaration #136 ] + children: Array(1) [ VariableDeclaration #136 ] + type: "ParameterList" + firstChild: VariableDeclaration #136 + lastChild: VariableDeclaration #136 + previousSibling: ParameterList #134 + nextSibling: Block #143 + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #136 + id: 136 + src: "0:0:0" + constant: false + indexed: false + name: "" + scope: 144 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "uint256" + documentation: undefined + nameLocation: undefined + vType: ElementaryTypeName #135 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: ParameterList #137 + children: Array(1) [ ElementaryTypeName #135 ] + vScope: FunctionDefinition #144 + type: "VariableDeclaration" + firstChild: ElementaryTypeName #135 + lastChild: ElementaryTypeName #135 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #135 + id: 135 + src: "0:0:0" + typeString: "uint256" + name: "uint" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: VariableDeclaration #136 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Block #143 + id: 143 + src: "0:0:0" + documentation: undefined + context: ASTContext #1000 + parent: FunctionDefinition #144 + vStatements: Array(1) [ Return #142 ] + children: Array(1) [ Return #142 ] + type: "Block" + firstChild: Return #142 + lastChild: Return #142 + previousSibling: ParameterList #137 + nextSibling: undefined + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Return #142 + id: 142 + src: "0:0:0" + documentation: undefined + functionReturnParameters: 64 + vExpression: FunctionCall #141 + context: ASTContext #1000 + parent: Block #143 + children: Array(1) [ FunctionCall #141 ] + vFunctionReturnParameters: ParameterList #64 + type: "Return" + firstChild: FunctionCall #141 + lastChild: FunctionCall #141 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionCall #141 + id: 141 + src: "0:0:0" + typeString: "uint256" + kind: "functionCall" + fieldNames: undefined + vExpression: MemberAccess #139 + vArguments: Array(1) [ Identifier #140 ] + context: ASTContext #1000 + parent: Return #142 + children: Array(2) [ MemberAccess #139, Identifier #140 ] + vIdentifier: "a" + vMemberName: "add" + vFunctionCallType: "userDefined" + vReferencedDeclaration: FunctionDefinition #89 + vFunctionName: "add" + vCallee: MemberAccess #139 + type: "FunctionCall" + firstChild: MemberAccess #139 + lastChild: Identifier #140 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + MemberAccess #139 + id: 139 + src: "0:0:0" + typeString: "function (uint256,uint256) returns (uint256)" + vExpression: Identifier #138 + memberName: "add" + referencedDeclaration: 89 + context: ASTContext #1000 + parent: FunctionCall #141 + children: Array(1) [ Identifier #138 ] + vReferencedDeclaration: FunctionDefinition #89 + type: "MemberAccess" + firstChild: Identifier #138 + lastChild: Identifier #138 + previousSibling: undefined + nextSibling: Identifier #140 + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #138 + id: 138 + src: "0:0:0" + typeString: "uint256" + name: "a" + referencedDeclaration: 131 + context: ASTContext #1000 + parent: MemberAccess #139 + vReferencedDeclaration: VariableDeclaration #131 + vIdentifierType: "userDefined" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #140 + id: 140 + src: "0:0:0" + typeString: "uint256" + name: "b" + referencedDeclaration: 133 + context: ASTContext #1000 + parent: FunctionCall #141 + vReferencedDeclaration: VariableDeclaration #133 + vIdentifierType: "userDefined" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: MemberAccess #139 + nextSibling: undefined + root: SourceUnit #146 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } diff --git a/test/samples/solidity/latest_08.nodes.native.txt b/test/samples/solidity/latest_08.nodes.native.txt new file mode 100644 index 00000000..6a3fed57 --- /dev/null +++ b/test/samples/solidity/latest_08.nodes.native.txt @@ -0,0 +1,10534 @@ +SourceUnit #1037 + id: 1037 + src: "0:0:0" + sourceEntryKey: "./test/samples/solidity/latest_08.sol" + sourceListIndex: 0 + absolutePath: "./test/samples/solidity/latest_08.sol" + exportedSymbols: Map(18) { "Builtins_0811" -> 1036, "CatchPanic" -> 667, "EmitsIdentifierPath" -> 589, "EnumABC" -> 536, "EnumTypeMinMax_088" -> 966, "ExternalFnSelectorAndAddress_0810" -> 997, "Features082" -> 752, "Features084" -> 821, "Features087" -> 838, "InterfaceWithUDTV_088" -> 941, "LI" -> 532, "LibErrors084" -> 763, "LibWithUDVT_088" -> 930, "Price" -> 840, "Quantity" -> 842, "UncheckedMathExample" -> 553, "UnitLevelError084" -> 757, "UsesNewAddressMembers" -> 610 } + context: ASTContext #1000 + vPragmaDirectives: Array(2) [ PragmaDirective #530, PragmaDirective #531 ] + vImportDirectives: Array(1) [ ImportDirective #532 ] + vContracts: Array(13) [ ContractDefinition #553, ContractDefinition #589, ContractDefinition #610, ContractDefinition #667, ContractDefinition #752, ContractDefinition #763, ContractDefinition #821, ContractDefinition #838, ContractDefinition #930, ContractDefinition #941, ContractDefinition #966, ContractDefinition #997, ContractDefinition #1036 ] + vEnums: Array(1) [ EnumDefinition #536 ] + vErrors: Array(1) [ ErrorDefinition #757 ] + vStructs: Array(0) + vFunctions: Array(0) + vVariables: Array(0) + vUserDefinedValueTypes: Array(2) [ UserDefinedValueTypeDefinition #840, UserDefinedValueTypeDefinition #842 ] + vExportedSymbols: Map(18) { "Builtins_0811" -> ContractDefinition #1036, "CatchPanic" -> ContractDefinition #667, "EmitsIdentifierPath" -> ContractDefinition #589, "EnumABC" -> EnumDefinition #536, "EnumTypeMinMax_088" -> ContractDefinition #966, "ExternalFnSelectorAndAddress_0810" -> ContractDefinition #997, "Features082" -> ContractDefinition #752, "Features084" -> ContractDefinition #821, "Features087" -> ContractDefinition #838, "InterfaceWithUDTV_088" -> ContractDefinition #941, "LI" -> ImportDirective #532, "LibErrors084" -> ContractDefinition #763, "LibWithUDVT_088" -> ContractDefinition #930, "Price" -> UserDefinedValueTypeDefinition #840, "Quantity" -> UserDefinedValueTypeDefinition #842, "UncheckedMathExample" -> ContractDefinition #553, "UnitLevelError084" -> ErrorDefinition #757, "UsesNewAddressMembers" -> ContractDefinition #610 } + children: Array(20) [ PragmaDirective #530, PragmaDirective #531, ImportDirective #532, EnumDefinition #536, ContractDefinition #553, ContractDefinition #589, ContractDefinition #610, ContractDefinition #667, ContractDefinition #752, ErrorDefinition #757, ContractDefinition #763, ContractDefinition #821, ContractDefinition #838, UserDefinedValueTypeDefinition #840, UserDefinedValueTypeDefinition #842, ContractDefinition #930, ContractDefinition #941, ContractDefinition #966, ContractDefinition #997, ContractDefinition #1036 ] + type: "SourceUnit" + firstChild: PragmaDirective #530 + lastChild: ContractDefinition #1036 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + PragmaDirective #530 + id: 530 + src: "0:0:0" + literals: Array(4) [ "solidity", "^", "0.8", ".0" ] + context: ASTContext #1000 + parent: SourceUnit #1037 + vIdentifier: "solidity" + vValue: "^0.8.0" + type: "PragmaDirective" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: PragmaDirective #531 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + PragmaDirective #531 + id: 531 + src: "0:0:0" + literals: Array(2) [ "abicoder", "v2" ] + context: ASTContext #1000 + parent: SourceUnit #1037 + vIdentifier: "abicoder" + vValue: "v2" + type: "PragmaDirective" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: PragmaDirective #530 + nextSibling: ImportDirective #532 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ImportDirective #532 + id: 532 + src: "0:0:0" + file: "./latest_imports_08.sol" + absolutePath: "./test/samples/solidity/latest_imports_08.sol" + unitAlias: "LI" + symbolAliases: Array(0) + scope: 1037 + sourceUnit: 529 + context: ASTContext #1000 + parent: SourceUnit #1037 + children: Array(0) + vScope: SourceUnit #1037 + vSourceUnit: SourceUnit #529 + vSymbolAliases: Array(0) + type: "ImportDirective" + firstChild: undefined + lastChild: undefined + previousSibling: PragmaDirective #531 + nextSibling: EnumDefinition #536 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + EnumDefinition #536 + id: 536 + src: "0:0:0" + name: "EnumABC" + nameLocation: "91:7:0" + context: ASTContext #1000 + parent: SourceUnit #1037 + canonicalName: "EnumABC" + vMembers: Array(3) [ EnumValue #533, EnumValue #534, EnumValue #535 ] + vScope: SourceUnit #1037 + children: Array(3) [ EnumValue #533, EnumValue #534, EnumValue #535 ] + type: "EnumDefinition" + firstChild: EnumValue #533 + lastChild: EnumValue #535 + previousSibling: ImportDirective #532 + nextSibling: ContractDefinition #553 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + EnumValue #533 + id: 533 + src: "0:0:0" + name: "A" + nameLocation: "105:1:0" + context: ASTContext #1000 + parent: EnumDefinition #536 + type: "EnumValue" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: EnumValue #534 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + EnumValue #534 + id: 534 + src: "0:0:0" + name: "B" + nameLocation: "108:1:0" + context: ASTContext #1000 + parent: EnumDefinition #536 + type: "EnumValue" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: EnumValue #533 + nextSibling: EnumValue #535 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + EnumValue #535 + id: 535 + src: "0:0:0" + name: "C" + nameLocation: "111:1:0" + context: ASTContext #1000 + parent: EnumDefinition #536 + type: "EnumValue" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: EnumValue #534 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ContractDefinition #553 + id: 553 + src: "0:0:0" + name: "UncheckedMathExample" + scope: 1037 + kind: "contract" + abstract: false + fullyImplemented: true + linearizedBaseContracts: Array(1) [ 553 ] + usedErrors: Array(0) + docString: undefined + nameLocation: "125:20:0" + context: ASTContext #1000 + parent: SourceUnit #1037 + documentation: undefined + vScope: SourceUnit #1037 + vLinearizedBaseContracts: Array(1) [ ContractDefinition #553 ] + vUsedErrors: Array(0) + vInheritanceSpecifiers: Array(0) + vStateVariables: Array(0) + vModifiers: Array(0) + vEvents: Array(0) + vErrors: Array(0) + vFunctions: Array(1) [ FunctionDefinition #552 ] + vUsingForDirectives: Array(0) + vStructs: Array(0) + vEnums: Array(0) + vUserDefinedValueTypes: Array(0) + vConstructor: undefined + children: Array(1) [ FunctionDefinition #552 ] + type: "ContractDefinition" + firstChild: FunctionDefinition #552 + lastChild: FunctionDefinition #552 + previousSibling: EnumDefinition #536 + nextSibling: ContractDefinition #589 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionDefinition #552 + id: 552 + src: "0:0:0" + implemented: true + virtual: false + scope: 553 + kind: "function" + name: "test" + visibility: "public" + stateMutability: "pure" + isConstructor: false + documentation: undefined + nameLocation: "161:4:0" + vParameters: ParameterList #537 + vReturnParameters: ParameterList #540 + vModifiers: Array(0) + vOverrideSpecifier: undefined + vBody: Block #551 + context: ASTContext #1000 + parent: ContractDefinition #553 + children: Array(3) [ ParameterList #537, ParameterList #540, Block #551 ] + vScope: ContractDefinition #553 + type: "FunctionDefinition" + firstChild: ParameterList #537 + lastChild: Block #551 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #537 + id: 537 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #552 + vParameters: Array(0) + children: Array(0) + type: "ParameterList" + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: ParameterList #540 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #540 + id: 540 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #552 + vParameters: Array(1) [ VariableDeclaration #539 ] + children: Array(1) [ VariableDeclaration #539 ] + type: "ParameterList" + firstChild: VariableDeclaration #539 + lastChild: VariableDeclaration #539 + previousSibling: ParameterList #537 + nextSibling: Block #551 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #539 + id: 539 + src: "0:0:0" + constant: false + indexed: false + name: "" + scope: 552 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "uint256" + documentation: undefined + nameLocation: "-1:-1:-1" + vType: ElementaryTypeName #538 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: ParameterList #540 + children: Array(1) [ ElementaryTypeName #538 ] + vScope: FunctionDefinition #552 + type: "VariableDeclaration" + firstChild: ElementaryTypeName #538 + lastChild: ElementaryTypeName #538 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #538 + id: 538 + src: "0:0:0" + typeString: "uint256" + name: "uint" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: VariableDeclaration #539 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Block #551 + id: 551 + src: "0:0:0" + documentation: undefined + context: ASTContext #1000 + parent: FunctionDefinition #552 + vStatements: Array(3) [ VariableDeclarationStatement #544, UncheckedBlock #548, Return #550 ] + children: Array(3) [ VariableDeclarationStatement #544, UncheckedBlock #548, Return #550 ] + type: "Block" + firstChild: VariableDeclarationStatement #544 + lastChild: Return #550 + previousSibling: ParameterList #540 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclarationStatement #544 + id: 544 + src: "0:0:0" + documentation: undefined + assignments: Array(1) [ 542 ] + vDeclarations: Array(1) [ VariableDeclaration #542 ] + vInitialValue: Literal #543 + context: ASTContext #1000 + parent: Block #551 + children: Array(2) [ VariableDeclaration #542, Literal #543 ] + type: "VariableDeclarationStatement" + firstChild: VariableDeclaration #542 + lastChild: Literal #543 + previousSibling: undefined + nextSibling: UncheckedBlock #548 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #542 + id: 542 + src: "0:0:0" + constant: false + indexed: false + name: "x" + scope: 551 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "uint256" + documentation: undefined + nameLocation: "210:1:0" + vType: ElementaryTypeName #541 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: VariableDeclarationStatement #544 + children: Array(1) [ ElementaryTypeName #541 ] + vScope: Block #551 + type: "VariableDeclaration" + firstChild: ElementaryTypeName #541 + lastChild: ElementaryTypeName #541 + previousSibling: undefined + nextSibling: Literal #543 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #541 + id: 541 + src: "0:0:0" + typeString: "uint256" + name: "uint" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: VariableDeclaration #542 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Literal #543 + id: 543 + src: "0:0:0" + typeString: "int_const 0" + kind: "number" + hexValue: "30" + value: "0" + subdenomination: undefined + context: ASTContext #1000 + parent: VariableDeclarationStatement #544 + type: "Literal" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: VariableDeclaration #542 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + UncheckedBlock #548 + id: 548 + src: "0:0:0" + documentation: undefined + context: ASTContext #1000 + parent: Block #551 + vStatements: Array(1) [ ExpressionStatement #547 ] + children: Array(1) [ ExpressionStatement #547 ] + type: "UncheckedBlock" + firstChild: ExpressionStatement #547 + lastChild: ExpressionStatement #547 + previousSibling: VariableDeclarationStatement #544 + nextSibling: Return #550 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ExpressionStatement #547 + id: 547 + src: "0:0:0" + documentation: undefined + vExpression: UnaryOperation #546 + context: ASTContext #1000 + parent: UncheckedBlock #548 + children: Array(1) [ UnaryOperation #546 ] + type: "ExpressionStatement" + firstChild: UnaryOperation #546 + lastChild: UnaryOperation #546 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + UnaryOperation #546 + id: 546 + src: "0:0:0" + typeString: "uint256" + prefix: false + operator: "--" + vSubExpression: Identifier #545 + context: ASTContext #1000 + parent: ExpressionStatement #547 + children: Array(1) [ Identifier #545 ] + type: "UnaryOperation" + firstChild: Identifier #545 + lastChild: Identifier #545 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #545 + id: 545 + src: "0:0:0" + typeString: "uint256" + name: "x" + referencedDeclaration: 542 + context: ASTContext #1000 + parent: UnaryOperation #546 + vReferencedDeclaration: VariableDeclaration #542 + vIdentifierType: "userDefined" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Return #550 + id: 550 + src: "0:0:0" + documentation: undefined + functionReturnParameters: 11 + vExpression: Identifier #549 + context: ASTContext #1000 + parent: Block #551 + children: Array(1) [ Identifier #549 ] + vFunctionReturnParameters: ParameterList #11 + type: "Return" + firstChild: Identifier #549 + lastChild: Identifier #549 + previousSibling: UncheckedBlock #548 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #549 + id: 549 + src: "0:0:0" + typeString: "uint256" + name: "x" + referencedDeclaration: 542 + context: ASTContext #1000 + parent: Return #550 + vReferencedDeclaration: VariableDeclaration #542 + vIdentifierType: "userDefined" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ContractDefinition #589 + id: 589 + src: "0:0:0" + name: "EmitsIdentifierPath" + scope: 1037 + kind: "contract" + abstract: false + fullyImplemented: true + linearizedBaseContracts: Array(2) [ 589, 527 ] + usedErrors: Array(0) + docString: undefined + nameLocation: "302:19:0" + context: ASTContext #1000 + parent: SourceUnit #1037 + documentation: undefined + vScope: SourceUnit #1037 + vLinearizedBaseContracts: Array(2) [ ContractDefinition #589, ContractDefinition #527 ] + vUsedErrors: Array(0) + vInheritanceSpecifiers: Array(1) [ InheritanceSpecifier #555 ] + vStateVariables: Array(0) + vModifiers: Array(0) + vEvents: Array(0) + vErrors: Array(0) + vFunctions: Array(3) [ FunctionDefinition #565, FunctionDefinition #578, FunctionDefinition #588 ] + vUsingForDirectives: Array(1) [ UsingForDirective #559 ] + vStructs: Array(0) + vEnums: Array(0) + vUserDefinedValueTypes: Array(0) + vConstructor: FunctionDefinition #565 + children: Array(5) [ InheritanceSpecifier #555, UsingForDirective #559, FunctionDefinition #565, FunctionDefinition #578, FunctionDefinition #588 ] + type: "ContractDefinition" + firstChild: InheritanceSpecifier #555 + lastChild: FunctionDefinition #588 + previousSibling: ContractDefinition #553 + nextSibling: ContractDefinition #610 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + InheritanceSpecifier #555 + id: 555 + src: "0:0:0" + vBaseType: IdentifierPath #554 + vArguments: Array(0) + context: ASTContext #1000 + parent: ContractDefinition #589 + children: Array(1) [ IdentifierPath #554 ] + type: "InheritanceSpecifier" + firstChild: IdentifierPath #554 + lastChild: IdentifierPath #554 + previousSibling: undefined + nextSibling: UsingForDirective #559 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + IdentifierPath #554 + id: 554 + src: "0:0:0" + name: "LI.SomeContract" + referencedDeclaration: 527 + context: ASTContext #1000 + parent: InheritanceSpecifier #555 + vReferencedDeclaration: ContractDefinition #527 + type: "IdentifierPath" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + UsingForDirective #559 + id: 559 + src: "0:0:0" + vLibraryName: IdentifierPath #556 + vTypeName: UserDefinedTypeName #558 + context: ASTContext #1000 + parent: ContractDefinition #589 + children: Array(2) [ IdentifierPath #556, UserDefinedTypeName #558 ] + type: "UsingForDirective" + firstChild: IdentifierPath #556 + lastChild: UserDefinedTypeName #558 + previousSibling: InheritanceSpecifier #555 + nextSibling: FunctionDefinition #565 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + IdentifierPath #556 + id: 556 + src: "0:0:0" + name: "LI.SomeLib" + referencedDeclaration: 528 + context: ASTContext #1000 + parent: UsingForDirective #559 + vReferencedDeclaration: ContractDefinition #528 + type: "IdentifierPath" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: UserDefinedTypeName #558 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + UserDefinedTypeName #558 + id: 558 + src: "0:0:0" + typeString: "struct SomeContract.SomeStruct" + name: undefined + referencedDeclaration: 518 + path: IdentifierPath #557 + context: ASTContext #1000 + parent: UsingForDirective #559 + children: Array(1) [ IdentifierPath #557 ] + vReferencedDeclaration: StructDefinition #518 + type: "UserDefinedTypeName" + firstChild: IdentifierPath #557 + lastChild: IdentifierPath #557 + previousSibling: IdentifierPath #556 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + IdentifierPath #557 + id: 557 + src: "0:0:0" + name: "LI.SomeContract.SomeStruct" + referencedDeclaration: 518 + context: ASTContext #1000 + parent: UserDefinedTypeName #558 + vReferencedDeclaration: StructDefinition #518 + type: "IdentifierPath" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionDefinition #565 + id: 565 + src: "0:0:0" + implemented: true + virtual: false + scope: 589 + kind: "constructor" + name: "" + visibility: "public" + stateMutability: "nonpayable" + isConstructor: true + documentation: undefined + nameLocation: "-1:-1:-1" + vParameters: ParameterList #560 + vReturnParameters: ParameterList #561 + vModifiers: Array(1) [ ModifierInvocation #563 ] + vOverrideSpecifier: undefined + vBody: Block #564 + context: ASTContext #1000 + parent: ContractDefinition #589 + children: Array(4) [ ParameterList #560, ModifierInvocation #563, ParameterList #561, Block #564 ] + vScope: ContractDefinition #589 + type: "FunctionDefinition" + firstChild: ParameterList #560 + lastChild: Block #564 + previousSibling: UsingForDirective #559 + nextSibling: FunctionDefinition #578 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #560 + id: 560 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #565 + vParameters: Array(0) + children: Array(0) + type: "ParameterList" + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: ModifierInvocation #563 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ModifierInvocation #563 + id: 563 + src: "0:0:0" + kind: "baseConstructorSpecifier" + vModifierName: IdentifierPath #562 + vArguments: Array(0) + context: ASTContext #1000 + parent: FunctionDefinition #565 + children: Array(1) [ IdentifierPath #562 ] + vModifier: ContractDefinition #527 + type: "ModifierInvocation" + firstChild: IdentifierPath #562 + lastChild: IdentifierPath #562 + previousSibling: ParameterList #560 + nextSibling: ParameterList #561 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + IdentifierPath #562 + id: 562 + src: "0:0:0" + name: "LI.SomeContract" + referencedDeclaration: 527 + context: ASTContext #1000 + parent: ModifierInvocation #563 + vReferencedDeclaration: ContractDefinition #527 + type: "IdentifierPath" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #561 + id: 561 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #565 + vParameters: Array(0) + children: Array(0) + type: "ParameterList" + firstChild: undefined + lastChild: undefined + previousSibling: ModifierInvocation #563 + nextSibling: Block #564 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Block #564 + id: 564 + src: "0:0:0" + documentation: undefined + context: ASTContext #1000 + parent: FunctionDefinition #565 + vStatements: Array(0) + children: Array(0) + type: "Block" + firstChild: undefined + lastChild: undefined + previousSibling: ParameterList #561 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionDefinition #578 + id: 578 + src: "0:0:0" + implemented: true + virtual: false + scope: 589 + kind: "function" + name: "test" + visibility: "public" + stateMutability: "nonpayable" + isConstructor: false + documentation: undefined + nameLocation: "450:4:0" + vParameters: ParameterList #566 + vReturnParameters: ParameterList #567 + vModifiers: Array(0) + vOverrideSpecifier: undefined + vBody: Block #577 + context: ASTContext #1000 + parent: ContractDefinition #589 + children: Array(3) [ ParameterList #566, ParameterList #567, Block #577 ] + vScope: ContractDefinition #589 + type: "FunctionDefinition" + firstChild: ParameterList #566 + lastChild: Block #577 + previousSibling: FunctionDefinition #565 + nextSibling: FunctionDefinition #588 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #566 + id: 566 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #578 + vParameters: Array(0) + children: Array(0) + type: "ParameterList" + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: ParameterList #567 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #567 + id: 567 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #578 + vParameters: Array(0) + children: Array(0) + type: "ParameterList" + firstChild: undefined + lastChild: undefined + previousSibling: ParameterList #566 + nextSibling: Block #577 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Block #577 + id: 577 + src: "0:0:0" + documentation: undefined + context: ASTContext #1000 + parent: FunctionDefinition #578 + vStatements: Array(1) [ VariableDeclarationStatement #576 ] + children: Array(1) [ VariableDeclarationStatement #576 ] + type: "Block" + firstChild: VariableDeclarationStatement #576 + lastChild: VariableDeclarationStatement #576 + previousSibling: ParameterList #567 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclarationStatement #576 + id: 576 + src: "0:0:0" + documentation: undefined + assignments: Array(1) [ 570 ] + vDeclarations: Array(1) [ VariableDeclaration #570 ] + vInitialValue: FunctionCall #575 + context: ASTContext #1000 + parent: Block #577 + children: Array(2) [ VariableDeclaration #570, FunctionCall #575 ] + type: "VariableDeclarationStatement" + firstChild: VariableDeclaration #570 + lastChild: FunctionCall #575 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #570 + id: 570 + src: "0:0:0" + constant: false + indexed: false + name: "s" + scope: 577 + stateVariable: false + storageLocation: "memory" + visibility: "internal" + mutability: "mutable" + typeString: "struct SomeContract.SomeStruct" + documentation: undefined + nameLocation: "508:1:0" + vType: UserDefinedTypeName #569 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: VariableDeclarationStatement #576 + children: Array(1) [ UserDefinedTypeName #569 ] + vScope: Block #577 + type: "VariableDeclaration" + firstChild: UserDefinedTypeName #569 + lastChild: UserDefinedTypeName #569 + previousSibling: undefined + nextSibling: FunctionCall #575 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + UserDefinedTypeName #569 + id: 569 + src: "0:0:0" + typeString: "struct SomeContract.SomeStruct" + name: undefined + referencedDeclaration: 518 + path: IdentifierPath #568 + context: ASTContext #1000 + parent: VariableDeclaration #570 + children: Array(1) [ IdentifierPath #568 ] + vReferencedDeclaration: StructDefinition #518 + type: "UserDefinedTypeName" + firstChild: IdentifierPath #568 + lastChild: IdentifierPath #568 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + IdentifierPath #568 + id: 568 + src: "0:0:0" + name: "LI.SomeContract.SomeStruct" + referencedDeclaration: 518 + context: ASTContext #1000 + parent: UserDefinedTypeName #569 + vReferencedDeclaration: StructDefinition #518 + type: "IdentifierPath" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionCall #575 + id: 575 + src: "0:0:0" + typeString: "struct SomeContract.SomeStruct memory" + kind: "structConstructorCall" + fieldNames: undefined + vExpression: MemberAccess #573 + vArguments: Array(1) [ Literal #574 ] + context: ASTContext #1000 + parent: VariableDeclarationStatement #576 + children: Array(2) [ MemberAccess #573, Literal #574 ] + vIdentifier: undefined + vMemberName: "SomeStruct" + vFunctionCallType: "userDefined" + vReferencedDeclaration: StructDefinition #518 + vFunctionName: "SomeStruct" + vCallee: MemberAccess #573 + type: "FunctionCall" + firstChild: MemberAccess #573 + lastChild: Literal #574 + previousSibling: VariableDeclaration #570 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + MemberAccess #573 + id: 573 + src: "0:0:0" + typeString: "type(struct SomeContract.SomeStruct storage pointer)" + vExpression: MemberAccess #572 + memberName: "SomeStruct" + referencedDeclaration: 518 + context: ASTContext #1000 + parent: FunctionCall #575 + children: Array(1) [ MemberAccess #572 ] + vReferencedDeclaration: StructDefinition #518 + type: "MemberAccess" + firstChild: MemberAccess #572 + lastChild: MemberAccess #572 + previousSibling: undefined + nextSibling: Literal #574 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + MemberAccess #572 + id: 572 + src: "0:0:0" + typeString: "type(contract SomeContract)" + vExpression: Identifier #571 + memberName: "SomeContract" + referencedDeclaration: 527 + context: ASTContext #1000 + parent: MemberAccess #573 + children: Array(1) [ Identifier #571 ] + vReferencedDeclaration: ContractDefinition #527 + type: "MemberAccess" + firstChild: Identifier #571 + lastChild: Identifier #571 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #571 + id: 571 + src: "0:0:0" + typeString: "module \"./test/samples/solidity/latest_imports_08.sol\"" + name: "LI" + referencedDeclaration: 532 + context: ASTContext #1000 + parent: MemberAccess #572 + vReferencedDeclaration: ImportDirective #532 + vIdentifierType: "userDefined" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Literal #574 + id: 574 + src: "0:0:0" + typeString: "int_const 10" + kind: "number" + hexValue: "3130" + value: "10" + subdenomination: undefined + context: ASTContext #1000 + parent: FunctionCall #575 + type: "Literal" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: MemberAccess #573 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionDefinition #588 + id: 588 + src: "0:0:0" + implemented: true + virtual: false + scope: 589 + kind: "function" + name: "some" + visibility: "public" + stateMutability: "nonpayable" + isConstructor: false + documentation: undefined + nameLocation: "564:4:0" + vParameters: ParameterList #579 + vReturnParameters: ParameterList #582 + vModifiers: Array(0) + vOverrideSpecifier: OverrideSpecifier #584 + vBody: Block #587 + context: ASTContext #1000 + parent: ContractDefinition #589 + children: Array(4) [ ParameterList #579, OverrideSpecifier #584, ParameterList #582, Block #587 ] + vScope: ContractDefinition #589 + type: "FunctionDefinition" + firstChild: ParameterList #579 + lastChild: Block #587 + previousSibling: FunctionDefinition #578 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #579 + id: 579 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #588 + vParameters: Array(0) + children: Array(0) + type: "ParameterList" + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: OverrideSpecifier #584 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + OverrideSpecifier #584 + id: 584 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #588 + vOverrides: Array(1) [ IdentifierPath #583 ] + children: Array(1) [ IdentifierPath #583 ] + type: "OverrideSpecifier" + firstChild: IdentifierPath #583 + lastChild: IdentifierPath #583 + previousSibling: ParameterList #579 + nextSibling: ParameterList #582 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + IdentifierPath #583 + id: 583 + src: "0:0:0" + name: "LI.SomeContract" + referencedDeclaration: 527 + context: ASTContext #1000 + parent: OverrideSpecifier #584 + vReferencedDeclaration: ContractDefinition #527 + type: "IdentifierPath" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #582 + id: 582 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #588 + vParameters: Array(1) [ VariableDeclaration #581 ] + children: Array(1) [ VariableDeclaration #581 ] + type: "ParameterList" + firstChild: VariableDeclaration #581 + lastChild: VariableDeclaration #581 + previousSibling: OverrideSpecifier #584 + nextSibling: Block #587 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #581 + id: 581 + src: "0:0:0" + constant: false + indexed: false + name: "" + scope: 588 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "uint256" + documentation: undefined + nameLocation: "-1:-1:-1" + vType: ElementaryTypeName #580 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: ParameterList #582 + children: Array(1) [ ElementaryTypeName #580 ] + vScope: FunctionDefinition #588 + type: "VariableDeclaration" + firstChild: ElementaryTypeName #580 + lastChild: ElementaryTypeName #580 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #580 + id: 580 + src: "0:0:0" + typeString: "uint256" + name: "uint" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: VariableDeclaration #581 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Block #587 + id: 587 + src: "0:0:0" + documentation: undefined + context: ASTContext #1000 + parent: FunctionDefinition #588 + vStatements: Array(1) [ Return #586 ] + children: Array(1) [ Return #586 ] + type: "Block" + firstChild: Return #586 + lastChild: Return #586 + previousSibling: ParameterList #582 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Return #586 + id: 586 + src: "0:0:0" + documentation: undefined + functionReturnParameters: 58 + vExpression: Literal #585 + context: ASTContext #1000 + parent: Block #587 + children: Array(1) [ Literal #585 ] + vFunctionReturnParameters: ParameterList #58 + type: "Return" + firstChild: Literal #585 + lastChild: Literal #585 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Literal #585 + id: 585 + src: "0:0:0" + typeString: "int_const 2" + kind: "number" + hexValue: "32" + value: "2" + subdenomination: undefined + context: ASTContext #1000 + parent: Return #586 + type: "Literal" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ContractDefinition #610 + id: 610 + src: "0:0:0" + name: "UsesNewAddressMembers" + scope: 1037 + kind: "contract" + abstract: false + fullyImplemented: true + linearizedBaseContracts: Array(1) [ 610 ] + usedErrors: Array(0) + docString: undefined + nameLocation: "656:21:0" + context: ASTContext #1000 + parent: SourceUnit #1037 + documentation: undefined + vScope: SourceUnit #1037 + vLinearizedBaseContracts: Array(1) [ ContractDefinition #610 ] + vUsedErrors: Array(0) + vInheritanceSpecifiers: Array(0) + vStateVariables: Array(0) + vModifiers: Array(0) + vEvents: Array(0) + vErrors: Array(0) + vFunctions: Array(1) [ FunctionDefinition #609 ] + vUsingForDirectives: Array(0) + vStructs: Array(0) + vEnums: Array(0) + vUserDefinedValueTypes: Array(0) + vConstructor: undefined + children: Array(1) [ FunctionDefinition #609 ] + type: "ContractDefinition" + firstChild: FunctionDefinition #609 + lastChild: FunctionDefinition #609 + previousSibling: ContractDefinition #589 + nextSibling: ContractDefinition #667 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionDefinition #609 + id: 609 + src: "0:0:0" + implemented: true + virtual: false + scope: 610 + kind: "function" + name: "test" + visibility: "public" + stateMutability: "nonpayable" + isConstructor: false + documentation: undefined + nameLocation: "693:4:0" + vParameters: ParameterList #590 + vReturnParameters: ParameterList #591 + vModifiers: Array(0) + vOverrideSpecifier: undefined + vBody: Block #608 + context: ASTContext #1000 + parent: ContractDefinition #610 + children: Array(3) [ ParameterList #590, ParameterList #591, Block #608 ] + vScope: ContractDefinition #610 + type: "FunctionDefinition" + firstChild: ParameterList #590 + lastChild: Block #608 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #590 + id: 590 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #609 + vParameters: Array(0) + children: Array(0) + type: "ParameterList" + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: ParameterList #591 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #591 + id: 591 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #609 + vParameters: Array(0) + children: Array(0) + type: "ParameterList" + firstChild: undefined + lastChild: undefined + previousSibling: ParameterList #590 + nextSibling: Block #608 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Block #608 + id: 608 + src: "0:0:0" + documentation: undefined + context: ASTContext #1000 + parent: FunctionDefinition #609 + vStatements: Array(2) [ VariableDeclarationStatement #599, VariableDeclarationStatement #607 ] + children: Array(2) [ VariableDeclarationStatement #599, VariableDeclarationStatement #607 ] + type: "Block" + firstChild: VariableDeclarationStatement #599 + lastChild: VariableDeclarationStatement #607 + previousSibling: ParameterList #591 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclarationStatement #599 + id: 599 + src: "0:0:0" + documentation: undefined + assignments: Array(1) [ 593 ] + vDeclarations: Array(1) [ VariableDeclaration #593 ] + vInitialValue: MemberAccess #598 + context: ASTContext #1000 + parent: Block #608 + children: Array(2) [ VariableDeclaration #593, MemberAccess #598 ] + type: "VariableDeclarationStatement" + firstChild: VariableDeclaration #593 + lastChild: MemberAccess #598 + previousSibling: undefined + nextSibling: VariableDeclarationStatement #607 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #593 + id: 593 + src: "0:0:0" + constant: false + indexed: false + name: "code" + scope: 608 + stateVariable: false + storageLocation: "memory" + visibility: "internal" + mutability: "mutable" + typeString: "bytes" + documentation: undefined + nameLocation: "730:4:0" + vType: ElementaryTypeName #592 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: VariableDeclarationStatement #599 + children: Array(1) [ ElementaryTypeName #592 ] + vScope: Block #608 + type: "VariableDeclaration" + firstChild: ElementaryTypeName #592 + lastChild: ElementaryTypeName #592 + previousSibling: undefined + nextSibling: MemberAccess #598 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #592 + id: 592 + src: "0:0:0" + typeString: "bytes" + name: "bytes" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: VariableDeclaration #593 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + MemberAccess #598 + id: 598 + src: "0:0:0" + typeString: "bytes memory" + vExpression: FunctionCall #597 + memberName: "code" + referencedDeclaration: undefined + context: ASTContext #1000 + parent: VariableDeclarationStatement #599 + children: Array(1) [ FunctionCall #597 ] + vReferencedDeclaration: undefined + type: "MemberAccess" + firstChild: FunctionCall #597 + lastChild: FunctionCall #597 + previousSibling: VariableDeclaration #593 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionCall #597 + id: 597 + src: "0:0:0" + typeString: "address" + kind: "typeConversion" + fieldNames: undefined + vExpression: ElementaryTypeNameExpression #595 + vArguments: Array(1) [ Literal #596 ] + context: ASTContext #1000 + parent: MemberAccess #598 + children: Array(2) [ ElementaryTypeNameExpression #595, Literal #596 ] + vIdentifier: "address" + vMemberName: undefined + vFunctionCallType: "builtin" + vReferencedDeclaration: undefined + vFunctionName: "address" + vCallee: ElementaryTypeNameExpression #595 + type: "FunctionCall" + firstChild: ElementaryTypeNameExpression #595 + lastChild: Literal #596 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeNameExpression #595 + id: 595 + src: "0:0:0" + typeString: "type(address)" + typeName: ElementaryTypeName #594 + context: ASTContext #1000 + parent: FunctionCall #597 + children: Array(1) [ ElementaryTypeName #594 ] + type: "ElementaryTypeNameExpression" + firstChild: ElementaryTypeName #594 + lastChild: ElementaryTypeName #594 + previousSibling: undefined + nextSibling: Literal #596 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #594 + id: 594 + src: "0:0:0" + typeString: undefined + name: "address" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: ElementaryTypeNameExpression #595 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Literal #596 + id: 596 + src: "0:0:0" + typeString: "int_const 0" + kind: "number" + hexValue: "30" + value: "0" + subdenomination: undefined + context: ASTContext #1000 + parent: FunctionCall #597 + type: "Literal" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: ElementaryTypeNameExpression #595 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclarationStatement #607 + id: 607 + src: "0:0:0" + documentation: undefined + assignments: Array(1) [ 601 ] + vDeclarations: Array(1) [ VariableDeclaration #601 ] + vInitialValue: MemberAccess #606 + context: ASTContext #1000 + parent: Block #608 + children: Array(2) [ VariableDeclaration #601, MemberAccess #606 ] + type: "VariableDeclarationStatement" + firstChild: VariableDeclaration #601 + lastChild: MemberAccess #606 + previousSibling: VariableDeclarationStatement #599 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #601 + id: 601 + src: "0:0:0" + constant: false + indexed: false + name: "codeHash" + scope: 608 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "bytes32" + documentation: undefined + nameLocation: "770:8:0" + vType: ElementaryTypeName #600 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: VariableDeclarationStatement #607 + children: Array(1) [ ElementaryTypeName #600 ] + vScope: Block #608 + type: "VariableDeclaration" + firstChild: ElementaryTypeName #600 + lastChild: ElementaryTypeName #600 + previousSibling: undefined + nextSibling: MemberAccess #606 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #600 + id: 600 + src: "0:0:0" + typeString: "bytes32" + name: "bytes32" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: VariableDeclaration #601 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + MemberAccess #606 + id: 606 + src: "0:0:0" + typeString: "bytes32" + vExpression: FunctionCall #605 + memberName: "codehash" + referencedDeclaration: undefined + context: ASTContext #1000 + parent: VariableDeclarationStatement #607 + children: Array(1) [ FunctionCall #605 ] + vReferencedDeclaration: undefined + type: "MemberAccess" + firstChild: FunctionCall #605 + lastChild: FunctionCall #605 + previousSibling: VariableDeclaration #601 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionCall #605 + id: 605 + src: "0:0:0" + typeString: "address" + kind: "typeConversion" + fieldNames: undefined + vExpression: ElementaryTypeNameExpression #603 + vArguments: Array(1) [ Literal #604 ] + context: ASTContext #1000 + parent: MemberAccess #606 + children: Array(2) [ ElementaryTypeNameExpression #603, Literal #604 ] + vIdentifier: "address" + vMemberName: undefined + vFunctionCallType: "builtin" + vReferencedDeclaration: undefined + vFunctionName: "address" + vCallee: ElementaryTypeNameExpression #603 + type: "FunctionCall" + firstChild: ElementaryTypeNameExpression #603 + lastChild: Literal #604 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeNameExpression #603 + id: 603 + src: "0:0:0" + typeString: "type(address)" + typeName: ElementaryTypeName #602 + context: ASTContext #1000 + parent: FunctionCall #605 + children: Array(1) [ ElementaryTypeName #602 ] + type: "ElementaryTypeNameExpression" + firstChild: ElementaryTypeName #602 + lastChild: ElementaryTypeName #602 + previousSibling: undefined + nextSibling: Literal #604 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #602 + id: 602 + src: "0:0:0" + typeString: undefined + name: "address" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: ElementaryTypeNameExpression #603 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Literal #604 + id: 604 + src: "0:0:0" + typeString: "int_const 0" + kind: "number" + hexValue: "30" + value: "0" + subdenomination: undefined + context: ASTContext #1000 + parent: FunctionCall #605 + type: "Literal" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: ElementaryTypeNameExpression #603 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ContractDefinition #667 + id: 667 + src: "0:0:0" + name: "CatchPanic" + scope: 1037 + kind: "contract" + abstract: false + fullyImplemented: true + linearizedBaseContracts: Array(1) [ 667 ] + usedErrors: Array(0) + docString: undefined + nameLocation: "820:10:0" + context: ASTContext #1000 + parent: SourceUnit #1037 + documentation: undefined + vScope: SourceUnit #1037 + vLinearizedBaseContracts: Array(1) [ ContractDefinition #667 ] + vUsedErrors: Array(0) + vInheritanceSpecifiers: Array(0) + vStateVariables: Array(0) + vModifiers: Array(0) + vEvents: Array(0) + vErrors: Array(0) + vFunctions: Array(1) [ FunctionDefinition #666 ] + vUsingForDirectives: Array(0) + vStructs: Array(0) + vEnums: Array(0) + vUserDefinedValueTypes: Array(0) + vConstructor: undefined + children: Array(1) [ FunctionDefinition #666 ] + type: "ContractDefinition" + firstChild: FunctionDefinition #666 + lastChild: FunctionDefinition #666 + previousSibling: ContractDefinition #610 + nextSibling: ContractDefinition #752 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionDefinition #666 + id: 666 + src: "0:0:0" + implemented: true + virtual: false + scope: 667 + kind: "function" + name: "test" + visibility: "public" + stateMutability: "nonpayable" + isConstructor: false + documentation: undefined + nameLocation: "846:4:0" + vParameters: ParameterList #611 + vReturnParameters: ParameterList #612 + vModifiers: Array(0) + vOverrideSpecifier: undefined + vBody: Block #665 + context: ASTContext #1000 + parent: ContractDefinition #667 + children: Array(3) [ ParameterList #611, ParameterList #612, Block #665 ] + vScope: ContractDefinition #667 + type: "FunctionDefinition" + firstChild: ParameterList #611 + lastChild: Block #665 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #611 + id: 611 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #666 + vParameters: Array(0) + children: Array(0) + type: "ParameterList" + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: ParameterList #612 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #612 + id: 612 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #666 + vParameters: Array(0) + children: Array(0) + type: "ParameterList" + firstChild: undefined + lastChild: undefined + previousSibling: ParameterList #611 + nextSibling: Block #665 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Block #665 + id: 665 + src: "0:0:0" + documentation: undefined + context: ASTContext #1000 + parent: FunctionDefinition #666 + vStatements: Array(2) [ VariableDeclarationStatement #620, TryStatement #664 ] + children: Array(2) [ VariableDeclarationStatement #620, TryStatement #664 ] + type: "Block" + firstChild: VariableDeclarationStatement #620 + lastChild: TryStatement #664 + previousSibling: ParameterList #612 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclarationStatement #620 + id: 620 + src: "0:0:0" + documentation: undefined + assignments: Array(1) [ 615 ] + vDeclarations: Array(1) [ VariableDeclaration #615 ] + vInitialValue: FunctionCall #619 + context: ASTContext #1000 + parent: Block #665 + children: Array(2) [ VariableDeclaration #615, FunctionCall #619 ] + type: "VariableDeclarationStatement" + firstChild: VariableDeclaration #615 + lastChild: FunctionCall #619 + previousSibling: undefined + nextSibling: TryStatement #664 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #615 + id: 615 + src: "0:0:0" + constant: false + indexed: false + name: "c" + scope: 665 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "contract UsesNewAddressMembers" + documentation: undefined + nameLocation: "892:1:0" + vType: UserDefinedTypeName #614 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: VariableDeclarationStatement #620 + children: Array(1) [ UserDefinedTypeName #614 ] + vScope: Block #665 + type: "VariableDeclaration" + firstChild: UserDefinedTypeName #614 + lastChild: UserDefinedTypeName #614 + previousSibling: undefined + nextSibling: FunctionCall #619 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + UserDefinedTypeName #614 + id: 614 + src: "0:0:0" + typeString: "contract UsesNewAddressMembers" + name: undefined + referencedDeclaration: 610 + path: IdentifierPath #613 + context: ASTContext #1000 + parent: VariableDeclaration #615 + children: Array(1) [ IdentifierPath #613 ] + vReferencedDeclaration: ContractDefinition #610 + type: "UserDefinedTypeName" + firstChild: IdentifierPath #613 + lastChild: IdentifierPath #613 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + IdentifierPath #613 + id: 613 + src: "0:0:0" + name: "UsesNewAddressMembers" + referencedDeclaration: 84 + context: ASTContext #1000 + parent: UserDefinedTypeName #614 + vReferencedDeclaration: ContractDefinition #84 + type: "IdentifierPath" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionCall #619 + id: 619 + src: "0:0:0" + typeString: "contract UsesNewAddressMembers" + kind: "functionCall" + fieldNames: undefined + vExpression: NewExpression #618 + vArguments: Array(0) + context: ASTContext #1000 + parent: VariableDeclarationStatement #620 + children: Array(1) [ NewExpression #618 ] + vIdentifier: "new" + vMemberName: undefined + vFunctionCallType: "builtin" + vReferencedDeclaration: undefined + vFunctionName: "new" + vCallee: NewExpression #618 + type: "FunctionCall" + firstChild: NewExpression #618 + lastChild: NewExpression #618 + previousSibling: VariableDeclaration #615 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + NewExpression #618 + id: 618 + src: "0:0:0" + typeString: "function () returns (contract UsesNewAddressMembers)" + vTypeName: UserDefinedTypeName #617 + context: ASTContext #1000 + parent: FunctionCall #619 + children: Array(1) [ UserDefinedTypeName #617 ] + type: "NewExpression" + firstChild: UserDefinedTypeName #617 + lastChild: UserDefinedTypeName #617 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + UserDefinedTypeName #617 + id: 617 + src: "0:0:0" + typeString: "contract UsesNewAddressMembers" + name: undefined + referencedDeclaration: 610 + path: IdentifierPath #616 + context: ASTContext #1000 + parent: NewExpression #618 + children: Array(1) [ IdentifierPath #616 ] + vReferencedDeclaration: ContractDefinition #610 + type: "UserDefinedTypeName" + firstChild: IdentifierPath #616 + lastChild: IdentifierPath #616 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + IdentifierPath #616 + id: 616 + src: "0:0:0" + name: "UsesNewAddressMembers" + referencedDeclaration: 84 + context: ASTContext #1000 + parent: UserDefinedTypeName #617 + vReferencedDeclaration: ContractDefinition #84 + type: "IdentifierPath" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + TryStatement #664 + id: 664 + src: "0:0:0" + documentation: undefined + vExternalCall: FunctionCall #623 + vClauses: Array(4) [ TryCatchClause #625, TryCatchClause #634, TryCatchClause #657, TryCatchClause #663 ] + context: ASTContext #1000 + parent: Block #665 + children: Array(5) [ FunctionCall #623, TryCatchClause #625, TryCatchClause #634, TryCatchClause #657, TryCatchClause #663 ] + type: "TryStatement" + firstChild: FunctionCall #623 + lastChild: TryCatchClause #663 + previousSibling: VariableDeclarationStatement #620 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionCall #623 + id: 623 + src: "0:0:0" + typeString: "tuple()" + kind: "functionCall" + fieldNames: undefined + vExpression: MemberAccess #622 + vArguments: Array(0) + context: ASTContext #1000 + parent: TryStatement #664 + children: Array(1) [ MemberAccess #622 ] + vIdentifier: "c" + vMemberName: "test" + vFunctionCallType: "userDefined" + vReferencedDeclaration: FunctionDefinition #609 + vFunctionName: "test" + vCallee: MemberAccess #622 + type: "FunctionCall" + firstChild: MemberAccess #622 + lastChild: MemberAccess #622 + previousSibling: undefined + nextSibling: TryCatchClause #625 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + MemberAccess #622 + id: 622 + src: "0:0:0" + typeString: "function () external" + vExpression: Identifier #621 + memberName: "test" + referencedDeclaration: 609 + context: ASTContext #1000 + parent: FunctionCall #623 + children: Array(1) [ Identifier #621 ] + vReferencedDeclaration: FunctionDefinition #609 + type: "MemberAccess" + firstChild: Identifier #621 + lastChild: Identifier #621 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #621 + id: 621 + src: "0:0:0" + typeString: "contract UsesNewAddressMembers" + name: "c" + referencedDeclaration: 615 + context: ASTContext #1000 + parent: MemberAccess #622 + vReferencedDeclaration: VariableDeclaration #615 + vIdentifierType: "userDefined" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + TryCatchClause #625 + id: 625 + src: "0:0:0" + documentation: undefined + errorName: "" + vParameters: undefined + vBlock: Block #624 + context: ASTContext #1000 + parent: TryStatement #664 + children: Array(1) [ Block #624 ] + type: "TryCatchClause" + firstChild: Block #624 + lastChild: Block #624 + previousSibling: FunctionCall #623 + nextSibling: TryCatchClause #634 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Block #624 + id: 624 + src: "0:0:0" + documentation: undefined + context: ASTContext #1000 + parent: TryCatchClause #625 + vStatements: Array(0) + children: Array(0) + type: "Block" + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + TryCatchClause #634 + id: 634 + src: "0:0:0" + documentation: undefined + errorName: "Error" + vParameters: ParameterList #633 + vBlock: Block #630 + context: ASTContext #1000 + parent: TryStatement #664 + children: Array(2) [ ParameterList #633, Block #630 ] + type: "TryCatchClause" + firstChild: ParameterList #633 + lastChild: Block #630 + previousSibling: TryCatchClause #625 + nextSibling: TryCatchClause #657 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #633 + id: 633 + src: "0:0:0" + context: ASTContext #1000 + parent: TryCatchClause #634 + vParameters: Array(1) [ VariableDeclaration #632 ] + children: Array(1) [ VariableDeclaration #632 ] + type: "ParameterList" + firstChild: VariableDeclaration #632 + lastChild: VariableDeclaration #632 + previousSibling: undefined + nextSibling: Block #630 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #632 + id: 632 + src: "0:0:0" + constant: false + indexed: false + name: "reason" + scope: 634 + stateVariable: false + storageLocation: "memory" + visibility: "internal" + mutability: "mutable" + typeString: "string" + documentation: undefined + nameLocation: "998:6:0" + vType: ElementaryTypeName #631 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: ParameterList #633 + children: Array(1) [ ElementaryTypeName #631 ] + vScope: TryCatchClause #634 + type: "VariableDeclaration" + firstChild: ElementaryTypeName #631 + lastChild: ElementaryTypeName #631 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #631 + id: 631 + src: "0:0:0" + typeString: "string" + name: "string" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: VariableDeclaration #632 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Block #630 + id: 630 + src: "0:0:0" + documentation: undefined + context: ASTContext #1000 + parent: TryCatchClause #634 + vStatements: Array(1) [ ExpressionStatement #629 ] + children: Array(1) [ ExpressionStatement #629 ] + type: "Block" + firstChild: ExpressionStatement #629 + lastChild: ExpressionStatement #629 + previousSibling: ParameterList #633 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ExpressionStatement #629 + id: 629 + src: "0:0:0" + documentation: undefined + vExpression: FunctionCall #628 + context: ASTContext #1000 + parent: Block #630 + children: Array(1) [ FunctionCall #628 ] + type: "ExpressionStatement" + firstChild: FunctionCall #628 + lastChild: FunctionCall #628 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionCall #628 + id: 628 + src: "0:0:0" + typeString: "tuple()" + kind: "functionCall" + fieldNames: undefined + vExpression: Identifier #626 + vArguments: Array(1) [ Identifier #627 ] + context: ASTContext #1000 + parent: ExpressionStatement #629 + children: Array(2) [ Identifier #626, Identifier #627 ] + vIdentifier: "revert" + vMemberName: undefined + vFunctionCallType: "builtin" + vReferencedDeclaration: undefined + vFunctionName: "revert" + vCallee: Identifier #626 + type: "FunctionCall" + firstChild: Identifier #626 + lastChild: Identifier #627 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #626 + id: 626 + src: "0:0:0" + typeString: "function (string memory) pure" + name: "revert" + referencedDeclaration: -19 + context: ASTContext #1000 + parent: FunctionCall #628 + vReferencedDeclaration: undefined + vIdentifierType: "builtin" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: Identifier #627 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #627 + id: 627 + src: "0:0:0" + typeString: "string memory" + name: "reason" + referencedDeclaration: 632 + context: ASTContext #1000 + parent: FunctionCall #628 + vReferencedDeclaration: VariableDeclaration #632 + vIdentifierType: "userDefined" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: Identifier #626 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + TryCatchClause #657 + id: 657 + src: "0:0:0" + documentation: undefined + errorName: "Panic" + vParameters: ParameterList #656 + vBlock: Block #653 + context: ASTContext #1000 + parent: TryStatement #664 + children: Array(2) [ ParameterList #656, Block #653 ] + type: "TryCatchClause" + firstChild: ParameterList #656 + lastChild: Block #653 + previousSibling: TryCatchClause #634 + nextSibling: TryCatchClause #663 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #656 + id: 656 + src: "0:0:0" + context: ASTContext #1000 + parent: TryCatchClause #657 + vParameters: Array(1) [ VariableDeclaration #655 ] + children: Array(1) [ VariableDeclaration #655 ] + type: "ParameterList" + firstChild: VariableDeclaration #655 + lastChild: VariableDeclaration #655 + previousSibling: undefined + nextSibling: Block #653 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #655 + id: 655 + src: "0:0:0" + constant: false + indexed: false + name: "_code" + scope: 657 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "uint256" + documentation: undefined + nameLocation: "1063:5:0" + vType: ElementaryTypeName #654 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: ParameterList #656 + children: Array(1) [ ElementaryTypeName #654 ] + vScope: TryCatchClause #657 + type: "VariableDeclaration" + firstChild: ElementaryTypeName #654 + lastChild: ElementaryTypeName #654 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #654 + id: 654 + src: "0:0:0" + typeString: "uint256" + name: "uint" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: VariableDeclaration #655 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Block #653 + id: 653 + src: "0:0:0" + documentation: undefined + context: ASTContext #1000 + parent: TryCatchClause #657 + vStatements: Array(1) [ IfStatement #652 ] + children: Array(1) [ IfStatement #652 ] + type: "Block" + firstChild: IfStatement #652 + lastChild: IfStatement #652 + previousSibling: ParameterList #656 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + IfStatement #652 + id: 652 + src: "0:0:0" + documentation: undefined + vCondition: BinaryOperation #637 + vTrueBody: Block #642 + vFalseBody: IfStatement #651 + context: ASTContext #1000 + parent: Block #653 + children: Array(3) [ BinaryOperation #637, Block #642, IfStatement #651 ] + type: "IfStatement" + firstChild: BinaryOperation #637 + lastChild: IfStatement #651 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + BinaryOperation #637 + id: 637 + src: "0:0:0" + typeString: "bool" + operator: "==" + vLeftExpression: Identifier #635 + vRightExpression: Literal #636 + context: ASTContext #1000 + parent: IfStatement #652 + children: Array(2) [ Identifier #635, Literal #636 ] + type: "BinaryOperation" + firstChild: Identifier #635 + lastChild: Literal #636 + previousSibling: undefined + nextSibling: Block #642 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #635 + id: 635 + src: "0:0:0" + typeString: "uint256" + name: "_code" + referencedDeclaration: 655 + context: ASTContext #1000 + parent: BinaryOperation #637 + vReferencedDeclaration: VariableDeclaration #655 + vIdentifierType: "userDefined" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: Literal #636 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Literal #636 + id: 636 + src: "0:0:0" + typeString: "int_const 1" + kind: "number" + hexValue: "30783031" + value: "0x01" + subdenomination: undefined + context: ASTContext #1000 + parent: BinaryOperation #637 + type: "Literal" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: Identifier #635 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Block #642 + id: 642 + src: "0:0:0" + documentation: undefined + context: ASTContext #1000 + parent: IfStatement #652 + vStatements: Array(1) [ ExpressionStatement #641 ] + children: Array(1) [ ExpressionStatement #641 ] + type: "Block" + firstChild: ExpressionStatement #641 + lastChild: ExpressionStatement #641 + previousSibling: BinaryOperation #637 + nextSibling: IfStatement #651 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ExpressionStatement #641 + id: 641 + src: "0:0:0" + documentation: undefined + vExpression: FunctionCall #640 + context: ASTContext #1000 + parent: Block #642 + children: Array(1) [ FunctionCall #640 ] + type: "ExpressionStatement" + firstChild: FunctionCall #640 + lastChild: FunctionCall #640 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionCall #640 + id: 640 + src: "0:0:0" + typeString: "tuple()" + kind: "functionCall" + fieldNames: undefined + vExpression: Identifier #638 + vArguments: Array(1) [ Literal #639 ] + context: ASTContext #1000 + parent: ExpressionStatement #641 + children: Array(2) [ Identifier #638, Literal #639 ] + vIdentifier: "revert" + vMemberName: undefined + vFunctionCallType: "builtin" + vReferencedDeclaration: undefined + vFunctionName: "revert" + vCallee: Identifier #638 + type: "FunctionCall" + firstChild: Identifier #638 + lastChild: Literal #639 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #638 + id: 638 + src: "0:0:0" + typeString: "function (string memory) pure" + name: "revert" + referencedDeclaration: -19 + context: ASTContext #1000 + parent: FunctionCall #640 + vReferencedDeclaration: undefined + vIdentifierType: "builtin" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: Literal #639 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Literal #639 + id: 639 + src: "0:0:0" + typeString: "literal_string \"Assertion failed\"" + kind: "string" + hexValue: "417373657274696f6e206661696c6564" + value: "Assertion failed" + subdenomination: undefined + context: ASTContext #1000 + parent: FunctionCall #640 + type: "Literal" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: Identifier #638 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + IfStatement #651 + id: 651 + src: "0:0:0" + documentation: undefined + vCondition: BinaryOperation #645 + vTrueBody: Block #650 + vFalseBody: undefined + context: ASTContext #1000 + parent: IfStatement #652 + children: Array(2) [ BinaryOperation #645, Block #650 ] + type: "IfStatement" + firstChild: BinaryOperation #645 + lastChild: Block #650 + previousSibling: Block #642 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + BinaryOperation #645 + id: 645 + src: "0:0:0" + typeString: "bool" + operator: "==" + vLeftExpression: Identifier #643 + vRightExpression: Literal #644 + context: ASTContext #1000 + parent: IfStatement #651 + children: Array(2) [ Identifier #643, Literal #644 ] + type: "BinaryOperation" + firstChild: Identifier #643 + lastChild: Literal #644 + previousSibling: undefined + nextSibling: Block #650 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #643 + id: 643 + src: "0:0:0" + typeString: "uint256" + name: "_code" + referencedDeclaration: 655 + context: ASTContext #1000 + parent: BinaryOperation #645 + vReferencedDeclaration: VariableDeclaration #655 + vIdentifierType: "userDefined" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: Literal #644 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Literal #644 + id: 644 + src: "0:0:0" + typeString: "int_const 17" + kind: "number" + hexValue: "30783131" + value: "0x11" + subdenomination: undefined + context: ASTContext #1000 + parent: BinaryOperation #645 + type: "Literal" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: Identifier #643 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Block #650 + id: 650 + src: "0:0:0" + documentation: undefined + context: ASTContext #1000 + parent: IfStatement #651 + vStatements: Array(1) [ ExpressionStatement #649 ] + children: Array(1) [ ExpressionStatement #649 ] + type: "Block" + firstChild: ExpressionStatement #649 + lastChild: ExpressionStatement #649 + previousSibling: BinaryOperation #645 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ExpressionStatement #649 + id: 649 + src: "0:0:0" + documentation: undefined + vExpression: FunctionCall #648 + context: ASTContext #1000 + parent: Block #650 + children: Array(1) [ FunctionCall #648 ] + type: "ExpressionStatement" + firstChild: FunctionCall #648 + lastChild: FunctionCall #648 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionCall #648 + id: 648 + src: "0:0:0" + typeString: "tuple()" + kind: "functionCall" + fieldNames: undefined + vExpression: Identifier #646 + vArguments: Array(1) [ Literal #647 ] + context: ASTContext #1000 + parent: ExpressionStatement #649 + children: Array(2) [ Identifier #646, Literal #647 ] + vIdentifier: "revert" + vMemberName: undefined + vFunctionCallType: "builtin" + vReferencedDeclaration: undefined + vFunctionName: "revert" + vCallee: Identifier #646 + type: "FunctionCall" + firstChild: Identifier #646 + lastChild: Literal #647 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #646 + id: 646 + src: "0:0:0" + typeString: "function (string memory) pure" + name: "revert" + referencedDeclaration: -19 + context: ASTContext #1000 + parent: FunctionCall #648 + vReferencedDeclaration: undefined + vIdentifierType: "builtin" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: Literal #647 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Literal #647 + id: 647 + src: "0:0:0" + typeString: "literal_string \"Underflow/overflow\"" + kind: "string" + hexValue: "556e646572666c6f772f6f766572666c6f77" + value: "Underflow/overflow" + subdenomination: undefined + context: ASTContext #1000 + parent: FunctionCall #648 + type: "Literal" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: Identifier #646 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + TryCatchClause #663 + id: 663 + src: "0:0:0" + documentation: undefined + errorName: "" + vParameters: undefined + vBlock: Block #662 + context: ASTContext #1000 + parent: TryStatement #664 + children: Array(1) [ Block #662 ] + type: "TryCatchClause" + firstChild: Block #662 + lastChild: Block #662 + previousSibling: TryCatchClause #657 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Block #662 + id: 662 + src: "0:0:0" + documentation: undefined + context: ASTContext #1000 + parent: TryCatchClause #663 + vStatements: Array(1) [ ExpressionStatement #661 ] + children: Array(1) [ ExpressionStatement #661 ] + type: "Block" + firstChild: ExpressionStatement #661 + lastChild: ExpressionStatement #661 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ExpressionStatement #661 + id: 661 + src: "0:0:0" + documentation: undefined + vExpression: FunctionCall #660 + context: ASTContext #1000 + parent: Block #662 + children: Array(1) [ FunctionCall #660 ] + type: "ExpressionStatement" + firstChild: FunctionCall #660 + lastChild: FunctionCall #660 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionCall #660 + id: 660 + src: "0:0:0" + typeString: "tuple()" + kind: "functionCall" + fieldNames: undefined + vExpression: Identifier #658 + vArguments: Array(1) [ Literal #659 ] + context: ASTContext #1000 + parent: ExpressionStatement #661 + children: Array(2) [ Identifier #658, Literal #659 ] + vIdentifier: "revert" + vMemberName: undefined + vFunctionCallType: "builtin" + vReferencedDeclaration: undefined + vFunctionName: "revert" + vCallee: Identifier #658 + type: "FunctionCall" + firstChild: Identifier #658 + lastChild: Literal #659 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #658 + id: 658 + src: "0:0:0" + typeString: "function (string memory) pure" + name: "revert" + referencedDeclaration: -19 + context: ASTContext #1000 + parent: FunctionCall #660 + vReferencedDeclaration: undefined + vIdentifierType: "builtin" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: Literal #659 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Literal #659 + id: 659 + src: "0:0:0" + typeString: "literal_string \"Internal error\"" + kind: "string" + hexValue: "496e7465726e616c206572726f72" + value: "Internal error" + subdenomination: undefined + context: ASTContext #1000 + parent: FunctionCall #660 + type: "Literal" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: Identifier #658 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ContractDefinition #752 + id: 752 + src: "0:0:0" + name: "Features082" + scope: 1037 + kind: "contract" + abstract: false + fullyImplemented: true + linearizedBaseContracts: Array(1) [ 752 ] + usedErrors: Array(0) + docString: undefined + nameLocation: "1333:11:0" + context: ASTContext #1000 + parent: SourceUnit #1037 + documentation: undefined + vScope: SourceUnit #1037 + vLinearizedBaseContracts: Array(1) [ ContractDefinition #752 ] + vUsedErrors: Array(0) + vInheritanceSpecifiers: Array(0) + vStateVariables: Array(0) + vModifiers: Array(1) [ ModifierDefinition #679 ] + vEvents: Array(1) [ EventDefinition #671 ] + vErrors: Array(0) + vFunctions: Array(1) [ FunctionDefinition #751 ] + vUsingForDirectives: Array(0) + vStructs: Array(0) + vEnums: Array(1) [ EnumDefinition #675 ] + vUserDefinedValueTypes: Array(0) + vConstructor: undefined + children: Array(4) [ EventDefinition #671, EnumDefinition #675, ModifierDefinition #679, FunctionDefinition #751 ] + type: "ContractDefinition" + firstChild: EventDefinition #671 + lastChild: FunctionDefinition #751 + previousSibling: ContractDefinition #667 + nextSibling: ErrorDefinition #757 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + EventDefinition #671 + id: 671 + src: "0:0:0" + anonymous: false + name: "Ev" + documentation: undefined + nameLocation: "1357:2:0" + vParameters: ParameterList #670 + context: ASTContext #1000 + parent: ContractDefinition #752 + children: Array(1) [ ParameterList #670 ] + vScope: ContractDefinition #752 + type: "EventDefinition" + firstChild: ParameterList #670 + lastChild: ParameterList #670 + previousSibling: undefined + nextSibling: EnumDefinition #675 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #670 + id: 670 + src: "0:0:0" + context: ASTContext #1000 + parent: EventDefinition #671 + vParameters: Array(1) [ VariableDeclaration #669 ] + children: Array(1) [ VariableDeclaration #669 ] + type: "ParameterList" + firstChild: VariableDeclaration #669 + lastChild: VariableDeclaration #669 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #669 + id: 669 + src: "0:0:0" + constant: false + indexed: false + name: "a" + scope: 671 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "uint256" + documentation: undefined + nameLocation: "1365:1:0" + vType: ElementaryTypeName #668 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: ParameterList #670 + children: Array(1) [ ElementaryTypeName #668 ] + vScope: EventDefinition #671 + type: "VariableDeclaration" + firstChild: ElementaryTypeName #668 + lastChild: ElementaryTypeName #668 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #668 + id: 668 + src: "0:0:0" + typeString: "uint256" + name: "uint" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: VariableDeclaration #669 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + EnumDefinition #675 + id: 675 + src: "0:0:0" + name: "EnumXYZ" + nameLocation: "1379:7:0" + context: ASTContext #1000 + parent: ContractDefinition #752 + canonicalName: "Features082.EnumXYZ" + vMembers: Array(3) [ EnumValue #672, EnumValue #673, EnumValue #674 ] + vScope: ContractDefinition #752 + children: Array(3) [ EnumValue #672, EnumValue #673, EnumValue #674 ] + type: "EnumDefinition" + firstChild: EnumValue #672 + lastChild: EnumValue #674 + previousSibling: EventDefinition #671 + nextSibling: ModifierDefinition #679 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + EnumValue #672 + id: 672 + src: "0:0:0" + name: "X" + nameLocation: "1397:1:0" + context: ASTContext #1000 + parent: EnumDefinition #675 + type: "EnumValue" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: EnumValue #673 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + EnumValue #673 + id: 673 + src: "0:0:0" + name: "Y" + nameLocation: "1400:1:0" + context: ASTContext #1000 + parent: EnumDefinition #675 + type: "EnumValue" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: EnumValue #672 + nextSibling: EnumValue #674 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + EnumValue #674 + id: 674 + src: "0:0:0" + name: "Z" + nameLocation: "1403:1:0" + context: ASTContext #1000 + parent: EnumDefinition #675 + type: "EnumValue" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: EnumValue #673 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ModifierDefinition #679 + id: 679 + src: "0:0:0" + name: "modStructDocs" + virtual: false + visibility: "internal" + documentation: undefined + nameLocation: "1425:13:0" + vParameters: ParameterList #676 + vOverrideSpecifier: undefined + vBody: Block #678 + context: ASTContext #1000 + parent: ContractDefinition #752 + children: Array(2) [ ParameterList #676, Block #678 ] + vScope: ContractDefinition #752 + type: "ModifierDefinition" + firstChild: ParameterList #676 + lastChild: Block #678 + previousSibling: EnumDefinition #675 + nextSibling: FunctionDefinition #751 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #676 + id: 676 + src: "0:0:0" + context: ASTContext #1000 + parent: ModifierDefinition #679 + vParameters: Array(0) + children: Array(0) + type: "ParameterList" + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: Block #678 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Block #678 + id: 678 + src: "0:0:0" + documentation: undefined + context: ASTContext #1000 + parent: ModifierDefinition #679 + vStatements: Array(1) [ PlaceholderStatement #677 ] + children: Array(1) [ PlaceholderStatement #677 ] + type: "Block" + firstChild: PlaceholderStatement #677 + lastChild: PlaceholderStatement #677 + previousSibling: ParameterList #676 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + PlaceholderStatement #677 + id: 677 + src: "0:0:0" + documentation: "PlaceholderStatement docstring" + context: ASTContext #1000 + parent: Block #678 + type: "PlaceholderStatement" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionDefinition #751 + id: 751 + src: "0:0:0" + implemented: true + virtual: false + scope: 752 + kind: "function" + name: "stmtStructDocs" + visibility: "public" + stateMutability: "nonpayable" + isConstructor: false + documentation: undefined + nameLocation: "1517:14:0" + vParameters: ParameterList #680 + vReturnParameters: ParameterList #681 + vModifiers: Array(1) [ ModifierInvocation #683 ] + vOverrideSpecifier: undefined + vBody: Block #750 + context: ASTContext #1000 + parent: ContractDefinition #752 + children: Array(4) [ ParameterList #680, ModifierInvocation #683, ParameterList #681, Block #750 ] + vScope: ContractDefinition #752 + type: "FunctionDefinition" + firstChild: ParameterList #680 + lastChild: Block #750 + previousSibling: ModifierDefinition #679 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #680 + id: 680 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #751 + vParameters: Array(0) + children: Array(0) + type: "ParameterList" + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: ModifierInvocation #683 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ModifierInvocation #683 + id: 683 + src: "0:0:0" + kind: "modifierInvocation" + vModifierName: IdentifierPath #682 + vArguments: Array(0) + context: ASTContext #1000 + parent: FunctionDefinition #751 + children: Array(1) [ IdentifierPath #682 ] + vModifier: ModifierDefinition #153 + type: "ModifierInvocation" + firstChild: IdentifierPath #682 + lastChild: IdentifierPath #682 + previousSibling: ParameterList #680 + nextSibling: ParameterList #681 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + IdentifierPath #682 + id: 682 + src: "0:0:0" + name: "modStructDocs" + referencedDeclaration: 153 + context: ASTContext #1000 + parent: ModifierInvocation #683 + vReferencedDeclaration: ModifierDefinition #153 + type: "IdentifierPath" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #681 + id: 681 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #751 + vParameters: Array(0) + children: Array(0) + type: "ParameterList" + firstChild: undefined + lastChild: undefined + previousSibling: ModifierInvocation #683 + nextSibling: Block #750 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Block #750 + id: 750 + src: "0:0:0" + documentation: undefined + context: ASTContext #1000 + parent: FunctionDefinition #751 + vStatements: Array(13) [ VariableDeclarationStatement #688, ExpressionStatement #690, Block #691, EmitStatement #695, WhileStatement #699, DoWhileStatement #703, ForStatement #716, IfStatement #720, VariableDeclarationStatement #728, TryStatement #746, InlineAssembly #747, UncheckedBlock #748, Return #749 ] + children: Array(13) [ VariableDeclarationStatement #688, ExpressionStatement #690, Block #691, EmitStatement #695, WhileStatement #699, DoWhileStatement #703, ForStatement #716, IfStatement #720, VariableDeclarationStatement #728, TryStatement #746, InlineAssembly #747, UncheckedBlock #748, Return #749 ] + type: "Block" + firstChild: VariableDeclarationStatement #688 + lastChild: Return #749 + previousSibling: ParameterList #681 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclarationStatement #688 + id: 688 + src: "0:0:0" + documentation: "VariableDeclarationStatement docstring" + assignments: Array(1) [ 685 ] + vDeclarations: Array(1) [ VariableDeclaration #685 ] + vInitialValue: TupleExpression #687 + context: ASTContext #1000 + parent: Block #750 + children: Array(2) [ VariableDeclaration #685, TupleExpression #687 ] + type: "VariableDeclarationStatement" + firstChild: VariableDeclaration #685 + lastChild: TupleExpression #687 + previousSibling: undefined + nextSibling: ExpressionStatement #690 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #685 + id: 685 + src: "0:0:0" + constant: false + indexed: false + name: "a" + scope: 750 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "uint256" + documentation: undefined + nameLocation: "1624:1:0" + vType: ElementaryTypeName #684 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: VariableDeclarationStatement #688 + children: Array(1) [ ElementaryTypeName #684 ] + vScope: Block #750 + type: "VariableDeclaration" + firstChild: ElementaryTypeName #684 + lastChild: ElementaryTypeName #684 + previousSibling: undefined + nextSibling: TupleExpression #687 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #684 + id: 684 + src: "0:0:0" + typeString: "uint256" + name: "uint" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: VariableDeclaration #685 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + TupleExpression #687 + id: 687 + src: "0:0:0" + typeString: "int_const 1" + isInlineArray: false + vOriginalComponents: Array(1) [ Literal #686 ] + context: ASTContext #1000 + parent: VariableDeclarationStatement #688 + children: Array(1) [ Literal #686 ] + components: Array(1) [ 686 ] + vComponents: Array(1) [ Literal #686 ] + type: "TupleExpression" + firstChild: Literal #686 + lastChild: Literal #686 + previousSibling: VariableDeclaration #685 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Literal #686 + id: 686 + src: "0:0:0" + typeString: "int_const 1" + kind: "number" + hexValue: "31" + value: "1" + subdenomination: undefined + context: ASTContext #1000 + parent: TupleExpression #687 + type: "Literal" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ExpressionStatement #690 + id: 690 + src: "0:0:0" + documentation: "ExpressionStatement docstring" + vExpression: Literal #689 + context: ASTContext #1000 + parent: Block #750 + children: Array(1) [ Literal #689 ] + type: "ExpressionStatement" + firstChild: Literal #689 + lastChild: Literal #689 + previousSibling: VariableDeclarationStatement #688 + nextSibling: Block #691 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Literal #689 + id: 689 + src: "0:0:0" + typeString: "int_const 1" + kind: "number" + hexValue: "31" + value: "1" + subdenomination: undefined + context: ASTContext #1000 + parent: ExpressionStatement #690 + type: "Literal" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Block #691 + id: 691 + src: "0:0:0" + documentation: "Block docstring" + context: ASTContext #1000 + parent: Block #750 + vStatements: Array(0) + children: Array(0) + type: "Block" + firstChild: undefined + lastChild: undefined + previousSibling: ExpressionStatement #690 + nextSibling: EmitStatement #695 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + EmitStatement #695 + id: 695 + src: "0:0:0" + documentation: "EmitStatement docstring" + vEventCall: FunctionCall #694 + context: ASTContext #1000 + parent: Block #750 + children: Array(1) [ FunctionCall #694 ] + type: "EmitStatement" + firstChild: FunctionCall #694 + lastChild: FunctionCall #694 + previousSibling: Block #691 + nextSibling: WhileStatement #699 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionCall #694 + id: 694 + src: "0:0:0" + typeString: "tuple()" + kind: "functionCall" + fieldNames: undefined + vExpression: Identifier #692 + vArguments: Array(1) [ Literal #693 ] + context: ASTContext #1000 + parent: EmitStatement #695 + children: Array(2) [ Identifier #692, Literal #693 ] + vIdentifier: "Ev" + vMemberName: undefined + vFunctionCallType: "userDefined" + vReferencedDeclaration: EventDefinition #671 + vFunctionName: "Ev" + vCallee: Identifier #692 + type: "FunctionCall" + firstChild: Identifier #692 + lastChild: Literal #693 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #692 + id: 692 + src: "0:0:0" + typeString: "function (uint256)" + name: "Ev" + referencedDeclaration: 671 + context: ASTContext #1000 + parent: FunctionCall #694 + vReferencedDeclaration: EventDefinition #671 + vIdentifierType: "userDefined" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: Literal #693 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Literal #693 + id: 693 + src: "0:0:0" + typeString: "int_const 1" + kind: "number" + hexValue: "31" + value: "1" + subdenomination: undefined + context: ASTContext #1000 + parent: FunctionCall #694 + type: "Literal" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: Identifier #692 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + WhileStatement #699 + id: 699 + src: "0:0:0" + documentation: "WhileStatement docstring" + vCondition: Literal #696 + vBody: Block #698 + context: ASTContext #1000 + parent: Block #750 + children: Array(2) [ Literal #696, Block #698 ] + type: "WhileStatement" + firstChild: Literal #696 + lastChild: Block #698 + previousSibling: EmitStatement #695 + nextSibling: DoWhileStatement #703 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Literal #696 + id: 696 + src: "0:0:0" + typeString: "bool" + kind: "bool" + hexValue: "66616c7365" + value: "false" + subdenomination: undefined + context: ASTContext #1000 + parent: WhileStatement #699 + type: "Literal" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: Block #698 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Block #698 + id: 698 + src: "0:0:0" + documentation: "Body Block docstring" + context: ASTContext #1000 + parent: WhileStatement #699 + vStatements: Array(1) [ Continue #697 ] + children: Array(1) [ Continue #697 ] + type: "Block" + firstChild: Continue #697 + lastChild: Continue #697 + previousSibling: Literal #696 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Continue #697 + id: 697 + src: "0:0:0" + documentation: "Continue docstring" + context: ASTContext #1000 + parent: Block #698 + type: "Continue" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + DoWhileStatement #703 + id: 703 + src: "0:0:0" + documentation: "DoWhileStatement docstring" + vCondition: Literal #700 + vBody: Block #702 + context: ASTContext #1000 + parent: Block #750 + children: Array(2) [ Literal #700, Block #702 ] + type: "DoWhileStatement" + firstChild: Literal #700 + lastChild: Block #702 + previousSibling: WhileStatement #699 + nextSibling: ForStatement #716 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Literal #700 + id: 700 + src: "0:0:0" + typeString: "bool" + kind: "bool" + hexValue: "74727565" + value: "true" + subdenomination: undefined + context: ASTContext #1000 + parent: DoWhileStatement #703 + type: "Literal" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: Block #702 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Block #702 + id: 702 + src: "0:0:0" + documentation: "Body Block docstring" + context: ASTContext #1000 + parent: DoWhileStatement #703 + vStatements: Array(1) [ Break #701 ] + children: Array(1) [ Break #701 ] + type: "Block" + firstChild: Break #701 + lastChild: Break #701 + previousSibling: Literal #700 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Break #701 + id: 701 + src: "0:0:0" + documentation: "Break docstring" + context: ASTContext #1000 + parent: Block #702 + type: "Break" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ForStatement #716 + id: 716 + src: "0:0:0" + documentation: "ForStatement docstring" + vInitializationExpression: VariableDeclarationStatement #709 + vCondition: BinaryOperation #712 + vLoopExpression: ExpressionStatement #715 + vBody: Block #704 + context: ASTContext #1000 + parent: Block #750 + children: Array(4) [ VariableDeclarationStatement #709, BinaryOperation #712, ExpressionStatement #715, Block #704 ] + type: "ForStatement" + firstChild: VariableDeclarationStatement #709 + lastChild: Block #704 + previousSibling: DoWhileStatement #703 + nextSibling: IfStatement #720 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclarationStatement #709 + id: 709 + src: "0:0:0" + documentation: undefined + assignments: Array(1) [ 706 ] + vDeclarations: Array(1) [ VariableDeclaration #706 ] + vInitialValue: TupleExpression #708 + context: ASTContext #1000 + parent: ForStatement #716 + children: Array(2) [ VariableDeclaration #706, TupleExpression #708 ] + type: "VariableDeclarationStatement" + firstChild: VariableDeclaration #706 + lastChild: TupleExpression #708 + previousSibling: undefined + nextSibling: BinaryOperation #712 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #706 + id: 706 + src: "0:0:0" + constant: false + indexed: false + name: "n" + scope: 716 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "uint256" + documentation: undefined + nameLocation: "2258:1:0" + vType: ElementaryTypeName #705 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: VariableDeclarationStatement #709 + children: Array(1) [ ElementaryTypeName #705 ] + vScope: ForStatement #716 + type: "VariableDeclaration" + firstChild: ElementaryTypeName #705 + lastChild: ElementaryTypeName #705 + previousSibling: undefined + nextSibling: TupleExpression #708 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #705 + id: 705 + src: "0:0:0" + typeString: "uint256" + name: "uint" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: VariableDeclaration #706 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + TupleExpression #708 + id: 708 + src: "0:0:0" + typeString: "int_const 1" + isInlineArray: false + vOriginalComponents: Array(1) [ Literal #707 ] + context: ASTContext #1000 + parent: VariableDeclarationStatement #709 + children: Array(1) [ Literal #707 ] + components: Array(1) [ 707 ] + vComponents: Array(1) [ Literal #707 ] + type: "TupleExpression" + firstChild: Literal #707 + lastChild: Literal #707 + previousSibling: VariableDeclaration #706 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Literal #707 + id: 707 + src: "0:0:0" + typeString: "int_const 1" + kind: "number" + hexValue: "31" + value: "1" + subdenomination: undefined + context: ASTContext #1000 + parent: TupleExpression #708 + type: "Literal" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + BinaryOperation #712 + id: 712 + src: "0:0:0" + typeString: "bool" + operator: "<" + vLeftExpression: Identifier #710 + vRightExpression: Literal #711 + context: ASTContext #1000 + parent: ForStatement #716 + children: Array(2) [ Identifier #710, Literal #711 ] + type: "BinaryOperation" + firstChild: Identifier #710 + lastChild: Literal #711 + previousSibling: VariableDeclarationStatement #709 + nextSibling: ExpressionStatement #715 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #710 + id: 710 + src: "0:0:0" + typeString: "uint256" + name: "n" + referencedDeclaration: 706 + context: ASTContext #1000 + parent: BinaryOperation #712 + vReferencedDeclaration: VariableDeclaration #706 + vIdentifierType: "userDefined" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: Literal #711 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Literal #711 + id: 711 + src: "0:0:0" + typeString: "int_const 1" + kind: "number" + hexValue: "31" + value: "1" + subdenomination: undefined + context: ASTContext #1000 + parent: BinaryOperation #712 + type: "Literal" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: Identifier #710 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ExpressionStatement #715 + id: 715 + src: "0:0:0" + documentation: undefined + vExpression: UnaryOperation #714 + context: ASTContext #1000 + parent: ForStatement #716 + children: Array(1) [ UnaryOperation #714 ] + type: "ExpressionStatement" + firstChild: UnaryOperation #714 + lastChild: UnaryOperation #714 + previousSibling: BinaryOperation #712 + nextSibling: Block #704 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + UnaryOperation #714 + id: 714 + src: "0:0:0" + typeString: "uint256" + prefix: false + operator: "++" + vSubExpression: Identifier #713 + context: ASTContext #1000 + parent: ExpressionStatement #715 + children: Array(1) [ Identifier #713 ] + type: "UnaryOperation" + firstChild: Identifier #713 + lastChild: Identifier #713 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #713 + id: 713 + src: "0:0:0" + typeString: "uint256" + name: "n" + referencedDeclaration: 706 + context: ASTContext #1000 + parent: UnaryOperation #714 + vReferencedDeclaration: VariableDeclaration #706 + vIdentifierType: "userDefined" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Block #704 + id: 704 + src: "0:0:0" + documentation: "Body Block docstring" + context: ASTContext #1000 + parent: ForStatement #716 + vStatements: Array(0) + children: Array(0) + type: "Block" + firstChild: undefined + lastChild: undefined + previousSibling: ExpressionStatement #715 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + IfStatement #720 + id: 720 + src: "0:0:0" + documentation: "IfStatement docstring" + vCondition: Literal #717 + vTrueBody: Block #718 + vFalseBody: Block #719 + context: ASTContext #1000 + parent: Block #750 + children: Array(3) [ Literal #717, Block #718, Block #719 ] + type: "IfStatement" + firstChild: Literal #717 + lastChild: Block #719 + previousSibling: ForStatement #716 + nextSibling: VariableDeclarationStatement #728 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Literal #717 + id: 717 + src: "0:0:0" + typeString: "bool" + kind: "bool" + hexValue: "66616c7365" + value: "false" + subdenomination: undefined + context: ASTContext #1000 + parent: IfStatement #720 + type: "Literal" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: Block #718 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Block #718 + id: 718 + src: "0:0:0" + documentation: "True body Block docstring" + context: ASTContext #1000 + parent: IfStatement #720 + vStatements: Array(0) + children: Array(0) + type: "Block" + firstChild: undefined + lastChild: undefined + previousSibling: Literal #717 + nextSibling: Block #719 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Block #719 + id: 719 + src: "0:0:0" + documentation: "False body Block docstring" + context: ASTContext #1000 + parent: IfStatement #720 + vStatements: Array(0) + children: Array(0) + type: "Block" + firstChild: undefined + lastChild: undefined + previousSibling: Block #718 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclarationStatement #728 + id: 728 + src: "0:0:0" + documentation: undefined + assignments: Array(1) [ 723 ] + vDeclarations: Array(1) [ VariableDeclaration #723 ] + vInitialValue: FunctionCall #727 + context: ASTContext #1000 + parent: Block #750 + children: Array(2) [ VariableDeclaration #723, FunctionCall #727 ] + type: "VariableDeclarationStatement" + firstChild: VariableDeclaration #723 + lastChild: FunctionCall #727 + previousSibling: IfStatement #720 + nextSibling: TryStatement #746 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #723 + id: 723 + src: "0:0:0" + constant: false + indexed: false + name: "cp" + scope: 750 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "contract CatchPanic" + documentation: undefined + nameLocation: "2637:2:0" + vType: UserDefinedTypeName #722 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: VariableDeclarationStatement #728 + children: Array(1) [ UserDefinedTypeName #722 ] + vScope: Block #750 + type: "VariableDeclaration" + firstChild: UserDefinedTypeName #722 + lastChild: UserDefinedTypeName #722 + previousSibling: undefined + nextSibling: FunctionCall #727 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + UserDefinedTypeName #722 + id: 722 + src: "0:0:0" + typeString: "contract CatchPanic" + name: undefined + referencedDeclaration: 667 + path: IdentifierPath #721 + context: ASTContext #1000 + parent: VariableDeclaration #723 + children: Array(1) [ IdentifierPath #721 ] + vReferencedDeclaration: ContractDefinition #667 + type: "UserDefinedTypeName" + firstChild: IdentifierPath #721 + lastChild: IdentifierPath #721 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + IdentifierPath #721 + id: 721 + src: "0:0:0" + name: "CatchPanic" + referencedDeclaration: 141 + context: ASTContext #1000 + parent: UserDefinedTypeName #722 + vReferencedDeclaration: ContractDefinition #141 + type: "IdentifierPath" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionCall #727 + id: 727 + src: "0:0:0" + typeString: "contract CatchPanic" + kind: "functionCall" + fieldNames: undefined + vExpression: NewExpression #726 + vArguments: Array(0) + context: ASTContext #1000 + parent: VariableDeclarationStatement #728 + children: Array(1) [ NewExpression #726 ] + vIdentifier: "new" + vMemberName: undefined + vFunctionCallType: "builtin" + vReferencedDeclaration: undefined + vFunctionName: "new" + vCallee: NewExpression #726 + type: "FunctionCall" + firstChild: NewExpression #726 + lastChild: NewExpression #726 + previousSibling: VariableDeclaration #723 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + NewExpression #726 + id: 726 + src: "0:0:0" + typeString: "function () returns (contract CatchPanic)" + vTypeName: UserDefinedTypeName #725 + context: ASTContext #1000 + parent: FunctionCall #727 + children: Array(1) [ UserDefinedTypeName #725 ] + type: "NewExpression" + firstChild: UserDefinedTypeName #725 + lastChild: UserDefinedTypeName #725 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + UserDefinedTypeName #725 + id: 725 + src: "0:0:0" + typeString: "contract CatchPanic" + name: undefined + referencedDeclaration: 667 + path: IdentifierPath #724 + context: ASTContext #1000 + parent: NewExpression #726 + children: Array(1) [ IdentifierPath #724 ] + vReferencedDeclaration: ContractDefinition #667 + type: "UserDefinedTypeName" + firstChild: IdentifierPath #724 + lastChild: IdentifierPath #724 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + IdentifierPath #724 + id: 724 + src: "0:0:0" + name: "CatchPanic" + referencedDeclaration: 141 + context: ASTContext #1000 + parent: UserDefinedTypeName #725 + vReferencedDeclaration: ContractDefinition #141 + type: "IdentifierPath" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + TryStatement #746 + id: 746 + src: "0:0:0" + documentation: "TryStatement docstring" + vExternalCall: FunctionCall #731 + vClauses: Array(4) [ TryCatchClause #733, TryCatchClause #738, TryCatchClause #743, TryCatchClause #745 ] + context: ASTContext #1000 + parent: Block #750 + children: Array(5) [ FunctionCall #731, TryCatchClause #733, TryCatchClause #738, TryCatchClause #743, TryCatchClause #745 ] + type: "TryStatement" + firstChild: FunctionCall #731 + lastChild: TryCatchClause #745 + previousSibling: VariableDeclarationStatement #728 + nextSibling: InlineAssembly #747 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionCall #731 + id: 731 + src: "0:0:0" + typeString: "tuple()" + kind: "functionCall" + fieldNames: undefined + vExpression: MemberAccess #730 + vArguments: Array(0) + context: ASTContext #1000 + parent: TryStatement #746 + children: Array(1) [ MemberAccess #730 ] + vIdentifier: "cp" + vMemberName: "test" + vFunctionCallType: "userDefined" + vReferencedDeclaration: FunctionDefinition #666 + vFunctionName: "test" + vCallee: MemberAccess #730 + type: "FunctionCall" + firstChild: MemberAccess #730 + lastChild: MemberAccess #730 + previousSibling: undefined + nextSibling: TryCatchClause #733 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + MemberAccess #730 + id: 730 + src: "0:0:0" + typeString: "function () external" + vExpression: Identifier #729 + memberName: "test" + referencedDeclaration: 666 + context: ASTContext #1000 + parent: FunctionCall #731 + children: Array(1) [ Identifier #729 ] + vReferencedDeclaration: FunctionDefinition #666 + type: "MemberAccess" + firstChild: Identifier #729 + lastChild: Identifier #729 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #729 + id: 729 + src: "0:0:0" + typeString: "contract CatchPanic" + name: "cp" + referencedDeclaration: 723 + context: ASTContext #1000 + parent: MemberAccess #730 + vReferencedDeclaration: VariableDeclaration #723 + vIdentifierType: "userDefined" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + TryCatchClause #733 + id: 733 + src: "0:0:0" + documentation: undefined + errorName: "" + vParameters: undefined + vBlock: Block #732 + context: ASTContext #1000 + parent: TryStatement #746 + children: Array(1) [ Block #732 ] + type: "TryCatchClause" + firstChild: Block #732 + lastChild: Block #732 + previousSibling: FunctionCall #731 + nextSibling: TryCatchClause #738 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Block #732 + id: 732 + src: "0:0:0" + documentation: undefined + context: ASTContext #1000 + parent: TryCatchClause #733 + vStatements: Array(0) + children: Array(0) + type: "Block" + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + TryCatchClause #738 + id: 738 + src: "0:0:0" + documentation: undefined + errorName: "Error" + vParameters: ParameterList #737 + vBlock: Block #734 + context: ASTContext #1000 + parent: TryStatement #746 + children: Array(2) [ ParameterList #737, Block #734 ] + type: "TryCatchClause" + firstChild: ParameterList #737 + lastChild: Block #734 + previousSibling: TryCatchClause #733 + nextSibling: TryCatchClause #743 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #737 + id: 737 + src: "0:0:0" + context: ASTContext #1000 + parent: TryCatchClause #738 + vParameters: Array(1) [ VariableDeclaration #736 ] + children: Array(1) [ VariableDeclaration #736 ] + type: "ParameterList" + firstChild: VariableDeclaration #736 + lastChild: VariableDeclaration #736 + previousSibling: undefined + nextSibling: Block #734 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #736 + id: 736 + src: "0:0:0" + constant: false + indexed: false + name: "reason" + scope: 738 + stateVariable: false + storageLocation: "memory" + visibility: "internal" + mutability: "mutable" + typeString: "string" + documentation: undefined + nameLocation: "2854:6:0" + vType: ElementaryTypeName #735 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: ParameterList #737 + children: Array(1) [ ElementaryTypeName #735 ] + vScope: TryCatchClause #738 + type: "VariableDeclaration" + firstChild: ElementaryTypeName #735 + lastChild: ElementaryTypeName #735 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #735 + id: 735 + src: "0:0:0" + typeString: "string" + name: "string" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: VariableDeclaration #736 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Block #734 + id: 734 + src: "0:0:0" + documentation: undefined + context: ASTContext #1000 + parent: TryCatchClause #738 + vStatements: Array(0) + children: Array(0) + type: "Block" + firstChild: undefined + lastChild: undefined + previousSibling: ParameterList #737 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + TryCatchClause #743 + id: 743 + src: "0:0:0" + documentation: undefined + errorName: "Panic" + vParameters: ParameterList #742 + vBlock: Block #739 + context: ASTContext #1000 + parent: TryStatement #746 + children: Array(2) [ ParameterList #742, Block #739 ] + type: "TryCatchClause" + firstChild: ParameterList #742 + lastChild: Block #739 + previousSibling: TryCatchClause #738 + nextSibling: TryCatchClause #745 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #742 + id: 742 + src: "0:0:0" + context: ASTContext #1000 + parent: TryCatchClause #743 + vParameters: Array(1) [ VariableDeclaration #741 ] + children: Array(1) [ VariableDeclaration #741 ] + type: "ParameterList" + firstChild: VariableDeclaration #741 + lastChild: VariableDeclaration #741 + previousSibling: undefined + nextSibling: Block #739 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #741 + id: 741 + src: "0:0:0" + constant: false + indexed: false + name: "_code" + scope: 743 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "uint256" + documentation: undefined + nameLocation: "2990:5:0" + vType: ElementaryTypeName #740 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: ParameterList #742 + children: Array(1) [ ElementaryTypeName #740 ] + vScope: TryCatchClause #743 + type: "VariableDeclaration" + firstChild: ElementaryTypeName #740 + lastChild: ElementaryTypeName #740 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #740 + id: 740 + src: "0:0:0" + typeString: "uint256" + name: "uint" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: VariableDeclaration #741 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Block #739 + id: 739 + src: "0:0:0" + documentation: undefined + context: ASTContext #1000 + parent: TryCatchClause #743 + vStatements: Array(0) + children: Array(0) + type: "Block" + firstChild: undefined + lastChild: undefined + previousSibling: ParameterList #742 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + TryCatchClause #745 + id: 745 + src: "0:0:0" + documentation: undefined + errorName: "" + vParameters: undefined + vBlock: Block #744 + context: ASTContext #1000 + parent: TryStatement #746 + children: Array(1) [ Block #744 ] + type: "TryCatchClause" + firstChild: Block #744 + lastChild: Block #744 + previousSibling: TryCatchClause #743 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Block #744 + id: 744 + src: "0:0:0" + documentation: undefined + context: ASTContext #1000 + parent: TryCatchClause #745 + vStatements: Array(0) + children: Array(0) + type: "Block" + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + InlineAssembly #747 + id: 747 + src: "0:0:0" + documentation: "InlineAssembly docstring" + externalReferences: Array(0) + operations: undefined + yul: Object { nodeType: "YulBlock", src: "3235:2:0", statements: Array(0) } + context: ASTContext #1000 + parent: Block #750 + type: "InlineAssembly" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: TryStatement #746 + nextSibling: UncheckedBlock #748 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + UncheckedBlock #748 + id: 748 + src: "0:0:0" + documentation: "UncheckedBlock docstring" + context: ASTContext #1000 + parent: Block #750 + vStatements: Array(0) + children: Array(0) + type: "UncheckedBlock" + firstChild: undefined + lastChild: undefined + previousSibling: InlineAssembly #747 + nextSibling: Return #749 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Return #749 + id: 749 + src: "0:0:0" + documentation: "Return docstring" + functionReturnParameters: 157 + vExpression: undefined + context: ASTContext #1000 + parent: Block #750 + children: Array(0) + vFunctionReturnParameters: ParameterList #157 + type: "Return" + firstChild: undefined + lastChild: undefined + previousSibling: UncheckedBlock #748 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ErrorDefinition #757 + id: 757 + src: "0:0:0" + name: "UnitLevelError084" + documentation: StructuredDocumentation #756 + nameLocation: "3393:17:0" + vParameters: ParameterList #755 + context: ASTContext #1000 + parent: SourceUnit #1037 + children: Array(2) [ StructuredDocumentation #756, ParameterList #755 ] + vScope: SourceUnit #1037 + type: "ErrorDefinition" + firstChild: StructuredDocumentation #756 + lastChild: ParameterList #755 + previousSibling: ContractDefinition #752 + nextSibling: ContractDefinition #763 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + StructuredDocumentation #756 + id: 756 + src: "0:0:0" + text: "UnitLevelError error docstring" + context: ASTContext #1000 + parent: ErrorDefinition #757 + type: "StructuredDocumentation" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: ParameterList #755 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #755 + id: 755 + src: "0:0:0" + context: ASTContext #1000 + parent: ErrorDefinition #757 + vParameters: Array(1) [ VariableDeclaration #754 ] + children: Array(1) [ VariableDeclaration #754 ] + type: "ParameterList" + firstChild: VariableDeclaration #754 + lastChild: VariableDeclaration #754 + previousSibling: StructuredDocumentation #756 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #754 + id: 754 + src: "0:0:0" + constant: false + indexed: false + name: "code" + scope: 757 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "uint256" + documentation: undefined + nameLocation: "3416:4:0" + vType: ElementaryTypeName #753 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: ParameterList #755 + children: Array(1) [ ElementaryTypeName #753 ] + vScope: ErrorDefinition #757 + type: "VariableDeclaration" + firstChild: ElementaryTypeName #753 + lastChild: ElementaryTypeName #753 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #753 + id: 753 + src: "0:0:0" + typeString: "uint256" + name: "uint" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: VariableDeclaration #754 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ContractDefinition #763 + id: 763 + src: "0:0:0" + name: "LibErrors084" + scope: 1037 + kind: "library" + abstract: false + fullyImplemented: true + linearizedBaseContracts: Array(1) [ 763 ] + usedErrors: Array(1) [ 762 ] + docString: undefined + nameLocation: "3432:12:0" + context: ASTContext #1000 + parent: SourceUnit #1037 + documentation: undefined + vScope: SourceUnit #1037 + vLinearizedBaseContracts: Array(1) [ ContractDefinition #763 ] + vUsedErrors: Array(1) [ ErrorDefinition #762 ] + vInheritanceSpecifiers: Array(0) + vStateVariables: Array(0) + vModifiers: Array(0) + vEvents: Array(0) + vErrors: Array(1) [ ErrorDefinition #762 ] + vFunctions: Array(0) + vUsingForDirectives: Array(0) + vStructs: Array(0) + vEnums: Array(0) + vUserDefinedValueTypes: Array(0) + vConstructor: undefined + children: Array(1) [ ErrorDefinition #762 ] + type: "ContractDefinition" + firstChild: ErrorDefinition #762 + lastChild: ErrorDefinition #762 + previousSibling: ErrorDefinition #757 + nextSibling: ContractDefinition #821 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ErrorDefinition #762 + id: 762 + src: "0:0:0" + name: "Lib" + documentation: StructuredDocumentation #761 + nameLocation: "3498:3:0" + vParameters: ParameterList #760 + context: ASTContext #1000 + parent: ContractDefinition #763 + children: Array(2) [ StructuredDocumentation #761, ParameterList #760 ] + vScope: ContractDefinition #763 + type: "ErrorDefinition" + firstChild: StructuredDocumentation #761 + lastChild: ParameterList #760 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + StructuredDocumentation #761 + id: 761 + src: "0:0:0" + text: "LibErrors084.Lib error docstring" + context: ASTContext #1000 + parent: ErrorDefinition #762 + type: "StructuredDocumentation" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: ParameterList #760 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #760 + id: 760 + src: "0:0:0" + context: ASTContext #1000 + parent: ErrorDefinition #762 + vParameters: Array(1) [ VariableDeclaration #759 ] + children: Array(1) [ VariableDeclaration #759 ] + type: "ParameterList" + firstChild: VariableDeclaration #759 + lastChild: VariableDeclaration #759 + previousSibling: StructuredDocumentation #761 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #759 + id: 759 + src: "0:0:0" + constant: false + indexed: false + name: "b" + scope: 762 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "bytes" + documentation: undefined + nameLocation: "3508:1:0" + vType: ElementaryTypeName #758 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: ParameterList #760 + children: Array(1) [ ElementaryTypeName #758 ] + vScope: ErrorDefinition #762 + type: "VariableDeclaration" + firstChild: ElementaryTypeName #758 + lastChild: ElementaryTypeName #758 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #758 + id: 758 + src: "0:0:0" + typeString: "bytes" + name: "bytes" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: VariableDeclaration #759 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ContractDefinition #821 + id: 821 + src: "0:0:0" + name: "Features084" + scope: 1037 + kind: "contract" + abstract: false + fullyImplemented: true + linearizedBaseContracts: Array(1) [ 821 ] + usedErrors: Array(3) [ 757, 762, 766 ] + docString: undefined + nameLocation: "3524:11:0" + context: ASTContext #1000 + parent: SourceUnit #1037 + documentation: undefined + vScope: SourceUnit #1037 + vLinearizedBaseContracts: Array(1) [ ContractDefinition #821 ] + vUsedErrors: Array(3) [ ErrorDefinition #757, ErrorDefinition #762, ErrorDefinition #766 ] + vInheritanceSpecifiers: Array(0) + vStateVariables: Array(0) + vModifiers: Array(0) + vEvents: Array(0) + vErrors: Array(1) [ ErrorDefinition #766 ] + vFunctions: Array(6) [ FunctionDefinition #771, FunctionDefinition #788, FunctionDefinition #796, FunctionDefinition #805, FunctionDefinition #812, FunctionDefinition #820 ] + vUsingForDirectives: Array(0) + vStructs: Array(0) + vEnums: Array(0) + vUserDefinedValueTypes: Array(0) + vConstructor: undefined + children: Array(7) [ ErrorDefinition #766, FunctionDefinition #771, FunctionDefinition #788, FunctionDefinition #796, FunctionDefinition #805, FunctionDefinition #812, FunctionDefinition #820 ] + type: "ContractDefinition" + firstChild: ErrorDefinition #766 + lastChild: FunctionDefinition #820 + previousSibling: ContractDefinition #763 + nextSibling: ContractDefinition #838 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ErrorDefinition #766 + id: 766 + src: "0:0:0" + name: "Own" + documentation: StructuredDocumentation #765 + nameLocation: "3588:3:0" + vParameters: ParameterList #764 + context: ASTContext #1000 + parent: ContractDefinition #821 + children: Array(2) [ StructuredDocumentation #765, ParameterList #764 ] + vScope: ContractDefinition #821 + type: "ErrorDefinition" + firstChild: StructuredDocumentation #765 + lastChild: ParameterList #764 + previousSibling: undefined + nextSibling: FunctionDefinition #771 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + StructuredDocumentation #765 + id: 765 + src: "0:0:0" + text: "Features084.Own error docstring" + context: ASTContext #1000 + parent: ErrorDefinition #766 + type: "StructuredDocumentation" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: ParameterList #764 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #764 + id: 764 + src: "0:0:0" + context: ASTContext #1000 + parent: ErrorDefinition #766 + vParameters: Array(0) + children: Array(0) + type: "ParameterList" + firstChild: undefined + lastChild: undefined + previousSibling: StructuredDocumentation #765 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionDefinition #771 + id: 771 + src: "0:0:0" + implemented: true + virtual: false + scope: 821 + kind: "function" + name: "testAssemblyHexLiterals" + visibility: "public" + stateMutability: "nonpayable" + isConstructor: false + documentation: undefined + nameLocation: "3609:23:0" + vParameters: ParameterList #767 + vReturnParameters: ParameterList #768 + vModifiers: Array(0) + vOverrideSpecifier: undefined + vBody: Block #770 + context: ASTContext #1000 + parent: ContractDefinition #821 + children: Array(3) [ ParameterList #767, ParameterList #768, Block #770 ] + vScope: ContractDefinition #821 + type: "FunctionDefinition" + firstChild: ParameterList #767 + lastChild: Block #770 + previousSibling: ErrorDefinition #766 + nextSibling: FunctionDefinition #788 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #767 + id: 767 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #771 + vParameters: Array(0) + children: Array(0) + type: "ParameterList" + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: ParameterList #768 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #768 + id: 768 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #771 + vParameters: Array(0) + children: Array(0) + type: "ParameterList" + firstChild: undefined + lastChild: undefined + previousSibling: ParameterList #767 + nextSibling: Block #770 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Block #770 + id: 770 + src: "0:0:0" + documentation: undefined + context: ASTContext #1000 + parent: FunctionDefinition #771 + vStatements: Array(1) [ InlineAssembly #769 ] + children: Array(1) [ InlineAssembly #769 ] + type: "Block" + firstChild: InlineAssembly #769 + lastChild: InlineAssembly #769 + previousSibling: ParameterList #768 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + InlineAssembly #769 + id: 769 + src: "0:0:0" + documentation: undefined + externalReferences: Array(0) + operations: undefined + yul: Object { nodeType: "YulBlock", src: "3661:221:0", statements: Array(6) [ Object { nodeType: "YulVariableDeclaration", src: "3675:15:0", value: Object { hexValue: "74657374", kind: "string", nodeType: "YulLiteral", src: "3684:6:0", type: "", value: "test" }, variables: Array(1) [ Object { name: "a", nodeType: "YulTypedName", src: "3679:1:0", type: "" } ] }, Object { nodeType: "YulVariableDeclaration", src: "3703:54:0", value: Object { hexValue: "112233445566778899aabbccddeeff6677889900", kind: "string", nodeType: "YulLiteral", src: "3712:45:0", type: "" }, variables: Array(1) [ Object { name: "x", nodeType: "YulTypedName", src: "3707:1:0", type: "" } ] }, Object { nodeType: "YulVariableDeclaration", src: "3770:23:0", value: Object { hexValue: "1234abcd", kind: "string", nodeType: "YulLiteral", src: "3779:14:0", type: "" }, variables: Array(1) [ Object { name: "y", nodeType: "YulTypedName", src: "3774:1:0", type: "" } ] }, Object { expression: Object { arguments: Array(2) [ Object { kind: "number", nodeType: "YulLiteral", src: "3814:1:0", type: "", value: "0" }, Object { name: "x", nodeType: "YulIdentifier", src: "3817:1:0" } ], functionName: Object { name: "sstore", nodeType: "YulIdentifier", src: "3807:6:0" }, nodeType: "YulFunctionCall", src: "3807:12:0" }, nodeType: "YulExpressionStatement", src: "3807:12:0" }, Object { expression: Object { arguments: Array(2) [ Object { kind: "number", nodeType: "YulLiteral", src: "3839:1:0", type: "", value: "1" }, Object { name: "y", nodeType: "YulIdentifier", src: "3842:1:0" } ], functionName: Object { name: "sstore", nodeType: "YulIdentifier", src: "3832:6:0" }, nodeType: "YulFunctionCall", src: "3832:12:0" }, nodeType: "YulExpressionStatement", src: "3832:12:0" }, Object { expression: Object { arguments: Array(1) [ Object { hexValue: "2233", kind: "string", nodeType: "YulLiteral", src: "3862:9:0", type: "", value: "\"3" } ], functionName: Object { name: "pop", nodeType: "YulIdentifier", src: "3858:3:0" }, nodeType: "YulFunctionCall", src: "3858:14:0" }, nodeType: "YulExpressionStatement", src: "3858:14:0" } ] } + context: ASTContext #1000 + parent: Block #770 + type: "InlineAssembly" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionDefinition #788 + id: 788 + src: "0:0:0" + implemented: true + virtual: false + scope: 821 + kind: "function" + name: "testBytesConcatBuiltin" + visibility: "public" + stateMutability: "pure" + isConstructor: false + documentation: undefined + nameLocation: "3903:22:0" + vParameters: ParameterList #776 + vReturnParameters: ParameterList #779 + vModifiers: Array(0) + vOverrideSpecifier: undefined + vBody: Block #787 + context: ASTContext #1000 + parent: ContractDefinition #821 + children: Array(3) [ ParameterList #776, ParameterList #779, Block #787 ] + vScope: ContractDefinition #821 + type: "FunctionDefinition" + firstChild: ParameterList #776 + lastChild: Block #787 + previousSibling: FunctionDefinition #771 + nextSibling: FunctionDefinition #796 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #776 + id: 776 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #788 + vParameters: Array(2) [ VariableDeclaration #773, VariableDeclaration #775 ] + children: Array(2) [ VariableDeclaration #773, VariableDeclaration #775 ] + type: "ParameterList" + firstChild: VariableDeclaration #773 + lastChild: VariableDeclaration #775 + previousSibling: undefined + nextSibling: ParameterList #779 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #773 + id: 773 + src: "0:0:0" + constant: false + indexed: false + name: "a" + scope: 788 + stateVariable: false + storageLocation: "memory" + visibility: "internal" + mutability: "mutable" + typeString: "bytes" + documentation: undefined + nameLocation: "3939:1:0" + vType: ElementaryTypeName #772 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: ParameterList #776 + children: Array(1) [ ElementaryTypeName #772 ] + vScope: FunctionDefinition #788 + type: "VariableDeclaration" + firstChild: ElementaryTypeName #772 + lastChild: ElementaryTypeName #772 + previousSibling: undefined + nextSibling: VariableDeclaration #775 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #772 + id: 772 + src: "0:0:0" + typeString: "bytes" + name: "bytes" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: VariableDeclaration #773 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #775 + id: 775 + src: "0:0:0" + constant: false + indexed: false + name: "b" + scope: 788 + stateVariable: false + storageLocation: "memory" + visibility: "internal" + mutability: "mutable" + typeString: "bytes" + documentation: undefined + nameLocation: "3955:1:0" + vType: ElementaryTypeName #774 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: ParameterList #776 + children: Array(1) [ ElementaryTypeName #774 ] + vScope: FunctionDefinition #788 + type: "VariableDeclaration" + firstChild: ElementaryTypeName #774 + lastChild: ElementaryTypeName #774 + previousSibling: VariableDeclaration #773 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #774 + id: 774 + src: "0:0:0" + typeString: "bytes" + name: "bytes" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: VariableDeclaration #775 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #779 + id: 779 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #788 + vParameters: Array(1) [ VariableDeclaration #778 ] + children: Array(1) [ VariableDeclaration #778 ] + type: "ParameterList" + firstChild: VariableDeclaration #778 + lastChild: VariableDeclaration #778 + previousSibling: ParameterList #776 + nextSibling: Block #787 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #778 + id: 778 + src: "0:0:0" + constant: false + indexed: false + name: "c" + scope: 788 + stateVariable: false + storageLocation: "memory" + visibility: "internal" + mutability: "mutable" + typeString: "bytes" + documentation: undefined + nameLocation: "3992:1:0" + vType: ElementaryTypeName #777 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: ParameterList #779 + children: Array(1) [ ElementaryTypeName #777 ] + vScope: FunctionDefinition #788 + type: "VariableDeclaration" + firstChild: ElementaryTypeName #777 + lastChild: ElementaryTypeName #777 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #777 + id: 777 + src: "0:0:0" + typeString: "bytes" + name: "bytes" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: VariableDeclaration #778 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Block #787 + id: 787 + src: "0:0:0" + documentation: undefined + context: ASTContext #1000 + parent: FunctionDefinition #788 + vStatements: Array(1) [ Return #786 ] + children: Array(1) [ Return #786 ] + type: "Block" + firstChild: Return #786 + lastChild: Return #786 + previousSibling: ParameterList #779 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Return #786 + id: 786 + src: "0:0:0" + documentation: undefined + functionReturnParameters: 253 + vExpression: FunctionCall #785 + context: ASTContext #1000 + parent: Block #787 + children: Array(1) [ FunctionCall #785 ] + vFunctionReturnParameters: ParameterList #253 + type: "Return" + firstChild: FunctionCall #785 + lastChild: FunctionCall #785 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionCall #785 + id: 785 + src: "0:0:0" + typeString: "bytes memory" + kind: "functionCall" + fieldNames: undefined + vExpression: MemberAccess #782 + vArguments: Array(2) [ Identifier #783, Identifier #784 ] + context: ASTContext #1000 + parent: Return #786 + children: Array(3) [ MemberAccess #782, Identifier #783, Identifier #784 ] + vIdentifier: undefined + vMemberName: "concat" + vFunctionCallType: "builtin" + vReferencedDeclaration: undefined + vFunctionName: "concat" + vCallee: MemberAccess #782 + type: "FunctionCall" + firstChild: MemberAccess #782 + lastChild: Identifier #784 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + MemberAccess #782 + id: 782 + src: "0:0:0" + typeString: "function () pure returns (bytes memory)" + vExpression: ElementaryTypeNameExpression #781 + memberName: "concat" + referencedDeclaration: undefined + context: ASTContext #1000 + parent: FunctionCall #785 + children: Array(1) [ ElementaryTypeNameExpression #781 ] + vReferencedDeclaration: undefined + type: "MemberAccess" + firstChild: ElementaryTypeNameExpression #781 + lastChild: ElementaryTypeNameExpression #781 + previousSibling: undefined + nextSibling: Identifier #783 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeNameExpression #781 + id: 781 + src: "0:0:0" + typeString: "type(bytes storage pointer)" + typeName: ElementaryTypeName #780 + context: ASTContext #1000 + parent: MemberAccess #782 + children: Array(1) [ ElementaryTypeName #780 ] + type: "ElementaryTypeNameExpression" + firstChild: ElementaryTypeName #780 + lastChild: ElementaryTypeName #780 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #780 + id: 780 + src: "0:0:0" + typeString: undefined + name: "bytes" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: ElementaryTypeNameExpression #781 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #783 + id: 783 + src: "0:0:0" + typeString: "bytes memory" + name: "a" + referencedDeclaration: 773 + context: ASTContext #1000 + parent: FunctionCall #785 + vReferencedDeclaration: VariableDeclaration #773 + vIdentifierType: "userDefined" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: MemberAccess #782 + nextSibling: Identifier #784 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #784 + id: 784 + src: "0:0:0" + typeString: "bytes memory" + name: "b" + referencedDeclaration: 775 + context: ASTContext #1000 + parent: FunctionCall #785 + vReferencedDeclaration: VariableDeclaration #775 + vIdentifierType: "userDefined" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: Identifier #783 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionDefinition #796 + id: 796 + src: "0:0:0" + implemented: true + virtual: false + scope: 821 + kind: "function" + name: "testVariableDeclarationStatementDocString" + visibility: "public" + stateMutability: "nonpayable" + isConstructor: false + documentation: undefined + nameLocation: "4052:41:0" + vParameters: ParameterList #789 + vReturnParameters: ParameterList #790 + vModifiers: Array(0) + vOverrideSpecifier: undefined + vBody: Block #795 + context: ASTContext #1000 + parent: ContractDefinition #821 + children: Array(3) [ ParameterList #789, ParameterList #790, Block #795 ] + vScope: ContractDefinition #821 + type: "FunctionDefinition" + firstChild: ParameterList #789 + lastChild: Block #795 + previousSibling: FunctionDefinition #788 + nextSibling: FunctionDefinition #805 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #789 + id: 789 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #796 + vParameters: Array(0) + children: Array(0) + type: "ParameterList" + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: ParameterList #790 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #790 + id: 790 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #796 + vParameters: Array(0) + children: Array(0) + type: "ParameterList" + firstChild: undefined + lastChild: undefined + previousSibling: ParameterList #789 + nextSibling: Block #795 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Block #795 + id: 795 + src: "0:0:0" + documentation: undefined + context: ASTContext #1000 + parent: FunctionDefinition #796 + vStatements: Array(1) [ VariableDeclarationStatement #794 ] + children: Array(1) [ VariableDeclarationStatement #794 ] + type: "Block" + firstChild: VariableDeclarationStatement #794 + lastChild: VariableDeclarationStatement #794 + previousSibling: ParameterList #790 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclarationStatement #794 + id: 794 + src: "0:0:0" + documentation: "VariableDeclarationStatement docstring" + assignments: Array(1) [ 792 ] + vDeclarations: Array(1) [ VariableDeclaration #792 ] + vInitialValue: Literal #793 + context: ASTContext #1000 + parent: Block #795 + children: Array(2) [ VariableDeclaration #792, Literal #793 ] + type: "VariableDeclarationStatement" + firstChild: VariableDeclaration #792 + lastChild: Literal #793 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #792 + id: 792 + src: "0:0:0" + constant: false + indexed: false + name: "a" + scope: 795 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "uint256" + documentation: undefined + nameLocation: "4169:1:0" + vType: ElementaryTypeName #791 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: VariableDeclarationStatement #794 + children: Array(1) [ ElementaryTypeName #791 ] + vScope: Block #795 + type: "VariableDeclaration" + firstChild: ElementaryTypeName #791 + lastChild: ElementaryTypeName #791 + previousSibling: undefined + nextSibling: Literal #793 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #791 + id: 791 + src: "0:0:0" + typeString: "uint256" + name: "uint" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: VariableDeclaration #792 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Literal #793 + id: 793 + src: "0:0:0" + typeString: "int_const 10" + kind: "number" + hexValue: "3130" + value: "10" + subdenomination: undefined + context: ASTContext #1000 + parent: VariableDeclarationStatement #794 + type: "Literal" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: VariableDeclaration #792 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionDefinition #805 + id: 805 + src: "0:0:0" + implemented: true + virtual: false + scope: 821 + kind: "function" + name: "revertWithLib" + visibility: "public" + stateMutability: "nonpayable" + isConstructor: false + documentation: undefined + nameLocation: "4197:13:0" + vParameters: ParameterList #797 + vReturnParameters: ParameterList #798 + vModifiers: Array(0) + vOverrideSpecifier: undefined + vBody: Block #804 + context: ASTContext #1000 + parent: ContractDefinition #821 + children: Array(3) [ ParameterList #797, ParameterList #798, Block #804 ] + vScope: ContractDefinition #821 + type: "FunctionDefinition" + firstChild: ParameterList #797 + lastChild: Block #804 + previousSibling: FunctionDefinition #796 + nextSibling: FunctionDefinition #812 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #797 + id: 797 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #805 + vParameters: Array(0) + children: Array(0) + type: "ParameterList" + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: ParameterList #798 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #798 + id: 798 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #805 + vParameters: Array(0) + children: Array(0) + type: "ParameterList" + firstChild: undefined + lastChild: undefined + previousSibling: ParameterList #797 + nextSibling: Block #804 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Block #804 + id: 804 + src: "0:0:0" + documentation: undefined + context: ASTContext #1000 + parent: FunctionDefinition #805 + vStatements: Array(1) [ RevertStatement #803 ] + children: Array(1) [ RevertStatement #803 ] + type: "Block" + firstChild: RevertStatement #803 + lastChild: RevertStatement #803 + previousSibling: ParameterList #798 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + RevertStatement #803 + id: 803 + src: "0:0:0" + documentation: "RevertStatement docstring" + errorCall: FunctionCall #802 + context: ASTContext #1000 + parent: Block #804 + children: Array(1) [ FunctionCall #802 ] + type: "RevertStatement" + firstChild: FunctionCall #802 + lastChild: FunctionCall #802 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionCall #802 + id: 802 + src: "0:0:0" + typeString: "tuple()" + kind: "functionCall" + fieldNames: undefined + vExpression: MemberAccess #800 + vArguments: Array(1) [ Literal #801 ] + context: ASTContext #1000 + parent: RevertStatement #803 + children: Array(2) [ MemberAccess #800, Literal #801 ] + vIdentifier: "LibErrors084" + vMemberName: "Lib" + vFunctionCallType: "userDefined" + vReferencedDeclaration: ErrorDefinition #762 + vFunctionName: "Lib" + vCallee: MemberAccess #800 + type: "FunctionCall" + firstChild: MemberAccess #800 + lastChild: Literal #801 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + MemberAccess #800 + id: 800 + src: "0:0:0" + typeString: "function (bytes memory) pure" + vExpression: Identifier #799 + memberName: "Lib" + referencedDeclaration: 762 + context: ASTContext #1000 + parent: FunctionCall #802 + children: Array(1) [ Identifier #799 ] + vReferencedDeclaration: ErrorDefinition #762 + type: "MemberAccess" + firstChild: Identifier #799 + lastChild: Identifier #799 + previousSibling: undefined + nextSibling: Literal #801 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #799 + id: 799 + src: "0:0:0" + typeString: "type(library LibErrors084)" + name: "LibErrors084" + referencedDeclaration: 763 + context: ASTContext #1000 + parent: MemberAccess #800 + vReferencedDeclaration: ContractDefinition #763 + vIdentifierType: "userDefined" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Literal #801 + id: 801 + src: "0:0:0" + typeString: "literal_string hex\"001122\"" + kind: "hexString" + hexValue: "001122" + value: "\u0000\u0011\"" + subdenomination: undefined + context: ASTContext #1000 + parent: FunctionCall #802 + type: "Literal" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: MemberAccess #800 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionDefinition #812 + id: 812 + src: "0:0:0" + implemented: true + virtual: false + scope: 821 + kind: "function" + name: "revertWithOwn" + visibility: "public" + stateMutability: "nonpayable" + isConstructor: false + documentation: undefined + nameLocation: "4326:13:0" + vParameters: ParameterList #806 + vReturnParameters: ParameterList #807 + vModifiers: Array(0) + vOverrideSpecifier: undefined + vBody: Block #811 + context: ASTContext #1000 + parent: ContractDefinition #821 + children: Array(3) [ ParameterList #806, ParameterList #807, Block #811 ] + vScope: ContractDefinition #821 + type: "FunctionDefinition" + firstChild: ParameterList #806 + lastChild: Block #811 + previousSibling: FunctionDefinition #805 + nextSibling: FunctionDefinition #820 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #806 + id: 806 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #812 + vParameters: Array(0) + children: Array(0) + type: "ParameterList" + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: ParameterList #807 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #807 + id: 807 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #812 + vParameters: Array(0) + children: Array(0) + type: "ParameterList" + firstChild: undefined + lastChild: undefined + previousSibling: ParameterList #806 + nextSibling: Block #811 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Block #811 + id: 811 + src: "0:0:0" + documentation: undefined + context: ASTContext #1000 + parent: FunctionDefinition #812 + vStatements: Array(1) [ RevertStatement #810 ] + children: Array(1) [ RevertStatement #810 ] + type: "Block" + firstChild: RevertStatement #810 + lastChild: RevertStatement #810 + previousSibling: ParameterList #807 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + RevertStatement #810 + id: 810 + src: "0:0:0" + documentation: undefined + errorCall: FunctionCall #809 + context: ASTContext #1000 + parent: Block #811 + children: Array(1) [ FunctionCall #809 ] + type: "RevertStatement" + firstChild: FunctionCall #809 + lastChild: FunctionCall #809 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionCall #809 + id: 809 + src: "0:0:0" + typeString: "tuple()" + kind: "functionCall" + fieldNames: undefined + vExpression: Identifier #808 + vArguments: Array(0) + context: ASTContext #1000 + parent: RevertStatement #810 + children: Array(1) [ Identifier #808 ] + vIdentifier: "Own" + vMemberName: undefined + vFunctionCallType: "userDefined" + vReferencedDeclaration: ErrorDefinition #766 + vFunctionName: "Own" + vCallee: Identifier #808 + type: "FunctionCall" + firstChild: Identifier #808 + lastChild: Identifier #808 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #808 + id: 808 + src: "0:0:0" + typeString: "function () pure" + name: "Own" + referencedDeclaration: 766 + context: ASTContext #1000 + parent: FunctionCall #809 + vReferencedDeclaration: ErrorDefinition #766 + vIdentifierType: "userDefined" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionDefinition #820 + id: 820 + src: "0:0:0" + implemented: true + virtual: false + scope: 821 + kind: "function" + name: "revertWithUnitLevelError" + visibility: "public" + stateMutability: "nonpayable" + isConstructor: false + documentation: undefined + nameLocation: "4393:24:0" + vParameters: ParameterList #813 + vReturnParameters: ParameterList #814 + vModifiers: Array(0) + vOverrideSpecifier: undefined + vBody: Block #819 + context: ASTContext #1000 + parent: ContractDefinition #821 + children: Array(3) [ ParameterList #813, ParameterList #814, Block #819 ] + vScope: ContractDefinition #821 + type: "FunctionDefinition" + firstChild: ParameterList #813 + lastChild: Block #819 + previousSibling: FunctionDefinition #812 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #813 + id: 813 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #820 + vParameters: Array(0) + children: Array(0) + type: "ParameterList" + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: ParameterList #814 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #814 + id: 814 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #820 + vParameters: Array(0) + children: Array(0) + type: "ParameterList" + firstChild: undefined + lastChild: undefined + previousSibling: ParameterList #813 + nextSibling: Block #819 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Block #819 + id: 819 + src: "0:0:0" + documentation: undefined + context: ASTContext #1000 + parent: FunctionDefinition #820 + vStatements: Array(1) [ RevertStatement #818 ] + children: Array(1) [ RevertStatement #818 ] + type: "Block" + firstChild: RevertStatement #818 + lastChild: RevertStatement #818 + previousSibling: ParameterList #814 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + RevertStatement #818 + id: 818 + src: "0:0:0" + documentation: undefined + errorCall: FunctionCall #817 + context: ASTContext #1000 + parent: Block #819 + children: Array(1) [ FunctionCall #817 ] + type: "RevertStatement" + firstChild: FunctionCall #817 + lastChild: FunctionCall #817 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionCall #817 + id: 817 + src: "0:0:0" + typeString: "tuple()" + kind: "functionCall" + fieldNames: undefined + vExpression: Identifier #815 + vArguments: Array(1) [ Literal #816 ] + context: ASTContext #1000 + parent: RevertStatement #818 + children: Array(2) [ Identifier #815, Literal #816 ] + vIdentifier: "UnitLevelError084" + vMemberName: undefined + vFunctionCallType: "userDefined" + vReferencedDeclaration: ErrorDefinition #757 + vFunctionName: "UnitLevelError084" + vCallee: Identifier #815 + type: "FunctionCall" + firstChild: Identifier #815 + lastChild: Literal #816 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #815 + id: 815 + src: "0:0:0" + typeString: "function (uint256) pure" + name: "UnitLevelError084" + referencedDeclaration: 757 + context: ASTContext #1000 + parent: FunctionCall #817 + vReferencedDeclaration: ErrorDefinition #757 + vIdentifierType: "userDefined" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: Literal #816 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Literal #816 + id: 816 + src: "0:0:0" + typeString: "int_const 1" + kind: "number" + hexValue: "31" + value: "1" + subdenomination: undefined + context: ASTContext #1000 + parent: FunctionCall #817 + type: "Literal" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: Identifier #815 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ContractDefinition #838 + id: 838 + src: "0:0:0" + name: "Features087" + scope: 1037 + kind: "contract" + abstract: false + fullyImplemented: true + linearizedBaseContracts: Array(1) [ 838 ] + usedErrors: Array(0) + docString: undefined + nameLocation: "4484:11:0" + context: ASTContext #1000 + parent: SourceUnit #1037 + documentation: undefined + vScope: SourceUnit #1037 + vLinearizedBaseContracts: Array(1) [ ContractDefinition #838 ] + vUsedErrors: Array(0) + vInheritanceSpecifiers: Array(0) + vStateVariables: Array(0) + vModifiers: Array(0) + vEvents: Array(0) + vErrors: Array(0) + vFunctions: Array(2) [ FunctionDefinition #830, FunctionDefinition #837 ] + vUsingForDirectives: Array(0) + vStructs: Array(0) + vEnums: Array(0) + vUserDefinedValueTypes: Array(0) + vConstructor: undefined + children: Array(2) [ FunctionDefinition #830, FunctionDefinition #837 ] + type: "ContractDefinition" + firstChild: FunctionDefinition #830 + lastChild: FunctionDefinition #837 + previousSibling: ContractDefinition #821 + nextSibling: UserDefinedValueTypeDefinition #840 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionDefinition #830 + id: 830 + src: "0:0:0" + implemented: true + virtual: false + scope: 838 + kind: "function" + name: "basefeeGlobal" + visibility: "external" + stateMutability: "view" + isConstructor: false + documentation: undefined + nameLocation: "4511:13:0" + vParameters: ParameterList #822 + vReturnParameters: ParameterList #825 + vModifiers: Array(0) + vOverrideSpecifier: undefined + vBody: Block #829 + context: ASTContext #1000 + parent: ContractDefinition #838 + children: Array(3) [ ParameterList #822, ParameterList #825, Block #829 ] + vScope: ContractDefinition #838 + type: "FunctionDefinition" + firstChild: ParameterList #822 + lastChild: Block #829 + previousSibling: undefined + nextSibling: FunctionDefinition #837 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #822 + id: 822 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #830 + vParameters: Array(0) + children: Array(0) + type: "ParameterList" + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: ParameterList #825 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #825 + id: 825 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #830 + vParameters: Array(1) [ VariableDeclaration #824 ] + children: Array(1) [ VariableDeclaration #824 ] + type: "ParameterList" + firstChild: VariableDeclaration #824 + lastChild: VariableDeclaration #824 + previousSibling: ParameterList #822 + nextSibling: Block #829 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #824 + id: 824 + src: "0:0:0" + constant: false + indexed: false + name: "" + scope: 830 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "uint256" + documentation: undefined + nameLocation: "-1:-1:-1" + vType: ElementaryTypeName #823 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: ParameterList #825 + children: Array(1) [ ElementaryTypeName #823 ] + vScope: FunctionDefinition #830 + type: "VariableDeclaration" + firstChild: ElementaryTypeName #823 + lastChild: ElementaryTypeName #823 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #823 + id: 823 + src: "0:0:0" + typeString: "uint256" + name: "uint" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: VariableDeclaration #824 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Block #829 + id: 829 + src: "0:0:0" + documentation: undefined + context: ASTContext #1000 + parent: FunctionDefinition #830 + vStatements: Array(1) [ Return #828 ] + children: Array(1) [ Return #828 ] + type: "Block" + firstChild: Return #828 + lastChild: Return #828 + previousSibling: ParameterList #825 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Return #828 + id: 828 + src: "0:0:0" + documentation: undefined + functionReturnParameters: 301 + vExpression: MemberAccess #827 + context: ASTContext #1000 + parent: Block #829 + children: Array(1) [ MemberAccess #827 ] + vFunctionReturnParameters: ParameterList #301 + type: "Return" + firstChild: MemberAccess #827 + lastChild: MemberAccess #827 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + MemberAccess #827 + id: 827 + src: "0:0:0" + typeString: "uint256" + vExpression: Identifier #826 + memberName: "basefee" + referencedDeclaration: undefined + context: ASTContext #1000 + parent: Return #828 + children: Array(1) [ Identifier #826 ] + vReferencedDeclaration: undefined + type: "MemberAccess" + firstChild: Identifier #826 + lastChild: Identifier #826 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #826 + id: 826 + src: "0:0:0" + typeString: "block" + name: "block" + referencedDeclaration: -4 + context: ASTContext #1000 + parent: MemberAccess #827 + vReferencedDeclaration: undefined + vIdentifierType: "builtin" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionDefinition #837 + id: 837 + src: "0:0:0" + implemented: true + virtual: false + scope: 838 + kind: "function" + name: "basefeeInlineAssembly" + visibility: "external" + stateMutability: "view" + isConstructor: false + documentation: undefined + nameLocation: "4608:21:0" + vParameters: ParameterList #831 + vReturnParameters: ParameterList #834 + vModifiers: Array(0) + vOverrideSpecifier: undefined + vBody: Block #836 + context: ASTContext #1000 + parent: ContractDefinition #838 + children: Array(3) [ ParameterList #831, ParameterList #834, Block #836 ] + vScope: ContractDefinition #838 + type: "FunctionDefinition" + firstChild: ParameterList #831 + lastChild: Block #836 + previousSibling: FunctionDefinition #830 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #831 + id: 831 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #837 + vParameters: Array(0) + children: Array(0) + type: "ParameterList" + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: ParameterList #834 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #834 + id: 834 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #837 + vParameters: Array(1) [ VariableDeclaration #833 ] + children: Array(1) [ VariableDeclaration #833 ] + type: "ParameterList" + firstChild: VariableDeclaration #833 + lastChild: VariableDeclaration #833 + previousSibling: ParameterList #831 + nextSibling: Block #836 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #833 + id: 833 + src: "0:0:0" + constant: false + indexed: false + name: "ret" + scope: 837 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "uint256" + documentation: undefined + nameLocation: "4660:3:0" + vType: ElementaryTypeName #832 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: ParameterList #834 + children: Array(1) [ ElementaryTypeName #832 ] + vScope: FunctionDefinition #837 + type: "VariableDeclaration" + firstChild: ElementaryTypeName #832 + lastChild: ElementaryTypeName #832 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #832 + id: 832 + src: "0:0:0" + typeString: "uint256" + name: "uint" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: VariableDeclaration #833 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Block #836 + id: 836 + src: "0:0:0" + documentation: undefined + context: ASTContext #1000 + parent: FunctionDefinition #837 + vStatements: Array(1) [ InlineAssembly #835 ] + children: Array(1) [ InlineAssembly #835 ] + type: "Block" + firstChild: InlineAssembly #835 + lastChild: InlineAssembly #835 + previousSibling: ParameterList #834 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + InlineAssembly #835 + id: 835 + src: "0:0:0" + documentation: undefined + externalReferences: Array(1) [ Object { declaration: 309, isOffset: false, isSlot: false, src: "4698:3:0", valueSize: 1 } ] + operations: undefined + yul: Object { nodeType: "YulBlock", src: "4684:40:0", statements: Array(1) [ Object { nodeType: "YulAssignment", src: "4698:16:0", value: Object { arguments: Array(0), functionName: Object { name: "basefee", nodeType: "YulIdentifier", src: "4705:7:0" }, nodeType: "YulFunctionCall", src: "4705:9:0" }, variableNames: Array(1) [ Object { name: "ret", nodeType: "YulIdentifier", src: "4698:3:0" } ] } ] } + context: ASTContext #1000 + parent: Block #836 + type: "InlineAssembly" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + UserDefinedValueTypeDefinition #840 + id: 840 + src: "0:0:0" + name: "Price" + underlyingType: ElementaryTypeName #839 + nameLocation: "4739:5:0" + context: ASTContext #1000 + parent: SourceUnit #1037 + children: Array(1) [ ElementaryTypeName #839 ] + canonicalName: "Price" + vScope: SourceUnit #1037 + type: "UserDefinedValueTypeDefinition" + firstChild: ElementaryTypeName #839 + lastChild: ElementaryTypeName #839 + previousSibling: ContractDefinition #838 + nextSibling: UserDefinedValueTypeDefinition #842 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #839 + id: 839 + src: "0:0:0" + typeString: "uint128" + name: "uint128" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: UserDefinedValueTypeDefinition #840 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + UserDefinedValueTypeDefinition #842 + id: 842 + src: "0:0:0" + name: "Quantity" + underlyingType: ElementaryTypeName #841 + nameLocation: "4762:8:0" + context: ASTContext #1000 + parent: SourceUnit #1037 + children: Array(1) [ ElementaryTypeName #841 ] + canonicalName: "Quantity" + vScope: SourceUnit #1037 + type: "UserDefinedValueTypeDefinition" + firstChild: ElementaryTypeName #841 + lastChild: ElementaryTypeName #841 + previousSibling: UserDefinedValueTypeDefinition #840 + nextSibling: ContractDefinition #930 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #841 + id: 841 + src: "0:0:0" + typeString: "uint128" + name: "uint128" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: UserDefinedValueTypeDefinition #842 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ContractDefinition #930 + id: 930 + src: "0:0:0" + name: "LibWithUDVT_088" + scope: 1037 + kind: "library" + abstract: false + fullyImplemented: true + linearizedBaseContracts: Array(1) [ 930 ] + usedErrors: Array(0) + docString: undefined + nameLocation: "4792:15:0" + context: ASTContext #1000 + parent: SourceUnit #1037 + documentation: undefined + vScope: SourceUnit #1037 + vLinearizedBaseContracts: Array(1) [ ContractDefinition #930 ] + vUsedErrors: Array(0) + vInheritanceSpecifiers: Array(0) + vStateVariables: Array(1) [ VariableDeclaration #849 ] + vModifiers: Array(0) + vEvents: Array(0) + vErrors: Array(0) + vFunctions: Array(4) [ FunctionDefinition #875, FunctionDefinition #897, FunctionDefinition #913, FunctionDefinition #929 ] + vUsingForDirectives: Array(0) + vStructs: Array(0) + vEnums: Array(0) + vUserDefinedValueTypes: Array(1) [ UserDefinedValueTypeDefinition #844 ] + vConstructor: undefined + children: Array(6) [ UserDefinedValueTypeDefinition #844, VariableDeclaration #849, FunctionDefinition #875, FunctionDefinition #897, FunctionDefinition #913, FunctionDefinition #929 ] + type: "ContractDefinition" + firstChild: UserDefinedValueTypeDefinition #844 + lastChild: FunctionDefinition #929 + previousSibling: UserDefinedValueTypeDefinition #842 + nextSibling: ContractDefinition #941 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + UserDefinedValueTypeDefinition #844 + id: 844 + src: "0:0:0" + name: "UFixed" + underlyingType: ElementaryTypeName #843 + nameLocation: "4819:6:0" + context: ASTContext #1000 + parent: ContractDefinition #930 + children: Array(1) [ ElementaryTypeName #843 ] + canonicalName: "LibWithUDVT_088.UFixed" + vScope: ContractDefinition #930 + type: "UserDefinedValueTypeDefinition" + firstChild: ElementaryTypeName #843 + lastChild: ElementaryTypeName #843 + previousSibling: undefined + nextSibling: VariableDeclaration #849 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #843 + id: 843 + src: "0:0:0" + typeString: "uint256" + name: "uint256" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: UserDefinedValueTypeDefinition #844 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #849 + id: 849 + src: "0:0:0" + constant: true + indexed: false + name: "multiplier" + scope: 930 + stateVariable: true + storageLocation: "default" + visibility: "internal" + mutability: "constant" + typeString: "uint256" + documentation: undefined + nameLocation: "4857:10:0" + vType: ElementaryTypeName #845 + vOverrideSpecifier: undefined + vValue: BinaryOperation #848 + context: ASTContext #1000 + parent: ContractDefinition #930 + children: Array(2) [ ElementaryTypeName #845, BinaryOperation #848 ] + vScope: ContractDefinition #930 + type: "VariableDeclaration" + firstChild: ElementaryTypeName #845 + lastChild: BinaryOperation #848 + previousSibling: UserDefinedValueTypeDefinition #844 + nextSibling: FunctionDefinition #875 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #845 + id: 845 + src: "0:0:0" + typeString: "uint256" + name: "uint" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: VariableDeclaration #849 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: BinaryOperation #848 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + BinaryOperation #848 + id: 848 + src: "0:0:0" + typeString: "int_const 1000000000000000000" + operator: "**" + vLeftExpression: Literal #846 + vRightExpression: Literal #847 + context: ASTContext #1000 + parent: VariableDeclaration #849 + children: Array(2) [ Literal #846, Literal #847 ] + type: "BinaryOperation" + firstChild: Literal #846 + lastChild: Literal #847 + previousSibling: ElementaryTypeName #845 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Literal #846 + id: 846 + src: "0:0:0" + typeString: "int_const 10" + kind: "number" + hexValue: "3130" + value: "10" + subdenomination: undefined + context: ASTContext #1000 + parent: BinaryOperation #848 + type: "Literal" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: Literal #847 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Literal #847 + id: 847 + src: "0:0:0" + typeString: "int_const 18" + kind: "number" + hexValue: "3138" + value: "18" + subdenomination: undefined + context: ASTContext #1000 + parent: BinaryOperation #848 + type: "Literal" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: Literal #846 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionDefinition #875 + id: 875 + src: "0:0:0" + implemented: true + virtual: false + scope: 930 + kind: "function" + name: "add" + visibility: "internal" + stateMutability: "pure" + isConstructor: false + documentation: undefined + nameLocation: "4892:3:0" + vParameters: ParameterList #856 + vReturnParameters: ParameterList #860 + vModifiers: Array(0) + vOverrideSpecifier: undefined + vBody: Block #874 + context: ASTContext #1000 + parent: ContractDefinition #930 + children: Array(3) [ ParameterList #856, ParameterList #860, Block #874 ] + vScope: ContractDefinition #930 + type: "FunctionDefinition" + firstChild: ParameterList #856 + lastChild: Block #874 + previousSibling: VariableDeclaration #849 + nextSibling: FunctionDefinition #897 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #856 + id: 856 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #875 + vParameters: Array(2) [ VariableDeclaration #852, VariableDeclaration #855 ] + children: Array(2) [ VariableDeclaration #852, VariableDeclaration #855 ] + type: "ParameterList" + firstChild: VariableDeclaration #852 + lastChild: VariableDeclaration #855 + previousSibling: undefined + nextSibling: ParameterList #860 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #852 + id: 852 + src: "0:0:0" + constant: false + indexed: false + name: "a" + scope: 875 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "LibWithUDVT_088.UFixed" + documentation: undefined + nameLocation: "4903:1:0" + vType: UserDefinedTypeName #851 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: ParameterList #856 + children: Array(1) [ UserDefinedTypeName #851 ] + vScope: FunctionDefinition #875 + type: "VariableDeclaration" + firstChild: UserDefinedTypeName #851 + lastChild: UserDefinedTypeName #851 + previousSibling: undefined + nextSibling: VariableDeclaration #855 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + UserDefinedTypeName #851 + id: 851 + src: "0:0:0" + typeString: "LibWithUDVT_088.UFixed" + name: undefined + referencedDeclaration: 844 + path: IdentifierPath #850 + context: ASTContext #1000 + parent: VariableDeclaration #852 + children: Array(1) [ IdentifierPath #850 ] + vReferencedDeclaration: UserDefinedValueTypeDefinition #844 + type: "UserDefinedTypeName" + firstChild: IdentifierPath #850 + lastChild: IdentifierPath #850 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + IdentifierPath #850 + id: 850 + src: "0:0:0" + name: "UFixed" + referencedDeclaration: 320 + context: ASTContext #1000 + parent: UserDefinedTypeName #851 + vReferencedDeclaration: UserDefinedValueTypeDefinition #320 + type: "IdentifierPath" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #855 + id: 855 + src: "0:0:0" + constant: false + indexed: false + name: "b" + scope: 875 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "LibWithUDVT_088.UFixed" + documentation: undefined + nameLocation: "4913:1:0" + vType: UserDefinedTypeName #854 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: ParameterList #856 + children: Array(1) [ UserDefinedTypeName #854 ] + vScope: FunctionDefinition #875 + type: "VariableDeclaration" + firstChild: UserDefinedTypeName #854 + lastChild: UserDefinedTypeName #854 + previousSibling: VariableDeclaration #852 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + UserDefinedTypeName #854 + id: 854 + src: "0:0:0" + typeString: "LibWithUDVT_088.UFixed" + name: undefined + referencedDeclaration: 844 + path: IdentifierPath #853 + context: ASTContext #1000 + parent: VariableDeclaration #855 + children: Array(1) [ IdentifierPath #853 ] + vReferencedDeclaration: UserDefinedValueTypeDefinition #844 + type: "UserDefinedTypeName" + firstChild: IdentifierPath #853 + lastChild: IdentifierPath #853 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + IdentifierPath #853 + id: 853 + src: "0:0:0" + name: "UFixed" + referencedDeclaration: 320 + context: ASTContext #1000 + parent: UserDefinedTypeName #854 + vReferencedDeclaration: UserDefinedValueTypeDefinition #320 + type: "IdentifierPath" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #860 + id: 860 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #875 + vParameters: Array(1) [ VariableDeclaration #859 ] + children: Array(1) [ VariableDeclaration #859 ] + type: "ParameterList" + firstChild: VariableDeclaration #859 + lastChild: VariableDeclaration #859 + previousSibling: ParameterList #856 + nextSibling: Block #874 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #859 + id: 859 + src: "0:0:0" + constant: false + indexed: false + name: "" + scope: 875 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "LibWithUDVT_088.UFixed" + documentation: undefined + nameLocation: "-1:-1:-1" + vType: UserDefinedTypeName #858 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: ParameterList #860 + children: Array(1) [ UserDefinedTypeName #858 ] + vScope: FunctionDefinition #875 + type: "VariableDeclaration" + firstChild: UserDefinedTypeName #858 + lastChild: UserDefinedTypeName #858 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + UserDefinedTypeName #858 + id: 858 + src: "0:0:0" + typeString: "LibWithUDVT_088.UFixed" + name: undefined + referencedDeclaration: 844 + path: IdentifierPath #857 + context: ASTContext #1000 + parent: VariableDeclaration #859 + children: Array(1) [ IdentifierPath #857 ] + vReferencedDeclaration: UserDefinedValueTypeDefinition #844 + type: "UserDefinedTypeName" + firstChild: IdentifierPath #857 + lastChild: IdentifierPath #857 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + IdentifierPath #857 + id: 857 + src: "0:0:0" + name: "UFixed" + referencedDeclaration: 320 + context: ASTContext #1000 + parent: UserDefinedTypeName #858 + vReferencedDeclaration: UserDefinedValueTypeDefinition #320 + type: "IdentifierPath" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Block #874 + id: 874 + src: "0:0:0" + documentation: undefined + context: ASTContext #1000 + parent: FunctionDefinition #875 + vStatements: Array(1) [ Return #873 ] + children: Array(1) [ Return #873 ] + type: "Block" + firstChild: Return #873 + lastChild: Return #873 + previousSibling: ParameterList #860 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Return #873 + id: 873 + src: "0:0:0" + documentation: undefined + functionReturnParameters: 336 + vExpression: FunctionCall #872 + context: ASTContext #1000 + parent: Block #874 + children: Array(1) [ FunctionCall #872 ] + vFunctionReturnParameters: ParameterList #336 + type: "Return" + firstChild: FunctionCall #872 + lastChild: FunctionCall #872 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionCall #872 + id: 872 + src: "0:0:0" + typeString: "LibWithUDVT_088.UFixed" + kind: "functionCall" + fieldNames: undefined + vExpression: MemberAccess #862 + vArguments: Array(1) [ BinaryOperation #871 ] + context: ASTContext #1000 + parent: Return #873 + children: Array(2) [ MemberAccess #862, BinaryOperation #871 ] + vIdentifier: "UFixed" + vMemberName: "wrap" + vFunctionCallType: "builtin" + vReferencedDeclaration: undefined + vFunctionName: "wrap" + vCallee: MemberAccess #862 + type: "FunctionCall" + firstChild: MemberAccess #862 + lastChild: BinaryOperation #871 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + MemberAccess #862 + id: 862 + src: "0:0:0" + typeString: "function (uint256) pure returns (LibWithUDVT_088.UFixed)" + vExpression: Identifier #861 + memberName: "wrap" + referencedDeclaration: undefined + context: ASTContext #1000 + parent: FunctionCall #872 + children: Array(1) [ Identifier #861 ] + vReferencedDeclaration: undefined + type: "MemberAccess" + firstChild: Identifier #861 + lastChild: Identifier #861 + previousSibling: undefined + nextSibling: BinaryOperation #871 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #861 + id: 861 + src: "0:0:0" + typeString: "type(LibWithUDVT_088.UFixed)" + name: "UFixed" + referencedDeclaration: 844 + context: ASTContext #1000 + parent: MemberAccess #862 + vReferencedDeclaration: UserDefinedValueTypeDefinition #844 + vIdentifierType: "userDefined" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + BinaryOperation #871 + id: 871 + src: "0:0:0" + typeString: "uint256" + operator: "+" + vLeftExpression: FunctionCall #866 + vRightExpression: FunctionCall #870 + context: ASTContext #1000 + parent: FunctionCall #872 + children: Array(2) [ FunctionCall #866, FunctionCall #870 ] + type: "BinaryOperation" + firstChild: FunctionCall #866 + lastChild: FunctionCall #870 + previousSibling: MemberAccess #862 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionCall #866 + id: 866 + src: "0:0:0" + typeString: "uint256" + kind: "functionCall" + fieldNames: undefined + vExpression: MemberAccess #864 + vArguments: Array(1) [ Identifier #865 ] + context: ASTContext #1000 + parent: BinaryOperation #871 + children: Array(2) [ MemberAccess #864, Identifier #865 ] + vIdentifier: "UFixed" + vMemberName: "unwrap" + vFunctionCallType: "builtin" + vReferencedDeclaration: undefined + vFunctionName: "unwrap" + vCallee: MemberAccess #864 + type: "FunctionCall" + firstChild: MemberAccess #864 + lastChild: Identifier #865 + previousSibling: undefined + nextSibling: FunctionCall #870 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + MemberAccess #864 + id: 864 + src: "0:0:0" + typeString: "function (LibWithUDVT_088.UFixed) pure returns (uint256)" + vExpression: Identifier #863 + memberName: "unwrap" + referencedDeclaration: undefined + context: ASTContext #1000 + parent: FunctionCall #866 + children: Array(1) [ Identifier #863 ] + vReferencedDeclaration: undefined + type: "MemberAccess" + firstChild: Identifier #863 + lastChild: Identifier #863 + previousSibling: undefined + nextSibling: Identifier #865 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #863 + id: 863 + src: "0:0:0" + typeString: "type(LibWithUDVT_088.UFixed)" + name: "UFixed" + referencedDeclaration: 844 + context: ASTContext #1000 + parent: MemberAccess #864 + vReferencedDeclaration: UserDefinedValueTypeDefinition #844 + vIdentifierType: "userDefined" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #865 + id: 865 + src: "0:0:0" + typeString: "LibWithUDVT_088.UFixed" + name: "a" + referencedDeclaration: 852 + context: ASTContext #1000 + parent: FunctionCall #866 + vReferencedDeclaration: VariableDeclaration #852 + vIdentifierType: "userDefined" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: MemberAccess #864 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionCall #870 + id: 870 + src: "0:0:0" + typeString: "uint256" + kind: "functionCall" + fieldNames: undefined + vExpression: MemberAccess #868 + vArguments: Array(1) [ Identifier #869 ] + context: ASTContext #1000 + parent: BinaryOperation #871 + children: Array(2) [ MemberAccess #868, Identifier #869 ] + vIdentifier: "UFixed" + vMemberName: "unwrap" + vFunctionCallType: "builtin" + vReferencedDeclaration: undefined + vFunctionName: "unwrap" + vCallee: MemberAccess #868 + type: "FunctionCall" + firstChild: MemberAccess #868 + lastChild: Identifier #869 + previousSibling: FunctionCall #866 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + MemberAccess #868 + id: 868 + src: "0:0:0" + typeString: "function (LibWithUDVT_088.UFixed) pure returns (uint256)" + vExpression: Identifier #867 + memberName: "unwrap" + referencedDeclaration: undefined + context: ASTContext #1000 + parent: FunctionCall #870 + children: Array(1) [ Identifier #867 ] + vReferencedDeclaration: undefined + type: "MemberAccess" + firstChild: Identifier #867 + lastChild: Identifier #867 + previousSibling: undefined + nextSibling: Identifier #869 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #867 + id: 867 + src: "0:0:0" + typeString: "type(LibWithUDVT_088.UFixed)" + name: "UFixed" + referencedDeclaration: 844 + context: ASTContext #1000 + parent: MemberAccess #868 + vReferencedDeclaration: UserDefinedValueTypeDefinition #844 + vIdentifierType: "userDefined" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #869 + id: 869 + src: "0:0:0" + typeString: "LibWithUDVT_088.UFixed" + name: "b" + referencedDeclaration: 855 + context: ASTContext #1000 + parent: FunctionCall #870 + vReferencedDeclaration: VariableDeclaration #855 + vIdentifierType: "userDefined" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: MemberAccess #868 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionDefinition #897 + id: 897 + src: "0:0:0" + implemented: true + virtual: false + scope: 930 + kind: "function" + name: "mul" + visibility: "internal" + stateMutability: "pure" + isConstructor: false + documentation: undefined + nameLocation: "5034:3:0" + vParameters: ParameterList #881 + vReturnParameters: ParameterList #885 + vModifiers: Array(0) + vOverrideSpecifier: undefined + vBody: Block #896 + context: ASTContext #1000 + parent: ContractDefinition #930 + children: Array(3) [ ParameterList #881, ParameterList #885, Block #896 ] + vScope: ContractDefinition #930 + type: "FunctionDefinition" + firstChild: ParameterList #881 + lastChild: Block #896 + previousSibling: FunctionDefinition #875 + nextSibling: FunctionDefinition #913 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #881 + id: 881 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #897 + vParameters: Array(2) [ VariableDeclaration #878, VariableDeclaration #880 ] + children: Array(2) [ VariableDeclaration #878, VariableDeclaration #880 ] + type: "ParameterList" + firstChild: VariableDeclaration #878 + lastChild: VariableDeclaration #880 + previousSibling: undefined + nextSibling: ParameterList #885 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #878 + id: 878 + src: "0:0:0" + constant: false + indexed: false + name: "a" + scope: 897 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "LibWithUDVT_088.UFixed" + documentation: undefined + nameLocation: "5045:1:0" + vType: UserDefinedTypeName #877 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: ParameterList #881 + children: Array(1) [ UserDefinedTypeName #877 ] + vScope: FunctionDefinition #897 + type: "VariableDeclaration" + firstChild: UserDefinedTypeName #877 + lastChild: UserDefinedTypeName #877 + previousSibling: undefined + nextSibling: VariableDeclaration #880 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + UserDefinedTypeName #877 + id: 877 + src: "0:0:0" + typeString: "LibWithUDVT_088.UFixed" + name: undefined + referencedDeclaration: 844 + path: IdentifierPath #876 + context: ASTContext #1000 + parent: VariableDeclaration #878 + children: Array(1) [ IdentifierPath #876 ] + vReferencedDeclaration: UserDefinedValueTypeDefinition #844 + type: "UserDefinedTypeName" + firstChild: IdentifierPath #876 + lastChild: IdentifierPath #876 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + IdentifierPath #876 + id: 876 + src: "0:0:0" + name: "UFixed" + referencedDeclaration: 320 + context: ASTContext #1000 + parent: UserDefinedTypeName #877 + vReferencedDeclaration: UserDefinedValueTypeDefinition #320 + type: "IdentifierPath" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #880 + id: 880 + src: "0:0:0" + constant: false + indexed: false + name: "b" + scope: 897 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "uint256" + documentation: undefined + nameLocation: "5056:1:0" + vType: ElementaryTypeName #879 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: ParameterList #881 + children: Array(1) [ ElementaryTypeName #879 ] + vScope: FunctionDefinition #897 + type: "VariableDeclaration" + firstChild: ElementaryTypeName #879 + lastChild: ElementaryTypeName #879 + previousSibling: VariableDeclaration #878 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #879 + id: 879 + src: "0:0:0" + typeString: "uint256" + name: "uint256" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: VariableDeclaration #880 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #885 + id: 885 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #897 + vParameters: Array(1) [ VariableDeclaration #884 ] + children: Array(1) [ VariableDeclaration #884 ] + type: "ParameterList" + firstChild: VariableDeclaration #884 + lastChild: VariableDeclaration #884 + previousSibling: ParameterList #881 + nextSibling: Block #896 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #884 + id: 884 + src: "0:0:0" + constant: false + indexed: false + name: "" + scope: 897 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "LibWithUDVT_088.UFixed" + documentation: undefined + nameLocation: "-1:-1:-1" + vType: UserDefinedTypeName #883 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: ParameterList #885 + children: Array(1) [ UserDefinedTypeName #883 ] + vScope: FunctionDefinition #897 + type: "VariableDeclaration" + firstChild: UserDefinedTypeName #883 + lastChild: UserDefinedTypeName #883 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + UserDefinedTypeName #883 + id: 883 + src: "0:0:0" + typeString: "LibWithUDVT_088.UFixed" + name: undefined + referencedDeclaration: 844 + path: IdentifierPath #882 + context: ASTContext #1000 + parent: VariableDeclaration #884 + children: Array(1) [ IdentifierPath #882 ] + vReferencedDeclaration: UserDefinedValueTypeDefinition #844 + type: "UserDefinedTypeName" + firstChild: IdentifierPath #882 + lastChild: IdentifierPath #882 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + IdentifierPath #882 + id: 882 + src: "0:0:0" + name: "UFixed" + referencedDeclaration: 320 + context: ASTContext #1000 + parent: UserDefinedTypeName #883 + vReferencedDeclaration: UserDefinedValueTypeDefinition #320 + type: "IdentifierPath" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Block #896 + id: 896 + src: "0:0:0" + documentation: undefined + context: ASTContext #1000 + parent: FunctionDefinition #897 + vStatements: Array(1) [ Return #895 ] + children: Array(1) [ Return #895 ] + type: "Block" + firstChild: Return #895 + lastChild: Return #895 + previousSibling: ParameterList #885 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Return #895 + id: 895 + src: "0:0:0" + documentation: undefined + functionReturnParameters: 361 + vExpression: FunctionCall #894 + context: ASTContext #1000 + parent: Block #896 + children: Array(1) [ FunctionCall #894 ] + vFunctionReturnParameters: ParameterList #361 + type: "Return" + firstChild: FunctionCall #894 + lastChild: FunctionCall #894 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionCall #894 + id: 894 + src: "0:0:0" + typeString: "LibWithUDVT_088.UFixed" + kind: "functionCall" + fieldNames: undefined + vExpression: MemberAccess #887 + vArguments: Array(1) [ BinaryOperation #893 ] + context: ASTContext #1000 + parent: Return #895 + children: Array(2) [ MemberAccess #887, BinaryOperation #893 ] + vIdentifier: "UFixed" + vMemberName: "wrap" + vFunctionCallType: "builtin" + vReferencedDeclaration: undefined + vFunctionName: "wrap" + vCallee: MemberAccess #887 + type: "FunctionCall" + firstChild: MemberAccess #887 + lastChild: BinaryOperation #893 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + MemberAccess #887 + id: 887 + src: "0:0:0" + typeString: "function (uint256) pure returns (LibWithUDVT_088.UFixed)" + vExpression: Identifier #886 + memberName: "wrap" + referencedDeclaration: undefined + context: ASTContext #1000 + parent: FunctionCall #894 + children: Array(1) [ Identifier #886 ] + vReferencedDeclaration: undefined + type: "MemberAccess" + firstChild: Identifier #886 + lastChild: Identifier #886 + previousSibling: undefined + nextSibling: BinaryOperation #893 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #886 + id: 886 + src: "0:0:0" + typeString: "type(LibWithUDVT_088.UFixed)" + name: "UFixed" + referencedDeclaration: 844 + context: ASTContext #1000 + parent: MemberAccess #887 + vReferencedDeclaration: UserDefinedValueTypeDefinition #844 + vIdentifierType: "userDefined" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + BinaryOperation #893 + id: 893 + src: "0:0:0" + typeString: "uint256" + operator: "*" + vLeftExpression: FunctionCall #891 + vRightExpression: Identifier #892 + context: ASTContext #1000 + parent: FunctionCall #894 + children: Array(2) [ FunctionCall #891, Identifier #892 ] + type: "BinaryOperation" + firstChild: FunctionCall #891 + lastChild: Identifier #892 + previousSibling: MemberAccess #887 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionCall #891 + id: 891 + src: "0:0:0" + typeString: "uint256" + kind: "functionCall" + fieldNames: undefined + vExpression: MemberAccess #889 + vArguments: Array(1) [ Identifier #890 ] + context: ASTContext #1000 + parent: BinaryOperation #893 + children: Array(2) [ MemberAccess #889, Identifier #890 ] + vIdentifier: "UFixed" + vMemberName: "unwrap" + vFunctionCallType: "builtin" + vReferencedDeclaration: undefined + vFunctionName: "unwrap" + vCallee: MemberAccess #889 + type: "FunctionCall" + firstChild: MemberAccess #889 + lastChild: Identifier #890 + previousSibling: undefined + nextSibling: Identifier #892 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + MemberAccess #889 + id: 889 + src: "0:0:0" + typeString: "function (LibWithUDVT_088.UFixed) pure returns (uint256)" + vExpression: Identifier #888 + memberName: "unwrap" + referencedDeclaration: undefined + context: ASTContext #1000 + parent: FunctionCall #891 + children: Array(1) [ Identifier #888 ] + vReferencedDeclaration: undefined + type: "MemberAccess" + firstChild: Identifier #888 + lastChild: Identifier #888 + previousSibling: undefined + nextSibling: Identifier #890 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #888 + id: 888 + src: "0:0:0" + typeString: "type(LibWithUDVT_088.UFixed)" + name: "UFixed" + referencedDeclaration: 844 + context: ASTContext #1000 + parent: MemberAccess #889 + vReferencedDeclaration: UserDefinedValueTypeDefinition #844 + vIdentifierType: "userDefined" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #890 + id: 890 + src: "0:0:0" + typeString: "LibWithUDVT_088.UFixed" + name: "a" + referencedDeclaration: 878 + context: ASTContext #1000 + parent: FunctionCall #891 + vReferencedDeclaration: VariableDeclaration #878 + vIdentifierType: "userDefined" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: MemberAccess #889 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #892 + id: 892 + src: "0:0:0" + typeString: "uint256" + name: "b" + referencedDeclaration: 880 + context: ASTContext #1000 + parent: BinaryOperation #893 + vReferencedDeclaration: VariableDeclaration #880 + vIdentifierType: "userDefined" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: FunctionCall #891 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionDefinition #913 + id: 913 + src: "0:0:0" + implemented: true + virtual: false + scope: 930 + kind: "function" + name: "floor" + visibility: "internal" + stateMutability: "pure" + isConstructor: false + documentation: undefined + nameLocation: "5162:5:0" + vParameters: ParameterList #901 + vReturnParameters: ParameterList #904 + vModifiers: Array(0) + vOverrideSpecifier: undefined + vBody: Block #912 + context: ASTContext #1000 + parent: ContractDefinition #930 + children: Array(3) [ ParameterList #901, ParameterList #904, Block #912 ] + vScope: ContractDefinition #930 + type: "FunctionDefinition" + firstChild: ParameterList #901 + lastChild: Block #912 + previousSibling: FunctionDefinition #897 + nextSibling: FunctionDefinition #929 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #901 + id: 901 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #913 + vParameters: Array(1) [ VariableDeclaration #900 ] + children: Array(1) [ VariableDeclaration #900 ] + type: "ParameterList" + firstChild: VariableDeclaration #900 + lastChild: VariableDeclaration #900 + previousSibling: undefined + nextSibling: ParameterList #904 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #900 + id: 900 + src: "0:0:0" + constant: false + indexed: false + name: "a" + scope: 913 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "LibWithUDVT_088.UFixed" + documentation: undefined + nameLocation: "5175:1:0" + vType: UserDefinedTypeName #899 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: ParameterList #901 + children: Array(1) [ UserDefinedTypeName #899 ] + vScope: FunctionDefinition #913 + type: "VariableDeclaration" + firstChild: UserDefinedTypeName #899 + lastChild: UserDefinedTypeName #899 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + UserDefinedTypeName #899 + id: 899 + src: "0:0:0" + typeString: "LibWithUDVT_088.UFixed" + name: undefined + referencedDeclaration: 844 + path: IdentifierPath #898 + context: ASTContext #1000 + parent: VariableDeclaration #900 + children: Array(1) [ IdentifierPath #898 ] + vReferencedDeclaration: UserDefinedValueTypeDefinition #844 + type: "UserDefinedTypeName" + firstChild: IdentifierPath #898 + lastChild: IdentifierPath #898 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + IdentifierPath #898 + id: 898 + src: "0:0:0" + name: "UFixed" + referencedDeclaration: 320 + context: ASTContext #1000 + parent: UserDefinedTypeName #899 + vReferencedDeclaration: UserDefinedValueTypeDefinition #320 + type: "IdentifierPath" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #904 + id: 904 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #913 + vParameters: Array(1) [ VariableDeclaration #903 ] + children: Array(1) [ VariableDeclaration #903 ] + type: "ParameterList" + firstChild: VariableDeclaration #903 + lastChild: VariableDeclaration #903 + previousSibling: ParameterList #901 + nextSibling: Block #912 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #903 + id: 903 + src: "0:0:0" + constant: false + indexed: false + name: "" + scope: 913 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "uint256" + documentation: undefined + nameLocation: "-1:-1:-1" + vType: ElementaryTypeName #902 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: ParameterList #904 + children: Array(1) [ ElementaryTypeName #902 ] + vScope: FunctionDefinition #913 + type: "VariableDeclaration" + firstChild: ElementaryTypeName #902 + lastChild: ElementaryTypeName #902 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #902 + id: 902 + src: "0:0:0" + typeString: "uint256" + name: "uint256" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: VariableDeclaration #903 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Block #912 + id: 912 + src: "0:0:0" + documentation: undefined + context: ASTContext #1000 + parent: FunctionDefinition #913 + vStatements: Array(1) [ Return #911 ] + children: Array(1) [ Return #911 ] + type: "Block" + firstChild: Return #911 + lastChild: Return #911 + previousSibling: ParameterList #904 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Return #911 + id: 911 + src: "0:0:0" + documentation: undefined + functionReturnParameters: 380 + vExpression: BinaryOperation #910 + context: ASTContext #1000 + parent: Block #912 + children: Array(1) [ BinaryOperation #910 ] + vFunctionReturnParameters: ParameterList #380 + type: "Return" + firstChild: BinaryOperation #910 + lastChild: BinaryOperation #910 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + BinaryOperation #910 + id: 910 + src: "0:0:0" + typeString: "uint256" + operator: "/" + vLeftExpression: FunctionCall #908 + vRightExpression: Identifier #909 + context: ASTContext #1000 + parent: Return #911 + children: Array(2) [ FunctionCall #908, Identifier #909 ] + type: "BinaryOperation" + firstChild: FunctionCall #908 + lastChild: Identifier #909 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionCall #908 + id: 908 + src: "0:0:0" + typeString: "uint256" + kind: "functionCall" + fieldNames: undefined + vExpression: MemberAccess #906 + vArguments: Array(1) [ Identifier #907 ] + context: ASTContext #1000 + parent: BinaryOperation #910 + children: Array(2) [ MemberAccess #906, Identifier #907 ] + vIdentifier: "UFixed" + vMemberName: "unwrap" + vFunctionCallType: "builtin" + vReferencedDeclaration: undefined + vFunctionName: "unwrap" + vCallee: MemberAccess #906 + type: "FunctionCall" + firstChild: MemberAccess #906 + lastChild: Identifier #907 + previousSibling: undefined + nextSibling: Identifier #909 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + MemberAccess #906 + id: 906 + src: "0:0:0" + typeString: "function (LibWithUDVT_088.UFixed) pure returns (uint256)" + vExpression: Identifier #905 + memberName: "unwrap" + referencedDeclaration: undefined + context: ASTContext #1000 + parent: FunctionCall #908 + children: Array(1) [ Identifier #905 ] + vReferencedDeclaration: undefined + type: "MemberAccess" + firstChild: Identifier #905 + lastChild: Identifier #905 + previousSibling: undefined + nextSibling: Identifier #907 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #905 + id: 905 + src: "0:0:0" + typeString: "type(LibWithUDVT_088.UFixed)" + name: "UFixed" + referencedDeclaration: 844 + context: ASTContext #1000 + parent: MemberAccess #906 + vReferencedDeclaration: UserDefinedValueTypeDefinition #844 + vIdentifierType: "userDefined" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #907 + id: 907 + src: "0:0:0" + typeString: "LibWithUDVT_088.UFixed" + name: "a" + referencedDeclaration: 900 + context: ASTContext #1000 + parent: FunctionCall #908 + vReferencedDeclaration: VariableDeclaration #900 + vIdentifierType: "userDefined" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: MemberAccess #906 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #909 + id: 909 + src: "0:0:0" + typeString: "uint256" + name: "multiplier" + referencedDeclaration: 849 + context: ASTContext #1000 + parent: BinaryOperation #910 + vReferencedDeclaration: VariableDeclaration #849 + vIdentifierType: "userDefined" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: FunctionCall #908 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionDefinition #929 + id: 929 + src: "0:0:0" + implemented: true + virtual: false + scope: 930 + kind: "function" + name: "toUFixed" + visibility: "internal" + stateMutability: "pure" + isConstructor: false + documentation: undefined + nameLocation: "5278:8:0" + vParameters: ParameterList #916 + vReturnParameters: ParameterList #920 + vModifiers: Array(0) + vOverrideSpecifier: undefined + vBody: Block #928 + context: ASTContext #1000 + parent: ContractDefinition #930 + children: Array(3) [ ParameterList #916, ParameterList #920, Block #928 ] + vScope: ContractDefinition #930 + type: "FunctionDefinition" + firstChild: ParameterList #916 + lastChild: Block #928 + previousSibling: FunctionDefinition #913 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #916 + id: 916 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #929 + vParameters: Array(1) [ VariableDeclaration #915 ] + children: Array(1) [ VariableDeclaration #915 ] + type: "ParameterList" + firstChild: VariableDeclaration #915 + lastChild: VariableDeclaration #915 + previousSibling: undefined + nextSibling: ParameterList #920 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #915 + id: 915 + src: "0:0:0" + constant: false + indexed: false + name: "a" + scope: 929 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "uint256" + documentation: undefined + nameLocation: "5295:1:0" + vType: ElementaryTypeName #914 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: ParameterList #916 + children: Array(1) [ ElementaryTypeName #914 ] + vScope: FunctionDefinition #929 + type: "VariableDeclaration" + firstChild: ElementaryTypeName #914 + lastChild: ElementaryTypeName #914 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #914 + id: 914 + src: "0:0:0" + typeString: "uint256" + name: "uint256" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: VariableDeclaration #915 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #920 + id: 920 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #929 + vParameters: Array(1) [ VariableDeclaration #919 ] + children: Array(1) [ VariableDeclaration #919 ] + type: "ParameterList" + firstChild: VariableDeclaration #919 + lastChild: VariableDeclaration #919 + previousSibling: ParameterList #916 + nextSibling: Block #928 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #919 + id: 919 + src: "0:0:0" + constant: false + indexed: false + name: "" + scope: 929 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "LibWithUDVT_088.UFixed" + documentation: undefined + nameLocation: "-1:-1:-1" + vType: UserDefinedTypeName #918 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: ParameterList #920 + children: Array(1) [ UserDefinedTypeName #918 ] + vScope: FunctionDefinition #929 + type: "VariableDeclaration" + firstChild: UserDefinedTypeName #918 + lastChild: UserDefinedTypeName #918 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + UserDefinedTypeName #918 + id: 918 + src: "0:0:0" + typeString: "LibWithUDVT_088.UFixed" + name: undefined + referencedDeclaration: 844 + path: IdentifierPath #917 + context: ASTContext #1000 + parent: VariableDeclaration #919 + children: Array(1) [ IdentifierPath #917 ] + vReferencedDeclaration: UserDefinedValueTypeDefinition #844 + type: "UserDefinedTypeName" + firstChild: IdentifierPath #917 + lastChild: IdentifierPath #917 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + IdentifierPath #917 + id: 917 + src: "0:0:0" + name: "UFixed" + referencedDeclaration: 320 + context: ASTContext #1000 + parent: UserDefinedTypeName #918 + vReferencedDeclaration: UserDefinedValueTypeDefinition #320 + type: "IdentifierPath" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Block #928 + id: 928 + src: "0:0:0" + documentation: undefined + context: ASTContext #1000 + parent: FunctionDefinition #929 + vStatements: Array(1) [ Return #927 ] + children: Array(1) [ Return #927 ] + type: "Block" + firstChild: Return #927 + lastChild: Return #927 + previousSibling: ParameterList #920 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Return #927 + id: 927 + src: "0:0:0" + documentation: undefined + functionReturnParameters: 396 + vExpression: FunctionCall #926 + context: ASTContext #1000 + parent: Block #928 + children: Array(1) [ FunctionCall #926 ] + vFunctionReturnParameters: ParameterList #396 + type: "Return" + firstChild: FunctionCall #926 + lastChild: FunctionCall #926 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionCall #926 + id: 926 + src: "0:0:0" + typeString: "LibWithUDVT_088.UFixed" + kind: "functionCall" + fieldNames: undefined + vExpression: MemberAccess #922 + vArguments: Array(1) [ BinaryOperation #925 ] + context: ASTContext #1000 + parent: Return #927 + children: Array(2) [ MemberAccess #922, BinaryOperation #925 ] + vIdentifier: "UFixed" + vMemberName: "wrap" + vFunctionCallType: "builtin" + vReferencedDeclaration: undefined + vFunctionName: "wrap" + vCallee: MemberAccess #922 + type: "FunctionCall" + firstChild: MemberAccess #922 + lastChild: BinaryOperation #925 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + MemberAccess #922 + id: 922 + src: "0:0:0" + typeString: "function (uint256) pure returns (LibWithUDVT_088.UFixed)" + vExpression: Identifier #921 + memberName: "wrap" + referencedDeclaration: undefined + context: ASTContext #1000 + parent: FunctionCall #926 + children: Array(1) [ Identifier #921 ] + vReferencedDeclaration: undefined + type: "MemberAccess" + firstChild: Identifier #921 + lastChild: Identifier #921 + previousSibling: undefined + nextSibling: BinaryOperation #925 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #921 + id: 921 + src: "0:0:0" + typeString: "type(LibWithUDVT_088.UFixed)" + name: "UFixed" + referencedDeclaration: 844 + context: ASTContext #1000 + parent: MemberAccess #922 + vReferencedDeclaration: UserDefinedValueTypeDefinition #844 + vIdentifierType: "userDefined" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + BinaryOperation #925 + id: 925 + src: "0:0:0" + typeString: "uint256" + operator: "*" + vLeftExpression: Identifier #923 + vRightExpression: Identifier #924 + context: ASTContext #1000 + parent: FunctionCall #926 + children: Array(2) [ Identifier #923, Identifier #924 ] + type: "BinaryOperation" + firstChild: Identifier #923 + lastChild: Identifier #924 + previousSibling: MemberAccess #922 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #923 + id: 923 + src: "0:0:0" + typeString: "uint256" + name: "a" + referencedDeclaration: 915 + context: ASTContext #1000 + parent: BinaryOperation #925 + vReferencedDeclaration: VariableDeclaration #915 + vIdentifierType: "userDefined" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: Identifier #924 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #924 + id: 924 + src: "0:0:0" + typeString: "uint256" + name: "multiplier" + referencedDeclaration: 849 + context: ASTContext #1000 + parent: BinaryOperation #925 + vReferencedDeclaration: VariableDeclaration #849 + vIdentifierType: "userDefined" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: Identifier #923 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ContractDefinition #941 + id: 941 + src: "0:0:0" + name: "InterfaceWithUDTV_088" + scope: 1037 + kind: "interface" + abstract: false + fullyImplemented: false + linearizedBaseContracts: Array(1) [ 941 ] + usedErrors: Array(0) + docString: undefined + nameLocation: "5394:21:0" + context: ASTContext #1000 + parent: SourceUnit #1037 + documentation: undefined + vScope: SourceUnit #1037 + vLinearizedBaseContracts: Array(1) [ ContractDefinition #941 ] + vUsedErrors: Array(0) + vInheritanceSpecifiers: Array(0) + vStateVariables: Array(0) + vModifiers: Array(0) + vEvents: Array(0) + vErrors: Array(0) + vFunctions: Array(1) [ FunctionDefinition #940 ] + vUsingForDirectives: Array(0) + vStructs: Array(0) + vEnums: Array(0) + vUserDefinedValueTypes: Array(1) [ UserDefinedValueTypeDefinition #932 ] + vConstructor: undefined + children: Array(2) [ UserDefinedValueTypeDefinition #932, FunctionDefinition #940 ] + type: "ContractDefinition" + firstChild: UserDefinedValueTypeDefinition #932 + lastChild: FunctionDefinition #940 + previousSibling: ContractDefinition #930 + nextSibling: ContractDefinition #966 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + UserDefinedValueTypeDefinition #932 + id: 932 + src: "0:0:0" + name: "EntityReference" + underlyingType: ElementaryTypeName #931 + nameLocation: "5483:15:0" + context: ASTContext #1000 + parent: ContractDefinition #941 + children: Array(1) [ ElementaryTypeName #931 ] + canonicalName: "InterfaceWithUDTV_088.EntityReference" + vScope: ContractDefinition #941 + type: "UserDefinedValueTypeDefinition" + firstChild: ElementaryTypeName #931 + lastChild: ElementaryTypeName #931 + previousSibling: undefined + nextSibling: FunctionDefinition #940 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #931 + id: 931 + src: "0:0:0" + typeString: "address payable" + name: "address" + stateMutability: "payable" + context: ASTContext #1000 + parent: UserDefinedValueTypeDefinition #932 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionDefinition #940 + id: 940 + src: "0:0:0" + implemented: false + virtual: false + scope: 941 + kind: "function" + name: "balance" + visibility: "external" + stateMutability: "view" + isConstructor: false + documentation: undefined + nameLocation: "5533:7:0" + vParameters: ParameterList #936 + vReturnParameters: ParameterList #939 + vModifiers: Array(0) + vOverrideSpecifier: undefined + vBody: undefined + context: ASTContext #1000 + parent: ContractDefinition #941 + children: Array(2) [ ParameterList #936, ParameterList #939 ] + vScope: ContractDefinition #941 + type: "FunctionDefinition" + firstChild: ParameterList #936 + lastChild: ParameterList #939 + previousSibling: UserDefinedValueTypeDefinition #932 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #936 + id: 936 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #940 + vParameters: Array(1) [ VariableDeclaration #935 ] + children: Array(1) [ VariableDeclaration #935 ] + type: "ParameterList" + firstChild: VariableDeclaration #935 + lastChild: VariableDeclaration #935 + previousSibling: undefined + nextSibling: ParameterList #939 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #935 + id: 935 + src: "0:0:0" + constant: false + indexed: false + name: "er" + scope: 940 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "InterfaceWithUDTV_088.EntityReference" + documentation: undefined + nameLocation: "5557:2:0" + vType: UserDefinedTypeName #934 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: ParameterList #936 + children: Array(1) [ UserDefinedTypeName #934 ] + vScope: FunctionDefinition #940 + type: "VariableDeclaration" + firstChild: UserDefinedTypeName #934 + lastChild: UserDefinedTypeName #934 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + UserDefinedTypeName #934 + id: 934 + src: "0:0:0" + typeString: "InterfaceWithUDTV_088.EntityReference" + name: undefined + referencedDeclaration: 932 + path: IdentifierPath #933 + context: ASTContext #1000 + parent: VariableDeclaration #935 + children: Array(1) [ IdentifierPath #933 ] + vReferencedDeclaration: UserDefinedValueTypeDefinition #932 + type: "UserDefinedTypeName" + firstChild: IdentifierPath #933 + lastChild: IdentifierPath #933 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + IdentifierPath #933 + id: 933 + src: "0:0:0" + name: "EntityReference" + referencedDeclaration: 408 + context: ASTContext #1000 + parent: UserDefinedTypeName #934 + vReferencedDeclaration: UserDefinedValueTypeDefinition #408 + type: "IdentifierPath" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #939 + id: 939 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #940 + vParameters: Array(1) [ VariableDeclaration #938 ] + children: Array(1) [ VariableDeclaration #938 ] + type: "ParameterList" + firstChild: VariableDeclaration #938 + lastChild: VariableDeclaration #938 + previousSibling: ParameterList #936 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #938 + id: 938 + src: "0:0:0" + constant: false + indexed: false + name: "" + scope: 940 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "uint256" + documentation: undefined + nameLocation: "-1:-1:-1" + vType: ElementaryTypeName #937 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: ParameterList #939 + children: Array(1) [ ElementaryTypeName #937 ] + vScope: FunctionDefinition #940 + type: "VariableDeclaration" + firstChild: ElementaryTypeName #937 + lastChild: ElementaryTypeName #937 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #937 + id: 937 + src: "0:0:0" + typeString: "uint256" + name: "uint" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: VariableDeclaration #938 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ContractDefinition #966 + id: 966 + src: "0:0:0" + name: "EnumTypeMinMax_088" + scope: 1037 + kind: "contract" + abstract: false + fullyImplemented: true + linearizedBaseContracts: Array(1) [ 966 ] + usedErrors: Array(0) + docString: undefined + nameLocation: "5602:18:0" + context: ASTContext #1000 + parent: SourceUnit #1037 + documentation: undefined + vScope: SourceUnit #1037 + vLinearizedBaseContracts: Array(1) [ ContractDefinition #966 ] + vUsedErrors: Array(0) + vInheritanceSpecifiers: Array(0) + vStateVariables: Array(0) + vModifiers: Array(0) + vEvents: Array(0) + vErrors: Array(0) + vFunctions: Array(1) [ FunctionDefinition #965 ] + vUsingForDirectives: Array(0) + vStructs: Array(0) + vEnums: Array(0) + vUserDefinedValueTypes: Array(0) + vConstructor: undefined + children: Array(1) [ FunctionDefinition #965 ] + type: "ContractDefinition" + firstChild: FunctionDefinition #965 + lastChild: FunctionDefinition #965 + previousSibling: ContractDefinition #941 + nextSibling: ContractDefinition #997 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionDefinition #965 + id: 965 + src: "0:0:0" + implemented: true + virtual: false + scope: 966 + kind: "function" + name: "testEnumMinMax" + visibility: "public" + stateMutability: "pure" + isConstructor: false + documentation: undefined + nameLocation: "5636:14:0" + vParameters: ParameterList #942 + vReturnParameters: ParameterList #943 + vModifiers: Array(0) + vOverrideSpecifier: undefined + vBody: Block #964 + context: ASTContext #1000 + parent: ContractDefinition #966 + children: Array(3) [ ParameterList #942, ParameterList #943, Block #964 ] + vScope: ContractDefinition #966 + type: "FunctionDefinition" + firstChild: ParameterList #942 + lastChild: Block #964 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #942 + id: 942 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #965 + vParameters: Array(0) + children: Array(0) + type: "ParameterList" + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: ParameterList #943 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #943 + id: 943 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #965 + vParameters: Array(0) + children: Array(0) + type: "ParameterList" + firstChild: undefined + lastChild: undefined + previousSibling: ParameterList #942 + nextSibling: Block #964 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Block #964 + id: 964 + src: "0:0:0" + documentation: undefined + context: ASTContext #1000 + parent: FunctionDefinition #965 + vStatements: Array(2) [ ExpressionStatement #953, ExpressionStatement #963 ] + children: Array(2) [ ExpressionStatement #953, ExpressionStatement #963 ] + type: "Block" + firstChild: ExpressionStatement #953 + lastChild: ExpressionStatement #963 + previousSibling: ParameterList #943 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ExpressionStatement #953 + id: 953 + src: "0:0:0" + documentation: undefined + vExpression: FunctionCall #952 + context: ASTContext #1000 + parent: Block #964 + children: Array(1) [ FunctionCall #952 ] + type: "ExpressionStatement" + firstChild: FunctionCall #952 + lastChild: FunctionCall #952 + previousSibling: undefined + nextSibling: ExpressionStatement #963 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionCall #952 + id: 952 + src: "0:0:0" + typeString: "tuple()" + kind: "functionCall" + fieldNames: undefined + vExpression: Identifier #944 + vArguments: Array(1) [ BinaryOperation #951 ] + context: ASTContext #1000 + parent: ExpressionStatement #953 + children: Array(2) [ Identifier #944, BinaryOperation #951 ] + vIdentifier: "assert" + vMemberName: undefined + vFunctionCallType: "builtin" + vReferencedDeclaration: undefined + vFunctionName: "assert" + vCallee: Identifier #944 + type: "FunctionCall" + firstChild: Identifier #944 + lastChild: BinaryOperation #951 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #944 + id: 944 + src: "0:0:0" + typeString: "function (bool) pure" + name: "assert" + referencedDeclaration: -3 + context: ASTContext #1000 + parent: FunctionCall #952 + vReferencedDeclaration: undefined + vIdentifierType: "builtin" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: BinaryOperation #951 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + BinaryOperation #951 + id: 951 + src: "0:0:0" + typeString: "bool" + operator: "==" + vLeftExpression: MemberAccess #948 + vRightExpression: MemberAccess #950 + context: ASTContext #1000 + parent: FunctionCall #952 + children: Array(2) [ MemberAccess #948, MemberAccess #950 ] + type: "BinaryOperation" + firstChild: MemberAccess #948 + lastChild: MemberAccess #950 + previousSibling: Identifier #944 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + MemberAccess #948 + id: 948 + src: "0:0:0" + typeString: "enum EnumABC" + vExpression: FunctionCall #947 + memberName: "min" + referencedDeclaration: undefined + context: ASTContext #1000 + parent: BinaryOperation #951 + children: Array(1) [ FunctionCall #947 ] + vReferencedDeclaration: undefined + type: "MemberAccess" + firstChild: FunctionCall #947 + lastChild: FunctionCall #947 + previousSibling: undefined + nextSibling: MemberAccess #950 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionCall #947 + id: 947 + src: "0:0:0" + typeString: "type(enum EnumABC)" + kind: "functionCall" + fieldNames: undefined + vExpression: Identifier #945 + vArguments: Array(1) [ Identifier #946 ] + context: ASTContext #1000 + parent: MemberAccess #948 + children: Array(2) [ Identifier #945, Identifier #946 ] + vIdentifier: "type" + vMemberName: undefined + vFunctionCallType: "builtin" + vReferencedDeclaration: undefined + vFunctionName: "type" + vCallee: Identifier #945 + type: "FunctionCall" + firstChild: Identifier #945 + lastChild: Identifier #946 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #945 + id: 945 + src: "0:0:0" + typeString: "function () pure" + name: "type" + referencedDeclaration: -27 + context: ASTContext #1000 + parent: FunctionCall #947 + vReferencedDeclaration: undefined + vIdentifierType: "builtin" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: Identifier #946 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #946 + id: 946 + src: "0:0:0" + typeString: "type(enum EnumABC)" + name: "EnumABC" + referencedDeclaration: 536 + context: ASTContext #1000 + parent: FunctionCall #947 + vReferencedDeclaration: EnumDefinition #536 + vIdentifierType: "userDefined" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: Identifier #945 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + MemberAccess #950 + id: 950 + src: "0:0:0" + typeString: "enum EnumABC" + vExpression: Identifier #949 + memberName: "A" + referencedDeclaration: 533 + context: ASTContext #1000 + parent: BinaryOperation #951 + children: Array(1) [ Identifier #949 ] + vReferencedDeclaration: EnumValue #533 + type: "MemberAccess" + firstChild: Identifier #949 + lastChild: Identifier #949 + previousSibling: MemberAccess #948 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #949 + id: 949 + src: "0:0:0" + typeString: "type(enum EnumABC)" + name: "EnumABC" + referencedDeclaration: 536 + context: ASTContext #1000 + parent: MemberAccess #950 + vReferencedDeclaration: EnumDefinition #536 + vIdentifierType: "userDefined" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ExpressionStatement #963 + id: 963 + src: "0:0:0" + documentation: undefined + vExpression: FunctionCall #962 + context: ASTContext #1000 + parent: Block #964 + children: Array(1) [ FunctionCall #962 ] + type: "ExpressionStatement" + firstChild: FunctionCall #962 + lastChild: FunctionCall #962 + previousSibling: ExpressionStatement #953 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionCall #962 + id: 962 + src: "0:0:0" + typeString: "tuple()" + kind: "functionCall" + fieldNames: undefined + vExpression: Identifier #954 + vArguments: Array(1) [ BinaryOperation #961 ] + context: ASTContext #1000 + parent: ExpressionStatement #963 + children: Array(2) [ Identifier #954, BinaryOperation #961 ] + vIdentifier: "assert" + vMemberName: undefined + vFunctionCallType: "builtin" + vReferencedDeclaration: undefined + vFunctionName: "assert" + vCallee: Identifier #954 + type: "FunctionCall" + firstChild: Identifier #954 + lastChild: BinaryOperation #961 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #954 + id: 954 + src: "0:0:0" + typeString: "function (bool) pure" + name: "assert" + referencedDeclaration: -3 + context: ASTContext #1000 + parent: FunctionCall #962 + vReferencedDeclaration: undefined + vIdentifierType: "builtin" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: BinaryOperation #961 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + BinaryOperation #961 + id: 961 + src: "0:0:0" + typeString: "bool" + operator: "==" + vLeftExpression: MemberAccess #958 + vRightExpression: MemberAccess #960 + context: ASTContext #1000 + parent: FunctionCall #962 + children: Array(2) [ MemberAccess #958, MemberAccess #960 ] + type: "BinaryOperation" + firstChild: MemberAccess #958 + lastChild: MemberAccess #960 + previousSibling: Identifier #954 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + MemberAccess #958 + id: 958 + src: "0:0:0" + typeString: "enum EnumABC" + vExpression: FunctionCall #957 + memberName: "max" + referencedDeclaration: undefined + context: ASTContext #1000 + parent: BinaryOperation #961 + children: Array(1) [ FunctionCall #957 ] + vReferencedDeclaration: undefined + type: "MemberAccess" + firstChild: FunctionCall #957 + lastChild: FunctionCall #957 + previousSibling: undefined + nextSibling: MemberAccess #960 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionCall #957 + id: 957 + src: "0:0:0" + typeString: "type(enum EnumABC)" + kind: "functionCall" + fieldNames: undefined + vExpression: Identifier #955 + vArguments: Array(1) [ Identifier #956 ] + context: ASTContext #1000 + parent: MemberAccess #958 + children: Array(2) [ Identifier #955, Identifier #956 ] + vIdentifier: "type" + vMemberName: undefined + vFunctionCallType: "builtin" + vReferencedDeclaration: undefined + vFunctionName: "type" + vCallee: Identifier #955 + type: "FunctionCall" + firstChild: Identifier #955 + lastChild: Identifier #956 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #955 + id: 955 + src: "0:0:0" + typeString: "function () pure" + name: "type" + referencedDeclaration: -27 + context: ASTContext #1000 + parent: FunctionCall #957 + vReferencedDeclaration: undefined + vIdentifierType: "builtin" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: Identifier #956 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #956 + id: 956 + src: "0:0:0" + typeString: "type(enum EnumABC)" + name: "EnumABC" + referencedDeclaration: 536 + context: ASTContext #1000 + parent: FunctionCall #957 + vReferencedDeclaration: EnumDefinition #536 + vIdentifierType: "userDefined" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: Identifier #955 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + MemberAccess #960 + id: 960 + src: "0:0:0" + typeString: "enum EnumABC" + vExpression: Identifier #959 + memberName: "C" + referencedDeclaration: 535 + context: ASTContext #1000 + parent: BinaryOperation #961 + children: Array(1) [ Identifier #959 ] + vReferencedDeclaration: EnumValue #535 + type: "MemberAccess" + firstChild: Identifier #959 + lastChild: Identifier #959 + previousSibling: MemberAccess #958 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #959 + id: 959 + src: "0:0:0" + typeString: "type(enum EnumABC)" + name: "EnumABC" + referencedDeclaration: 536 + context: ASTContext #1000 + parent: MemberAccess #960 + vReferencedDeclaration: EnumDefinition #536 + vIdentifierType: "userDefined" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ContractDefinition #997 + id: 997 + src: "0:0:0" + name: "ExternalFnSelectorAndAddress_0810" + scope: 1037 + kind: "contract" + abstract: false + fullyImplemented: true + linearizedBaseContracts: Array(1) [ 997 ] + usedErrors: Array(0) + docString: undefined + nameLocation: "5781:33:0" + context: ASTContext #1000 + parent: SourceUnit #1037 + documentation: undefined + vScope: SourceUnit #1037 + vLinearizedBaseContracts: Array(1) [ ContractDefinition #997 ] + vUsedErrors: Array(0) + vInheritanceSpecifiers: Array(0) + vStateVariables: Array(0) + vModifiers: Array(0) + vEvents: Array(0) + vErrors: Array(0) + vFunctions: Array(2) [ FunctionDefinition #970, FunctionDefinition #996 ] + vUsingForDirectives: Array(0) + vStructs: Array(0) + vEnums: Array(0) + vUserDefinedValueTypes: Array(0) + vConstructor: undefined + children: Array(2) [ FunctionDefinition #970, FunctionDefinition #996 ] + type: "ContractDefinition" + firstChild: FunctionDefinition #970 + lastChild: FunctionDefinition #996 + previousSibling: ContractDefinition #966 + nextSibling: ContractDefinition #1036 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionDefinition #970 + id: 970 + src: "0:0:0" + implemented: true + virtual: false + scope: 997 + kind: "function" + name: "testFunction" + visibility: "external" + stateMutability: "nonpayable" + isConstructor: false + documentation: undefined + nameLocation: "5830:12:0" + vParameters: ParameterList #967 + vReturnParameters: ParameterList #968 + vModifiers: Array(0) + vOverrideSpecifier: undefined + vBody: Block #969 + context: ASTContext #1000 + parent: ContractDefinition #997 + children: Array(3) [ ParameterList #967, ParameterList #968, Block #969 ] + vScope: ContractDefinition #997 + type: "FunctionDefinition" + firstChild: ParameterList #967 + lastChild: Block #969 + previousSibling: undefined + nextSibling: FunctionDefinition #996 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #967 + id: 967 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #970 + vParameters: Array(0) + children: Array(0) + type: "ParameterList" + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: ParameterList #968 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #968 + id: 968 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #970 + vParameters: Array(0) + children: Array(0) + type: "ParameterList" + firstChild: undefined + lastChild: undefined + previousSibling: ParameterList #967 + nextSibling: Block #969 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Block #969 + id: 969 + src: "0:0:0" + documentation: undefined + context: ASTContext #1000 + parent: FunctionDefinition #970 + vStatements: Array(0) + children: Array(0) + type: "Block" + firstChild: undefined + lastChild: undefined + previousSibling: ParameterList #968 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionDefinition #996 + id: 996 + src: "0:0:0" + implemented: true + virtual: false + scope: 997 + kind: "function" + name: "test" + visibility: "public" + stateMutability: "view" + isConstructor: false + documentation: undefined + nameLocation: "5871:4:0" + vParameters: ParameterList #975 + vReturnParameters: ParameterList #980 + vModifiers: Array(0) + vOverrideSpecifier: undefined + vBody: Block #995 + context: ASTContext #1000 + parent: ContractDefinition #997 + children: Array(3) [ ParameterList #975, ParameterList #980, Block #995 ] + vScope: ContractDefinition #997 + type: "FunctionDefinition" + firstChild: ParameterList #975 + lastChild: Block #995 + previousSibling: FunctionDefinition #970 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #975 + id: 975 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #996 + vParameters: Array(2) [ VariableDeclaration #972, VariableDeclaration #974 ] + children: Array(2) [ VariableDeclaration #972, VariableDeclaration #974 ] + type: "ParameterList" + firstChild: VariableDeclaration #972 + lastChild: VariableDeclaration #974 + previousSibling: undefined + nextSibling: ParameterList #980 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #972 + id: 972 + src: "0:0:0" + constant: false + indexed: false + name: "newAddress" + scope: 996 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "address" + documentation: undefined + nameLocation: "5884:10:0" + vType: ElementaryTypeName #971 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: ParameterList #975 + children: Array(1) [ ElementaryTypeName #971 ] + vScope: FunctionDefinition #996 + type: "VariableDeclaration" + firstChild: ElementaryTypeName #971 + lastChild: ElementaryTypeName #971 + previousSibling: undefined + nextSibling: VariableDeclaration #974 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #971 + id: 971 + src: "0:0:0" + typeString: "address" + name: "address" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: VariableDeclaration #972 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #974 + id: 974 + src: "0:0:0" + constant: false + indexed: false + name: "newSelector" + scope: 996 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "uint32" + documentation: undefined + nameLocation: "5903:11:0" + vType: ElementaryTypeName #973 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: ParameterList #975 + children: Array(1) [ ElementaryTypeName #973 ] + vScope: FunctionDefinition #996 + type: "VariableDeclaration" + firstChild: ElementaryTypeName #973 + lastChild: ElementaryTypeName #973 + previousSibling: VariableDeclaration #972 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #973 + id: 973 + src: "0:0:0" + typeString: "uint32" + name: "uint32" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: VariableDeclaration #974 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #980 + id: 980 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #996 + vParameters: Array(2) [ VariableDeclaration #977, VariableDeclaration #979 ] + children: Array(2) [ VariableDeclaration #977, VariableDeclaration #979 ] + type: "ParameterList" + firstChild: VariableDeclaration #977 + lastChild: VariableDeclaration #979 + previousSibling: ParameterList #975 + nextSibling: Block #995 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #977 + id: 977 + src: "0:0:0" + constant: false + indexed: false + name: "adr" + scope: 996 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "address" + documentation: undefined + nameLocation: "5945:3:0" + vType: ElementaryTypeName #976 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: ParameterList #980 + children: Array(1) [ ElementaryTypeName #976 ] + vScope: FunctionDefinition #996 + type: "VariableDeclaration" + firstChild: ElementaryTypeName #976 + lastChild: ElementaryTypeName #976 + previousSibling: undefined + nextSibling: VariableDeclaration #979 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #976 + id: 976 + src: "0:0:0" + typeString: "address" + name: "address" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: VariableDeclaration #977 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #979 + id: 979 + src: "0:0:0" + constant: false + indexed: false + name: "sel" + scope: 996 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "bytes4" + documentation: undefined + nameLocation: "5957:3:0" + vType: ElementaryTypeName #978 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: ParameterList #980 + children: Array(1) [ ElementaryTypeName #978 ] + vScope: FunctionDefinition #996 + type: "VariableDeclaration" + firstChild: ElementaryTypeName #978 + lastChild: ElementaryTypeName #978 + previousSibling: VariableDeclaration #977 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #978 + id: 978 + src: "0:0:0" + typeString: "bytes4" + name: "bytes4" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: VariableDeclaration #979 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Block #995 + id: 995 + src: "0:0:0" + documentation: undefined + context: ASTContext #1000 + parent: FunctionDefinition #996 + vStatements: Array(3) [ VariableDeclarationStatement #987, InlineAssembly #988, Return #994 ] + children: Array(3) [ VariableDeclarationStatement #987, InlineAssembly #988, Return #994 ] + type: "Block" + firstChild: VariableDeclarationStatement #987 + lastChild: Return #994 + previousSibling: ParameterList #980 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclarationStatement #987 + id: 987 + src: "0:0:0" + documentation: undefined + assignments: Array(1) [ 984 ] + vDeclarations: Array(1) [ VariableDeclaration #984 ] + vInitialValue: MemberAccess #986 + context: ASTContext #1000 + parent: Block #995 + children: Array(2) [ VariableDeclaration #984, MemberAccess #986 ] + type: "VariableDeclarationStatement" + firstChild: VariableDeclaration #984 + lastChild: MemberAccess #986 + previousSibling: undefined + nextSibling: InlineAssembly #988 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #984 + id: 984 + src: "0:0:0" + constant: false + indexed: false + name: "fp" + scope: 995 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "function () external" + documentation: undefined + nameLocation: "5992:2:0" + vType: FunctionTypeName #983 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: VariableDeclarationStatement #987 + children: Array(1) [ FunctionTypeName #983 ] + vScope: Block #995 + type: "VariableDeclaration" + firstChild: FunctionTypeName #983 + lastChild: FunctionTypeName #983 + previousSibling: undefined + nextSibling: MemberAccess #986 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionTypeName #983 + id: 983 + src: "0:0:0" + typeString: "function () external" + visibility: "external" + stateMutability: "nonpayable" + vParameterTypes: ParameterList #981 + vReturnParameterTypes: ParameterList #982 + context: ASTContext #1000 + parent: VariableDeclaration #984 + children: Array(2) [ ParameterList #981, ParameterList #982 ] + type: "FunctionTypeName" + firstChild: ParameterList #981 + lastChild: ParameterList #982 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #981 + id: 981 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionTypeName #983 + vParameters: Array(0) + children: Array(0) + type: "ParameterList" + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: ParameterList #982 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #982 + id: 982 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionTypeName #983 + vParameters: Array(0) + children: Array(0) + type: "ParameterList" + firstChild: undefined + lastChild: undefined + previousSibling: ParameterList #981 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + MemberAccess #986 + id: 986 + src: "0:0:0" + typeString: "function () external" + vExpression: Identifier #985 + memberName: "testFunction" + referencedDeclaration: 970 + context: ASTContext #1000 + parent: VariableDeclarationStatement #987 + children: Array(1) [ Identifier #985 ] + vReferencedDeclaration: FunctionDefinition #970 + type: "MemberAccess" + firstChild: Identifier #985 + lastChild: Identifier #985 + previousSibling: VariableDeclaration #984 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #985 + id: 985 + src: "0:0:0" + typeString: "contract ExternalFnSelectorAndAddress_0810" + name: "this" + referencedDeclaration: -28 + context: ASTContext #1000 + parent: MemberAccess #986 + vReferencedDeclaration: undefined + vIdentifierType: "builtin" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + InlineAssembly #988 + id: 988 + src: "0:0:0" + documentation: undefined + externalReferences: Array(6) [ Object { declaration: 460, isOffset: false, isSlot: false, src: "6057:10:0", suffix: "address", valueSize: 1 }, Object { declaration: 460, isOffset: false, isSlot: false, src: "6114:10:0", suffix: "address", valueSize: 1 }, Object { declaration: 460, isOffset: false, isSlot: false, src: "6089:11:0", suffix: "selector", valueSize: 1 }, Object { declaration: 460, isOffset: false, isSlot: false, src: "6151:11:0", suffix: "selector", valueSize: 1 }, Object { declaration: 448, isOffset: false, isSlot: false, src: "6128:10:0", valueSize: 1 }, Object { declaration: 450, isOffset: false, isSlot: false, src: "6166:11:0", valueSize: 1 } ] + operations: undefined + yul: Object { nodeType: "YulBlock", src: "6034:153:0", statements: Array(4) [ Object { nodeType: "YulVariableDeclaration", src: "6048:19:0", value: Object { name: "fp.address", nodeType: "YulIdentifier", src: "6057:10:0" }, variables: Array(1) [ Object { name: "o", nodeType: "YulTypedName", src: "6052:1:0", type: "" } ] }, Object { nodeType: "YulVariableDeclaration", src: "6080:20:0", value: Object { name: "fp.selector", nodeType: "YulIdentifier", src: "6089:11:0" }, variables: Array(1) [ Object { name: "s", nodeType: "YulTypedName", src: "6084:1:0", type: "" } ] }, Object { nodeType: "YulAssignment", src: "6114:24:0", value: Object { name: "newAddress", nodeType: "YulIdentifier", src: "6128:10:0" }, variableNames: Array(1) [ Object { name: "fp.address", nodeType: "YulIdentifier", src: "6114:10:0" } ] }, Object { nodeType: "YulAssignment", src: "6151:26:0", value: Object { name: "newSelector", nodeType: "YulIdentifier", src: "6166:11:0" }, variableNames: Array(1) [ Object { name: "fp.selector", nodeType: "YulIdentifier", src: "6151:11:0" } ] } ] } + context: ASTContext #1000 + parent: Block #995 + type: "InlineAssembly" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: VariableDeclarationStatement #987 + nextSibling: Return #994 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Return #994 + id: 994 + src: "0:0:0" + documentation: undefined + functionReturnParameters: 456 + vExpression: TupleExpression #993 + context: ASTContext #1000 + parent: Block #995 + children: Array(1) [ TupleExpression #993 ] + vFunctionReturnParameters: ParameterList #456 + type: "Return" + firstChild: TupleExpression #993 + lastChild: TupleExpression #993 + previousSibling: InlineAssembly #988 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + TupleExpression #993 + id: 993 + src: "0:0:0" + typeString: "tuple(address,bytes4)" + isInlineArray: false + vOriginalComponents: Array(2) [ MemberAccess #990, MemberAccess #992 ] + context: ASTContext #1000 + parent: Return #994 + children: Array(2) [ MemberAccess #990, MemberAccess #992 ] + components: Array(2) [ 990, 992 ] + vComponents: Array(2) [ MemberAccess #990, MemberAccess #992 ] + type: "TupleExpression" + firstChild: MemberAccess #990 + lastChild: MemberAccess #992 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + MemberAccess #990 + id: 990 + src: "0:0:0" + typeString: "address" + vExpression: Identifier #989 + memberName: "address" + referencedDeclaration: undefined + context: ASTContext #1000 + parent: TupleExpression #993 + children: Array(1) [ Identifier #989 ] + vReferencedDeclaration: undefined + type: "MemberAccess" + firstChild: Identifier #989 + lastChild: Identifier #989 + previousSibling: undefined + nextSibling: MemberAccess #992 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #989 + id: 989 + src: "0:0:0" + typeString: "function () external" + name: "fp" + referencedDeclaration: 984 + context: ASTContext #1000 + parent: MemberAccess #990 + vReferencedDeclaration: VariableDeclaration #984 + vIdentifierType: "userDefined" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + MemberAccess #992 + id: 992 + src: "0:0:0" + typeString: "bytes4" + vExpression: Identifier #991 + memberName: "selector" + referencedDeclaration: undefined + context: ASTContext #1000 + parent: TupleExpression #993 + children: Array(1) [ Identifier #991 ] + vReferencedDeclaration: undefined + type: "MemberAccess" + firstChild: Identifier #991 + lastChild: Identifier #991 + previousSibling: MemberAccess #990 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #991 + id: 991 + src: "0:0:0" + typeString: "function () external" + name: "fp" + referencedDeclaration: 984 + context: ASTContext #1000 + parent: MemberAccess #992 + vReferencedDeclaration: VariableDeclaration #984 + vIdentifierType: "userDefined" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ContractDefinition #1036 + id: 1036 + src: "0:0:0" + name: "Builtins_0811" + scope: 1037 + kind: "contract" + abstract: false + fullyImplemented: true + linearizedBaseContracts: Array(1) [ 1036 ] + usedErrors: Array(0) + docString: undefined + nameLocation: "6249:13:0" + context: ASTContext #1000 + parent: SourceUnit #1037 + documentation: undefined + vScope: SourceUnit #1037 + vLinearizedBaseContracts: Array(1) [ ContractDefinition #1036 ] + vUsedErrors: Array(0) + vInheritanceSpecifiers: Array(0) + vStateVariables: Array(0) + vModifiers: Array(0) + vEvents: Array(0) + vErrors: Array(0) + vFunctions: Array(2) [ FunctionDefinition #1018, FunctionDefinition #1035 ] + vUsingForDirectives: Array(0) + vStructs: Array(0) + vEnums: Array(0) + vUserDefinedValueTypes: Array(0) + vConstructor: undefined + children: Array(2) [ FunctionDefinition #1018, FunctionDefinition #1035 ] + type: "ContractDefinition" + firstChild: FunctionDefinition #1018 + lastChild: FunctionDefinition #1035 + previousSibling: ContractDefinition #997 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionDefinition #1018 + id: 1018 + src: "0:0:0" + implemented: true + virtual: false + scope: 1036 + kind: "function" + name: "some" + visibility: "external" + stateMutability: "pure" + isConstructor: false + documentation: undefined + nameLocation: "6278:4:0" + vParameters: ParameterList #1004 + vReturnParameters: ParameterList #1011 + vModifiers: Array(0) + vOverrideSpecifier: undefined + vBody: Block #1017 + context: ASTContext #1000 + parent: ContractDefinition #1036 + children: Array(3) [ ParameterList #1004, ParameterList #1011, Block #1017 ] + vScope: ContractDefinition #1036 + type: "FunctionDefinition" + firstChild: ParameterList #1004 + lastChild: Block #1017 + previousSibling: undefined + nextSibling: FunctionDefinition #1035 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #1004 + id: 1004 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #1018 + vParameters: Array(3) [ VariableDeclaration #999, VariableDeclaration #1001, VariableDeclaration #1003 ] + children: Array(3) [ VariableDeclaration #999, VariableDeclaration #1001, VariableDeclaration #1003 ] + type: "ParameterList" + firstChild: VariableDeclaration #999 + lastChild: VariableDeclaration #1003 + previousSibling: undefined + nextSibling: ParameterList #1011 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #999 + id: 999 + src: "0:0:0" + constant: false + indexed: false + name: "a" + scope: 1018 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "uint256" + documentation: undefined + nameLocation: "6288:1:0" + vType: ElementaryTypeName #998 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: ParameterList #1004 + children: Array(1) [ ElementaryTypeName #998 ] + vScope: FunctionDefinition #1018 + type: "VariableDeclaration" + firstChild: ElementaryTypeName #998 + lastChild: ElementaryTypeName #998 + previousSibling: undefined + nextSibling: VariableDeclaration #1001 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #998 + id: 998 + src: "0:0:0" + typeString: "uint256" + name: "uint" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: VariableDeclaration #999 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #1001 + id: 1001 + src: "0:0:0" + constant: false + indexed: false + name: "b" + scope: 1018 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "int256" + documentation: undefined + nameLocation: "6295:1:0" + vType: ElementaryTypeName #1000 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: ParameterList #1004 + children: Array(1) [ ElementaryTypeName #1000 ] + vScope: FunctionDefinition #1018 + type: "VariableDeclaration" + firstChild: ElementaryTypeName #1000 + lastChild: ElementaryTypeName #1000 + previousSibling: VariableDeclaration #999 + nextSibling: VariableDeclaration #1003 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #1000 + id: 1000 + src: "0:0:0" + typeString: "int256" + name: "int" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: VariableDeclaration #1001 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #1003 + id: 1003 + src: "0:0:0" + constant: false + indexed: false + name: "c" + scope: 1018 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "bytes2" + documentation: undefined + nameLocation: "6305:1:0" + vType: ElementaryTypeName #1002 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: ParameterList #1004 + children: Array(1) [ ElementaryTypeName #1002 ] + vScope: FunctionDefinition #1018 + type: "VariableDeclaration" + firstChild: ElementaryTypeName #1002 + lastChild: ElementaryTypeName #1002 + previousSibling: VariableDeclaration #1001 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #1002 + id: 1002 + src: "0:0:0" + typeString: "bytes2" + name: "bytes2" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: VariableDeclaration #1003 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #1011 + id: 1011 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #1018 + vParameters: Array(3) [ VariableDeclaration #1006, VariableDeclaration #1008, VariableDeclaration #1010 ] + children: Array(3) [ VariableDeclaration #1006, VariableDeclaration #1008, VariableDeclaration #1010 ] + type: "ParameterList" + firstChild: VariableDeclaration #1006 + lastChild: VariableDeclaration #1010 + previousSibling: ParameterList #1004 + nextSibling: Block #1017 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #1006 + id: 1006 + src: "0:0:0" + constant: false + indexed: false + name: "x" + scope: 1018 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "bytes2" + documentation: undefined + nameLocation: "6337:1:0" + vType: ElementaryTypeName #1005 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: ParameterList #1011 + children: Array(1) [ ElementaryTypeName #1005 ] + vScope: FunctionDefinition #1018 + type: "VariableDeclaration" + firstChild: ElementaryTypeName #1005 + lastChild: ElementaryTypeName #1005 + previousSibling: undefined + nextSibling: VariableDeclaration #1008 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #1005 + id: 1005 + src: "0:0:0" + typeString: "bytes2" + name: "bytes2" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: VariableDeclaration #1006 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #1008 + id: 1008 + src: "0:0:0" + constant: false + indexed: false + name: "y" + scope: 1018 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "int256" + documentation: undefined + nameLocation: "6344:1:0" + vType: ElementaryTypeName #1007 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: ParameterList #1011 + children: Array(1) [ ElementaryTypeName #1007 ] + vScope: FunctionDefinition #1018 + type: "VariableDeclaration" + firstChild: ElementaryTypeName #1007 + lastChild: ElementaryTypeName #1007 + previousSibling: VariableDeclaration #1006 + nextSibling: VariableDeclaration #1010 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #1007 + id: 1007 + src: "0:0:0" + typeString: "int256" + name: "int" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: VariableDeclaration #1008 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #1010 + id: 1010 + src: "0:0:0" + constant: false + indexed: false + name: "z" + scope: 1018 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "uint256" + documentation: undefined + nameLocation: "6352:1:0" + vType: ElementaryTypeName #1009 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: ParameterList #1011 + children: Array(1) [ ElementaryTypeName #1009 ] + vScope: FunctionDefinition #1018 + type: "VariableDeclaration" + firstChild: ElementaryTypeName #1009 + lastChild: ElementaryTypeName #1009 + previousSibling: VariableDeclaration #1008 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #1009 + id: 1009 + src: "0:0:0" + typeString: "uint256" + name: "uint" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: VariableDeclaration #1010 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Block #1017 + id: 1017 + src: "0:0:0" + documentation: undefined + context: ASTContext #1000 + parent: FunctionDefinition #1018 + vStatements: Array(1) [ Return #1016 ] + children: Array(1) [ Return #1016 ] + type: "Block" + firstChild: Return #1016 + lastChild: Return #1016 + previousSibling: ParameterList #1011 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Return #1016 + id: 1016 + src: "0:0:0" + documentation: undefined + functionReturnParameters: 487 + vExpression: TupleExpression #1015 + context: ASTContext #1000 + parent: Block #1017 + children: Array(1) [ TupleExpression #1015 ] + vFunctionReturnParameters: ParameterList #487 + type: "Return" + firstChild: TupleExpression #1015 + lastChild: TupleExpression #1015 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + TupleExpression #1015 + id: 1015 + src: "0:0:0" + typeString: "tuple(bytes2,int256,uint256)" + isInlineArray: false + vOriginalComponents: Array(3) [ Identifier #1012, Identifier #1013, Identifier #1014 ] + context: ASTContext #1000 + parent: Return #1016 + children: Array(3) [ Identifier #1012, Identifier #1013, Identifier #1014 ] + components: Array(3) [ 1012, 1013, 1014 ] + vComponents: Array(3) [ Identifier #1012, Identifier #1013, Identifier #1014 ] + type: "TupleExpression" + firstChild: Identifier #1012 + lastChild: Identifier #1014 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #1012 + id: 1012 + src: "0:0:0" + typeString: "bytes2" + name: "c" + referencedDeclaration: 1003 + context: ASTContext #1000 + parent: TupleExpression #1015 + vReferencedDeclaration: VariableDeclaration #1003 + vIdentifierType: "userDefined" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: Identifier #1013 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #1013 + id: 1013 + src: "0:0:0" + typeString: "int256" + name: "b" + referencedDeclaration: 1001 + context: ASTContext #1000 + parent: TupleExpression #1015 + vReferencedDeclaration: VariableDeclaration #1001 + vIdentifierType: "userDefined" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: Identifier #1012 + nextSibling: Identifier #1014 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #1014 + id: 1014 + src: "0:0:0" + typeString: "uint256" + name: "a" + referencedDeclaration: 999 + context: ASTContext #1000 + parent: TupleExpression #1015 + vReferencedDeclaration: VariableDeclaration #999 + vIdentifierType: "userDefined" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: Identifier #1013 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionDefinition #1035 + id: 1035 + src: "0:0:0" + implemented: true + virtual: false + scope: 1036 + kind: "function" + name: "test" + visibility: "public" + stateMutability: "view" + isConstructor: false + documentation: undefined + nameLocation: "6403:4:0" + vParameters: ParameterList #1019 + vReturnParameters: ParameterList #1020 + vModifiers: Array(0) + vOverrideSpecifier: undefined + vBody: Block #1034 + context: ASTContext #1000 + parent: ContractDefinition #1036 + children: Array(3) [ ParameterList #1019, ParameterList #1020, Block #1034 ] + vScope: ContractDefinition #1036 + type: "FunctionDefinition" + firstChild: ParameterList #1019 + lastChild: Block #1034 + previousSibling: FunctionDefinition #1018 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #1019 + id: 1019 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #1035 + vParameters: Array(0) + children: Array(0) + type: "ParameterList" + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: ParameterList #1020 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #1020 + id: 1020 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #1035 + vParameters: Array(0) + children: Array(0) + type: "ParameterList" + firstChild: undefined + lastChild: undefined + previousSibling: ParameterList #1019 + nextSibling: Block #1034 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Block #1034 + id: 1034 + src: "0:0:0" + documentation: undefined + context: ASTContext #1000 + parent: FunctionDefinition #1035 + vStatements: Array(1) [ VariableDeclarationStatement #1033 ] + children: Array(1) [ VariableDeclarationStatement #1033 ] + type: "Block" + firstChild: VariableDeclarationStatement #1033 + lastChild: VariableDeclarationStatement #1033 + previousSibling: ParameterList #1020 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclarationStatement #1033 + id: 1033 + src: "0:0:0" + documentation: undefined + assignments: Array(1) [ 1022 ] + vDeclarations: Array(1) [ VariableDeclaration #1022 ] + vInitialValue: FunctionCall #1032 + context: ASTContext #1000 + parent: Block #1034 + children: Array(2) [ VariableDeclaration #1022, FunctionCall #1032 ] + type: "VariableDeclarationStatement" + firstChild: VariableDeclaration #1022 + lastChild: FunctionCall #1032 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #1022 + id: 1022 + src: "0:0:0" + constant: false + indexed: false + name: "payload" + scope: 1034 + stateVariable: false + storageLocation: "memory" + visibility: "internal" + mutability: "mutable" + typeString: "bytes" + documentation: undefined + nameLocation: "6445:7:0" + vType: ElementaryTypeName #1021 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: VariableDeclarationStatement #1033 + children: Array(1) [ ElementaryTypeName #1021 ] + vScope: Block #1034 + type: "VariableDeclaration" + firstChild: ElementaryTypeName #1021 + lastChild: ElementaryTypeName #1021 + previousSibling: undefined + nextSibling: FunctionCall #1032 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #1021 + id: 1021 + src: "0:0:0" + typeString: "bytes" + name: "bytes" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: VariableDeclaration #1022 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionCall #1032 + id: 1032 + src: "0:0:0" + typeString: "bytes memory" + kind: "functionCall" + fieldNames: undefined + vExpression: MemberAccess #1024 + vArguments: Array(2) [ MemberAccess #1026, TupleExpression #1031 ] + context: ASTContext #1000 + parent: VariableDeclarationStatement #1033 + children: Array(3) [ MemberAccess #1024, MemberAccess #1026, TupleExpression #1031 ] + vIdentifier: "abi" + vMemberName: "encodeCall" + vFunctionCallType: "builtin" + vReferencedDeclaration: undefined + vFunctionName: "encodeCall" + vCallee: MemberAccess #1024 + type: "FunctionCall" + firstChild: MemberAccess #1024 + lastChild: TupleExpression #1031 + previousSibling: VariableDeclaration #1022 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + MemberAccess #1024 + id: 1024 + src: "0:0:0" + typeString: "function () pure returns (bytes memory)" + vExpression: Identifier #1023 + memberName: "encodeCall" + referencedDeclaration: undefined + context: ASTContext #1000 + parent: FunctionCall #1032 + children: Array(1) [ Identifier #1023 ] + vReferencedDeclaration: undefined + type: "MemberAccess" + firstChild: Identifier #1023 + lastChild: Identifier #1023 + previousSibling: undefined + nextSibling: MemberAccess #1026 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #1023 + id: 1023 + src: "0:0:0" + typeString: "abi" + name: "abi" + referencedDeclaration: -1 + context: ASTContext #1000 + parent: MemberAccess #1024 + vReferencedDeclaration: undefined + vIdentifierType: "builtin" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + MemberAccess #1026 + id: 1026 + src: "0:0:0" + typeString: "function (uint256,int256,bytes2) pure external returns (bytes2,int256,uint256)" + vExpression: Identifier #1025 + memberName: "some" + referencedDeclaration: 1018 + context: ASTContext #1000 + parent: FunctionCall #1032 + children: Array(1) [ Identifier #1025 ] + vReferencedDeclaration: FunctionDefinition #1018 + type: "MemberAccess" + firstChild: Identifier #1025 + lastChild: Identifier #1025 + previousSibling: MemberAccess #1024 + nextSibling: TupleExpression #1031 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Identifier #1025 + id: 1025 + src: "0:0:0" + typeString: "contract Builtins_0811" + name: "this" + referencedDeclaration: -28 + context: ASTContext #1000 + parent: MemberAccess #1026 + vReferencedDeclaration: undefined + vIdentifierType: "builtin" + type: "Identifier" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + TupleExpression #1031 + id: 1031 + src: "0:0:0" + typeString: "tuple(int_const 1,int_const -1,int_const 65535)" + isInlineArray: false + vOriginalComponents: Array(3) [ Literal #1027, UnaryOperation #1029, Literal #1030 ] + context: ASTContext #1000 + parent: FunctionCall #1032 + children: Array(3) [ Literal #1027, UnaryOperation #1029, Literal #1030 ] + components: Array(3) [ 1027, 1029, 1030 ] + vComponents: Array(3) [ Literal #1027, UnaryOperation #1029, Literal #1030 ] + type: "TupleExpression" + firstChild: Literal #1027 + lastChild: Literal #1030 + previousSibling: MemberAccess #1026 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Literal #1027 + id: 1027 + src: "0:0:0" + typeString: "int_const 1" + kind: "number" + hexValue: "31" + value: "1" + subdenomination: undefined + context: ASTContext #1000 + parent: TupleExpression #1031 + type: "Literal" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: UnaryOperation #1029 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + UnaryOperation #1029 + id: 1029 + src: "0:0:0" + typeString: "int_const -1" + prefix: true + operator: "-" + vSubExpression: Literal #1028 + context: ASTContext #1000 + parent: TupleExpression #1031 + children: Array(1) [ Literal #1028 ] + type: "UnaryOperation" + firstChild: Literal #1028 + lastChild: Literal #1028 + previousSibling: Literal #1027 + nextSibling: Literal #1030 + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Literal #1028 + id: 1028 + src: "0:0:0" + typeString: "int_const 1" + kind: "number" + hexValue: "31" + value: "1" + subdenomination: undefined + context: ASTContext #1000 + parent: UnaryOperation #1029 + type: "Literal" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Literal #1030 + id: 1030 + src: "0:0:0" + typeString: "int_const 65535" + kind: "number" + hexValue: "307846464646" + value: "0xFFFF" + subdenomination: undefined + context: ASTContext #1000 + parent: TupleExpression #1031 + type: "Literal" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: UnaryOperation #1029 + nextSibling: undefined + root: SourceUnit #1037 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + +SourceUnit #1053 + id: 1053 + src: "0:0:0" + sourceEntryKey: "./test/samples/solidity/latest_imports_08.sol" + sourceListIndex: 1 + absolutePath: "./test/samples/solidity/latest_imports_08.sol" + exportedSymbols: Map(2) { "SomeContract" -> 1051, "SomeLib" -> 1052 } + context: ASTContext #1000 + vPragmaDirectives: Array(2) [ PragmaDirective #1038, PragmaDirective #1039 ] + vImportDirectives: Array(0) + vContracts: Array(2) [ ContractDefinition #1051, ContractDefinition #1052 ] + vEnums: Array(0) + vErrors: Array(0) + vStructs: Array(0) + vFunctions: Array(0) + vVariables: Array(0) + vUserDefinedValueTypes: Array(0) + vExportedSymbols: Map(2) { "SomeContract" -> ContractDefinition #1051, "SomeLib" -> ContractDefinition #1052 } + children: Array(4) [ PragmaDirective #1038, PragmaDirective #1039, ContractDefinition #1051, ContractDefinition #1052 ] + type: "SourceUnit" + firstChild: PragmaDirective #1038 + lastChild: ContractDefinition #1052 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1053 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + PragmaDirective #1038 + id: 1038 + src: "0:0:0" + literals: Array(4) [ "solidity", "^", "0.8", ".0" ] + context: ASTContext #1000 + parent: SourceUnit #1053 + vIdentifier: "solidity" + vValue: "^0.8.0" + type: "PragmaDirective" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: PragmaDirective #1039 + root: SourceUnit #1053 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + PragmaDirective #1039 + id: 1039 + src: "0:0:0" + literals: Array(2) [ "abicoder", "v2" ] + context: ASTContext #1000 + parent: SourceUnit #1053 + vIdentifier: "abicoder" + vValue: "v2" + type: "PragmaDirective" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: PragmaDirective #1038 + nextSibling: ContractDefinition #1051 + root: SourceUnit #1053 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ContractDefinition #1051 + id: 1051 + src: "0:0:0" + name: "SomeContract" + scope: 1053 + kind: "contract" + abstract: false + fullyImplemented: true + linearizedBaseContracts: Array(1) [ 1051 ] + usedErrors: Array(0) + docString: undefined + nameLocation: "54:12:1" + context: ASTContext #1000 + parent: SourceUnit #1053 + documentation: undefined + vScope: SourceUnit #1053 + vLinearizedBaseContracts: Array(1) [ ContractDefinition #1051 ] + vUsedErrors: Array(0) + vInheritanceSpecifiers: Array(0) + vStateVariables: Array(0) + vModifiers: Array(0) + vEvents: Array(0) + vErrors: Array(0) + vFunctions: Array(1) [ FunctionDefinition #1050 ] + vUsingForDirectives: Array(0) + vStructs: Array(1) [ StructDefinition #1042 ] + vEnums: Array(0) + vUserDefinedValueTypes: Array(0) + vConstructor: undefined + children: Array(2) [ StructDefinition #1042, FunctionDefinition #1050 ] + type: "ContractDefinition" + firstChild: StructDefinition #1042 + lastChild: FunctionDefinition #1050 + previousSibling: PragmaDirective #1039 + nextSibling: ContractDefinition #1052 + root: SourceUnit #1053 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + StructDefinition #1042 + id: 1042 + src: "0:0:0" + name: "SomeStruct" + scope: 1051 + visibility: "public" + nameLocation: "80:10:1" + context: ASTContext #1000 + parent: ContractDefinition #1051 + canonicalName: "SomeContract.SomeStruct" + vMembers: Array(1) [ VariableDeclaration #1041 ] + vScope: ContractDefinition #1051 + children: Array(1) [ VariableDeclaration #1041 ] + type: "StructDefinition" + firstChild: VariableDeclaration #1041 + lastChild: VariableDeclaration #1041 + previousSibling: undefined + nextSibling: FunctionDefinition #1050 + root: SourceUnit #1053 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #1041 + id: 1041 + src: "0:0:0" + constant: false + indexed: false + name: "n" + scope: 1042 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "uint256" + documentation: undefined + nameLocation: "106:1:1" + vType: ElementaryTypeName #1040 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: StructDefinition #1042 + children: Array(1) [ ElementaryTypeName #1040 ] + vScope: StructDefinition #1042 + type: "VariableDeclaration" + firstChild: ElementaryTypeName #1040 + lastChild: ElementaryTypeName #1040 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1053 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #1040 + id: 1040 + src: "0:0:0" + typeString: "uint256" + name: "uint" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: VariableDeclaration #1041 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1053 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + FunctionDefinition #1050 + id: 1050 + src: "0:0:0" + implemented: true + virtual: true + scope: 1051 + kind: "function" + name: "some" + visibility: "public" + stateMutability: "nonpayable" + isConstructor: false + documentation: undefined + nameLocation: "129:4:1" + vParameters: ParameterList #1043 + vReturnParameters: ParameterList #1046 + vModifiers: Array(0) + vOverrideSpecifier: undefined + vBody: Block #1049 + context: ASTContext #1000 + parent: ContractDefinition #1051 + children: Array(3) [ ParameterList #1043, ParameterList #1046, Block #1049 ] + vScope: ContractDefinition #1051 + type: "FunctionDefinition" + firstChild: ParameterList #1043 + lastChild: Block #1049 + previousSibling: StructDefinition #1042 + nextSibling: undefined + root: SourceUnit #1053 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #1043 + id: 1043 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #1050 + vParameters: Array(0) + children: Array(0) + type: "ParameterList" + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: ParameterList #1046 + root: SourceUnit #1053 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ParameterList #1046 + id: 1046 + src: "0:0:0" + context: ASTContext #1000 + parent: FunctionDefinition #1050 + vParameters: Array(1) [ VariableDeclaration #1045 ] + children: Array(1) [ VariableDeclaration #1045 ] + type: "ParameterList" + firstChild: VariableDeclaration #1045 + lastChild: VariableDeclaration #1045 + previousSibling: ParameterList #1043 + nextSibling: Block #1049 + root: SourceUnit #1053 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + VariableDeclaration #1045 + id: 1045 + src: "0:0:0" + constant: false + indexed: false + name: "" + scope: 1050 + stateVariable: false + storageLocation: "default" + visibility: "internal" + mutability: "mutable" + typeString: "uint256" + documentation: undefined + nameLocation: "-1:-1:-1" + vType: ElementaryTypeName #1044 + vOverrideSpecifier: undefined + vValue: undefined + context: ASTContext #1000 + parent: ParameterList #1046 + children: Array(1) [ ElementaryTypeName #1044 ] + vScope: FunctionDefinition #1050 + type: "VariableDeclaration" + firstChild: ElementaryTypeName #1044 + lastChild: ElementaryTypeName #1044 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1053 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ElementaryTypeName #1044 + id: 1044 + src: "0:0:0" + typeString: "uint256" + name: "uint" + stateMutability: "nonpayable" + context: ASTContext #1000 + parent: VariableDeclaration #1045 + type: "ElementaryTypeName" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1053 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Block #1049 + id: 1049 + src: "0:0:0" + documentation: undefined + context: ASTContext #1000 + parent: FunctionDefinition #1050 + vStatements: Array(1) [ Return #1048 ] + children: Array(1) [ Return #1048 ] + type: "Block" + firstChild: Return #1048 + lastChild: Return #1048 + previousSibling: ParameterList #1046 + nextSibling: undefined + root: SourceUnit #1053 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Return #1048 + id: 1048 + src: "0:0:0" + documentation: undefined + functionReturnParameters: 522 + vExpression: Literal #1047 + context: ASTContext #1000 + parent: Block #1049 + children: Array(1) [ Literal #1047 ] + vFunctionReturnParameters: ParameterList #522 + type: "Return" + firstChild: Literal #1047 + lastChild: Literal #1047 + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1053 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + Literal #1047 + id: 1047 + src: "0:0:0" + typeString: "int_const 1" + kind: "number" + hexValue: "31" + value: "1" + subdenomination: undefined + context: ASTContext #1000 + parent: Return #1048 + type: "Literal" + children: Array(0) + firstChild: undefined + lastChild: undefined + previousSibling: undefined + nextSibling: undefined + root: SourceUnit #1053 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } + + ContractDefinition #1052 + id: 1052 + src: "0:0:0" + name: "SomeLib" + scope: 1053 + kind: "library" + abstract: false + fullyImplemented: true + linearizedBaseContracts: Array(1) [ 1052 ] + usedErrors: Array(0) + docString: undefined + nameLocation: "202:7:1" + context: ASTContext #1000 + parent: SourceUnit #1053 + documentation: undefined + vScope: SourceUnit #1053 + vLinearizedBaseContracts: Array(1) [ ContractDefinition #1052 ] + vUsedErrors: Array(0) + vInheritanceSpecifiers: Array(0) + vStateVariables: Array(0) + vModifiers: Array(0) + vEvents: Array(0) + vErrors: Array(0) + vFunctions: Array(0) + vUsingForDirectives: Array(0) + vStructs: Array(0) + vEnums: Array(0) + vUserDefinedValueTypes: Array(0) + vConstructor: undefined + children: Array(0) + type: "ContractDefinition" + firstChild: undefined + lastChild: undefined + previousSibling: ContractDefinition #1051 + nextSibling: undefined + root: SourceUnit #1053 + sourceInfo: Object { offset: 0, length: 0, sourceIndex: 0 } diff --git a/test/samples/solidity/latest_08.nodes.txt b/test/samples/solidity/latest_08.nodes.wasm.txt similarity index 100% rename from test/samples/solidity/latest_08.nodes.txt rename to test/samples/solidity/latest_08.nodes.wasm.txt diff --git a/test/samples/solidity/path_remapping/entry.sol b/test/samples/solidity/path_remapping/entry.sol new file mode 100644 index 00000000..35c3d6d3 --- /dev/null +++ b/test/samples/solidity/path_remapping/entry.sol @@ -0,0 +1,4 @@ +import "@package/contracts/package_contract.sol"; +import "@missing/remapped_contract.sol"; + +contract Target is PackageContract, RemappedContract {} diff --git a/test/samples/solidity/path_remapping/local/remapped_contract.sol b/test/samples/solidity/path_remapping/local/remapped_contract.sol new file mode 100644 index 00000000..3116f0da --- /dev/null +++ b/test/samples/solidity/path_remapping/local/remapped_contract.sol @@ -0,0 +1 @@ +contract RemappedContract {} diff --git a/test/samples/solidity/path_remapping/node_modules/@package/contracts/package_contract.sol b/test/samples/solidity/path_remapping/node_modules/@package/contracts/package_contract.sol new file mode 100644 index 00000000..b4057dea --- /dev/null +++ b/test/samples/solidity/path_remapping/node_modules/@package/contracts/package_contract.sol @@ -0,0 +1 @@ +contract PackageContract {} diff --git a/test/unit/ast/ast_node.spec.ts b/test/unit/ast/ast_node.spec.ts index e03fd809..e809bf6d 100644 --- a/test/unit/ast/ast_node.spec.ts +++ b/test/unit/ast/ast_node.spec.ts @@ -22,9 +22,9 @@ describe("ASTNode", () => { let mainUnit: SourceUnit; let nodes: ASTNode[]; - before(() => { + before(async () => { const reader = new ASTReader(); - const { data } = compileJson(sample, version, []); + const { data } = await compileJson(sample, version); [mainUnit] = reader.read(data); diff --git a/test/unit/ast/ast_node_factory/make.spec.ts b/test/unit/ast/ast_node_factory/make.spec.ts index e12c5632..fcf7c515 100644 --- a/test/unit/ast/ast_node_factory/make.spec.ts +++ b/test/unit/ast/ast_node_factory/make.spec.ts @@ -1,25 +1,37 @@ import { ASTNode, ASTNodeFactory, + Break, + Conditional, + Continue, ContractDefinition, ContractKind, DataLocation, ElementaryTypeNameExpression, EnumDefinition, EnumValue, + ErrorDefinition, EventDefinition, Expression, + ExpressionStatement, + ExternalReferenceType, FunctionDefinition, FunctionKind, FunctionStateMutability, FunctionVisibility, + Identifier, LiteralKind, ModifierDefinition, Mutability, + PlaceholderStatement, PragmaDirective, + Return, SourceUnit, StateVariableVisibility, StructDefinition, + Throw, + TupleExpression, + UserDefinedValueTypeDefinition, VariableDeclaration } from "../../../../src"; import { verify } from "../common"; @@ -141,6 +153,24 @@ describe("ASTNodeFactory.make*()", () => { }); }); + it("makeErrorDefinition()", () => { + const factory = new ASTNodeFactory(); + const parameters = factory.makeParameterList([]); + const node = factory.makeErrorDefinition("MyError", parameters, "doc string"); + + verify(node, ErrorDefinition, { + id: 2, + type: "ErrorDefinition", + src: "0:0:0", + children: [parameters], + raw: undefined, + + name: "MyError", + vParameters: parameters, + documentation: "doc string" + }); + }); + it("makeEventDefinition()", () => { const factory = new ASTNodeFactory(); const parameters = factory.makeParameterList([]); @@ -333,7 +363,7 @@ describe("ASTNodeFactory.make*()", () => { }); }); - it("makeExpression", () => { + it("makeExpression()", () => { const factory = new ASTNodeFactory(); const node = factory.makeExpression("uint256"); @@ -348,7 +378,7 @@ describe("ASTNodeFactory.make*()", () => { }); }); - it("makeElementaryTypeNameExpression", () => { + it("makeElementaryTypeNameExpression()", () => { const factory = new ASTNodeFactory(); const type = factory.makeElementaryTypeName("uint32", "uint32"); const node = factory.makeElementaryTypeNameExpression("uint32", type); @@ -364,4 +394,201 @@ describe("ASTNodeFactory.make*()", () => { typeName: type }); }); + + it("makeReturn()", () => { + const factory = new ASTNodeFactory(); + + const type = factory.makeElementaryTypeName("uint32", "uint32"); + const variable = factory.makeVariableDeclaration( + false, + false, + "v", + 0, + false, + DataLocation.Default, + StateVariableVisibility.Default, + Mutability.Mutable, + type.typeString, + undefined, + type, + undefined, + undefined + ); + + const parameters = factory.makeParameterList([variable]); + const expression = factory.makeLiteral(type.typeString, LiteralKind.Number, "ff", "255"); + const node = factory.makeReturn(parameters.id, expression); + + verify(node, Return, { + id: 5, + type: "Return", + src: "0:0:0", + children: [expression], + raw: undefined, + + vExpression: expression, + vFunctionReturnParameters: parameters + }); + }); + + it("makePlaceholderStatement()", () => { + const factory = new ASTNodeFactory(); + + const node = factory.makePlaceholderStatement(); + + verify(node, PlaceholderStatement, { + id: 1, + type: "PlaceholderStatement", + src: "0:0:0" + }); + }); + + it("makeThrow()", () => { + const factory = new ASTNodeFactory(); + + const node = factory.makeThrow(); + + verify(node, Throw, { + id: 1, + type: "Throw", + src: "0:0:0" + }); + }); + + it("makeContinue()", () => { + const factory = new ASTNodeFactory(); + + const node = factory.makeContinue(); + + verify(node, Continue, { + id: 1, + type: "Continue", + src: "0:0:0" + }); + }); + + it("makeBreak()", () => { + const factory = new ASTNodeFactory(); + + const node = factory.makeBreak(); + + verify(node, Break, { + id: 1, + type: "Break", + src: "0:0:0" + }); + }); + + it("makeIdentifier()", () => { + const factory = new ASTNodeFactory(); + + const type = factory.makeElementaryTypeName("uint32", "uint32"); + const variable = factory.makeVariableDeclaration( + false, + false, + "v", + 0, + false, + DataLocation.Default, + StateVariableVisibility.Default, + Mutability.Mutable, + type.typeString, + undefined, + type, + undefined, + undefined + ); + + const node = factory.makeIdentifier(variable.typeString, variable.name, variable.id); + + verify(node, Identifier, { + id: 3, + type: "Identifier", + src: "0:0:0", + + name: variable.name, + referencedDeclaration: variable.id, + typeString: variable.typeString, + + vReferencedDeclaration: variable, + vIdentifierType: ExternalReferenceType.UserDefined + }); + }); + + it("makeTupleExpression()", () => { + const factory = new ASTNodeFactory(); + + const expr1 = factory.makeLiteral("uint256", LiteralKind.Number, "01", "1"); + const expr2 = factory.makeLiteral("bool", LiteralKind.Bool, "00", "false"); + + const components = [expr1, null, expr2]; + const typeString = `tuple(${expr1.typeString},,${expr2.typeString})`; + + const node = factory.makeTupleExpression(typeString, false, components); + + verify(node, TupleExpression, { + id: 3, + type: "TupleExpression", + src: "0:0:0", + children: [expr1, expr2], + + typeString: typeString, + isInlineArray: false, + components: [1, null, 2], + vOriginalComponents: components, + vComponents: [expr1, expr2] + }); + }); + + it("makeUserDefinedValueTypeDefinition()", () => { + const factory = new ASTNodeFactory(); + + const type = factory.makeElementaryTypeName("uint256", "uint256"); + const node = factory.makeUserDefinedValueTypeDefinition("MyCustomValeType", type); + + verify(node, UserDefinedValueTypeDefinition, { + id: 2, + type: "UserDefinedValueTypeDefinition", + src: "0:0:0", + children: [type] + }); + }); + + it("makeConditional()", () => { + const factory = new ASTNodeFactory(); + + const c = factory.makeLiteral("bool", LiteralKind.Bool, "00", "false"); + const t = factory.makeLiteral("uint256", LiteralKind.Number, "01", "1"); + const f = factory.makeLiteral("uint256", LiteralKind.Number, "02", "2"); + + const node = factory.makeConditional("uint256", c, t, f); + + verify(node, Conditional, { + id: 4, + type: "Conditional", + src: "0:0:0", + children: [c, t, f], + + typeString: "uint256", + vCondition: c, + vTrueExpression: t, + vFalseExpression: f + }); + }); + + it("makeExpressionStatement()", () => { + const factory = new ASTNodeFactory(); + + const expr = factory.makeLiteral("bool", LiteralKind.Bool, "01", "true"); + const node = factory.makeExpressionStatement(expr, "doc string"); + + verify(node, ExpressionStatement, { + id: 2, + type: "ExpressionStatement", + src: "0:0:0", + children: [expr], + + documentation: "doc string" + }); + }); }); diff --git a/test/unit/ast/ast_node_formatter.spec.ts b/test/unit/ast/ast_node_formatter.spec.ts index 8f5608f6..581482bb 100644 --- a/test/unit/ast/ast_node_formatter.spec.ts +++ b/test/unit/ast/ast_node_formatter.spec.ts @@ -5,6 +5,9 @@ describe("ASTNodeFormatter", () => { const formatter = new ASTNodeFormatter(); const context = new ASTContext(); + + context.id = 555; + const node = new ASTNode(1, "1:2:3", undefined); context.register(node); @@ -40,7 +43,7 @@ describe("ASTNodeFormatter", () => { "ASTNode #1", " id: 1", ' src: "1:2:3"', - " context: ASTContext #1", + " context: ASTContext #555", ' type: "ASTNode"', " children: Array(0)", " firstChild: undefined", diff --git a/test/unit/ast/dispatch.spec.ts b/test/unit/ast/dispatch.spec.ts index a768d119..e9627a52 100644 --- a/test/unit/ast/dispatch.spec.ts +++ b/test/unit/ast/dispatch.spec.ts @@ -17,9 +17,9 @@ import { type Resolvable = EventDefinition | FunctionDefinition | ModifierDefinition | VariableDeclaration; -describe("Dynamic dispatch AST utils", () => { +describe("Dynamic dispatch AST utils", async () => { const reader = new ASTReader(); - const { data } = compileJson("test/samples/solidity/dispatch_05.json", "auto", []); + const { data } = await compileJson("test/samples/solidity/dispatch_05.json", "auto"); const [mainUnit] = reader.read(data); const [a, b, c, d, i] = mainUnit.vContracts; diff --git a/test/unit/ast/reading/declaration/contract_0413.spec.ts b/test/unit/ast/reading/declaration/contract_0413.spec.ts index 416049fa..6f2cf3b7 100644 --- a/test/unit/ast/reading/declaration/contract_0413.spec.ts +++ b/test/unit/ast/reading/declaration/contract_0413.spec.ts @@ -8,9 +8,9 @@ describe("ContractDefinition (Solc 0.4.13)", () => { let mainUnit: SourceUnit; let contracts: readonly ContractDefinition[]; - before(() => { + before(async () => { const reader = new ASTReader(); - const { data } = compileJson(sample, "0.4.13", []); + const { data } = await compileJson(sample, "0.4.13"); [mainUnit] = reader.read(data); diff --git a/test/unit/ast/reading/declaration/contract_050.spec.ts b/test/unit/ast/reading/declaration/contract_050.spec.ts index 76afafd4..b8e0cc8c 100644 --- a/test/unit/ast/reading/declaration/contract_050.spec.ts +++ b/test/unit/ast/reading/declaration/contract_050.spec.ts @@ -8,9 +8,9 @@ describe("ContractDefinition (Solc 0.5.0)", () => { let mainUnit: SourceUnit; let contracts: readonly ContractDefinition[]; - before(() => { + before(async () => { const reader = new ASTReader(); - const { data } = compileJson(sample, "0.5.0", []); + const { data } = await compileJson(sample, "0.5.0"); [mainUnit] = reader.read(data); diff --git a/test/unit/ast/reading/expression/assignment.spec.ts b/test/unit/ast/reading/expression/assignment.spec.ts index 427d8c3a..0efd003a 100644 --- a/test/unit/ast/reading/expression/assignment.spec.ts +++ b/test/unit/ast/reading/expression/assignment.spec.ts @@ -23,9 +23,9 @@ describe("Assignment", () => { ["^=", 44, "1", 43] ]; - before(() => { + before(async () => { const reader = new ASTReader(); - const { data } = compileJson(sample, version, []); + const { data } = await compileJson(sample, version); const [mainUnit] = reader.read(data); nodes = mainUnit.getChildrenByType(Assignment); diff --git a/test/unit/ast/reading/expression/binary_operation.spec.ts b/test/unit/ast/reading/expression/binary_operation.spec.ts index 0b61bba6..527b4e75 100644 --- a/test/unit/ast/reading/expression/binary_operation.spec.ts +++ b/test/unit/ast/reading/expression/binary_operation.spec.ts @@ -29,9 +29,9 @@ describe("BinaryOperation", () => { cases.pop(); } - before(() => { + before(async () => { const reader = new ASTReader(); - const { data } = compileJson(sample, version, []); + const { data } = await compileJson(sample, version); const [mainUnit] = reader.read(data); nodes = mainUnit.getChildrenByType(BinaryOperation); diff --git a/test/unit/ast/reading/expression/conditional_0413.spec.ts b/test/unit/ast/reading/expression/conditional_0413.spec.ts index 80893ca4..36cc65de 100644 --- a/test/unit/ast/reading/expression/conditional_0413.spec.ts +++ b/test/unit/ast/reading/expression/conditional_0413.spec.ts @@ -17,9 +17,9 @@ describe("Conditional (Solc 0.4.13)", () => { let mainUnit: SourceUnit; let funcs: FunctionDefinition[]; - before(() => { + before(async () => { const reader = new ASTReader(); - const { data } = compileJson(sample, "0.4.13", []); + const { data } = await compileJson(sample, "0.4.13"); const units = reader.read(data); mainUnit = units[0]; diff --git a/test/unit/ast/reading/expression/conditional_050.spec.ts b/test/unit/ast/reading/expression/conditional_050.spec.ts index dec6153b..7dc6d65e 100644 --- a/test/unit/ast/reading/expression/conditional_050.spec.ts +++ b/test/unit/ast/reading/expression/conditional_050.spec.ts @@ -17,9 +17,9 @@ describe("Conditional (Solc 0.5.0)", () => { let mainUnit: SourceUnit; let funcs: FunctionDefinition[]; - before(() => { + before(async () => { const reader = new ASTReader(); - const { data } = compileJson(sample, "0.5.0", []); + const { data } = await compileJson(sample, "0.5.0"); const units = reader.read(data); mainUnit = units[0]; diff --git a/test/unit/ast/reading/expression/tuple.spec.ts b/test/unit/ast/reading/expression/tuple.spec.ts index 3770fdff..7969d233 100644 --- a/test/unit/ast/reading/expression/tuple.spec.ts +++ b/test/unit/ast/reading/expression/tuple.spec.ts @@ -21,9 +21,9 @@ describe("TupleExpression", () => { let mainUnit: SourceUnit; let funcs: readonly FunctionDefinition[]; - before(() => { + before(async () => { const reader = new ASTReader(); - const { data } = compileJson(sample, version, []); + const { data } = await compileJson(sample, version); [mainUnit] = reader.read(data); diff --git a/test/unit/ast/reading/expression/unary_operation.spec.ts b/test/unit/ast/reading/expression/unary_operation.spec.ts index 016b1463..b08f29b4 100644 --- a/test/unit/ast/reading/expression/unary_operation.spec.ts +++ b/test/unit/ast/reading/expression/unary_operation.spec.ts @@ -24,9 +24,9 @@ describe("UnaryOperation", () => { cases.pop(); } - before(() => { + before(async () => { const reader = new ASTReader(); - const { data } = compileJson(sample, version, []); + const { data } = await compileJson(sample, version); const [mainUnit] = reader.read(data); nodes = mainUnit.getChildrenByType(UnaryOperation); diff --git a/test/unit/ast/reading/meta/import_directive.spec.ts b/test/unit/ast/reading/meta/import_directive.spec.ts index 032c6cae..c34970d4 100644 --- a/test/unit/ast/reading/meta/import_directive.spec.ts +++ b/test/unit/ast/reading/meta/import_directive.spec.ts @@ -11,9 +11,9 @@ describe("ImportDirective", () => { describe(`Solc ${version}: ${sample}`, () => { let units: SourceUnit[]; - before(() => { + before(async () => { const reader = new ASTReader(); - const { data } = compileJson(sample, version, []); + const { data } = await compileJson(sample, version); units = reader.read(data); }); diff --git a/test/unit/ast/reading/meta/inheritance_specifier.spec.ts b/test/unit/ast/reading/meta/inheritance_specifier.spec.ts index 22dcc168..5bd24d8e 100644 --- a/test/unit/ast/reading/meta/inheritance_specifier.spec.ts +++ b/test/unit/ast/reading/meta/inheritance_specifier.spec.ts @@ -11,9 +11,9 @@ describe("ImportDirective", () => { describe(`Solc ${version}: ${sample}`, () => { let contracts: readonly ContractDefinition[]; - before(() => { + before(async () => { const reader = new ASTReader(); - const { data } = compileJson(sample, version, []); + const { data } = await compileJson(sample, version); const units = reader.read(data); contracts = units diff --git a/test/unit/ast/reading/meta/pragma_directive.spec.ts b/test/unit/ast/reading/meta/pragma_directive.spec.ts index 9adb8688..08a0bc12 100644 --- a/test/unit/ast/reading/meta/pragma_directive.spec.ts +++ b/test/unit/ast/reading/meta/pragma_directive.spec.ts @@ -11,9 +11,9 @@ describe("PragmaDirective", () => { describe(`Solc ${version}: ${sample}`, () => { let directives: readonly PragmaDirective[]; - before(() => { + before(async () => { const reader = new ASTReader(); - const { data } = compileJson(sample, version, []); + const { data } = await compileJson(sample, version); const [mainUnit] = reader.read(data); directives = mainUnit.vPragmaDirectives; diff --git a/test/unit/ast/reading/meta/source_unit.spec.ts b/test/unit/ast/reading/meta/source_unit.spec.ts index 7ae29c68..94087771 100644 --- a/test/unit/ast/reading/meta/source_unit.spec.ts +++ b/test/unit/ast/reading/meta/source_unit.spec.ts @@ -11,9 +11,9 @@ describe("SourceUnit", () => { describe(`Solc ${version}: ${sample}`, () => { let units: SourceUnit[]; - before(() => { + before(async () => { const reader = new ASTReader(); - const { data } = compileJson(sample, version, []); + const { data } = await compileJson(sample, version); units = reader.read(data); }); diff --git a/test/unit/ast/reading/meta/using_for.spec.ts b/test/unit/ast/reading/meta/using_for.spec.ts index 7e8202bb..13765e4d 100644 --- a/test/unit/ast/reading/meta/using_for.spec.ts +++ b/test/unit/ast/reading/meta/using_for.spec.ts @@ -17,9 +17,9 @@ describe("UsingForDirective", () => { describe(`Solc ${version}: ${sample}`, () => { let uses: UsingForDirective[]; - before(() => { + before(async () => { const reader = new ASTReader(); - const { data } = compileJson(sample, version, []); + const { data } = await compileJson(sample, version); const [mainUnit] = reader.read(data); uses = mainUnit.getChildrenByType(UsingForDirective); diff --git a/test/unit/ast/reading/statement/block_0413.spec.ts b/test/unit/ast/reading/statement/block_0413.spec.ts index 02189ee1..1ad77612 100644 --- a/test/unit/ast/reading/statement/block_0413.spec.ts +++ b/test/unit/ast/reading/statement/block_0413.spec.ts @@ -18,9 +18,9 @@ describe("Block (Solc 0.4.13)", () => { let mainUnit: SourceUnit; let funcs: FunctionDefinition[]; - before(() => { + before(async () => { const reader = new ASTReader(); - const { data } = compileJson(sample, "0.4.13", []); + const { data } = await compileJson(sample, "0.4.13"); const units = reader.read(data); mainUnit = units[0]; diff --git a/test/unit/ast/reading/statement/block_050.spec.ts b/test/unit/ast/reading/statement/block_050.spec.ts index 618b8284..d8c566c3 100644 --- a/test/unit/ast/reading/statement/block_050.spec.ts +++ b/test/unit/ast/reading/statement/block_050.spec.ts @@ -18,9 +18,9 @@ describe("Block (Solc 0.5.0)", () => { let mainUnit: SourceUnit; let funcs: FunctionDefinition[]; - before(() => { + before(async () => { const reader = new ASTReader(); - const { data } = compileJson(sample, "0.5.0", []); + const { data } = await compileJson(sample, "0.5.0"); const units = reader.read(data); mainUnit = units[0]; diff --git a/test/unit/ast/reading/statement/do_while_0413.spec.ts b/test/unit/ast/reading/statement/do_while_0413.spec.ts index 7db5cc4c..df617777 100644 --- a/test/unit/ast/reading/statement/do_while_0413.spec.ts +++ b/test/unit/ast/reading/statement/do_while_0413.spec.ts @@ -16,9 +16,9 @@ describe("DoWhileStatement (Solc 0.4.13)", () => { let mainUnit: SourceUnit; let funcs: FunctionDefinition[]; - before(() => { + before(async () => { const reader = new ASTReader(); - const { data } = compileJson(sample, "0.4.13", []); + const { data } = await compileJson(sample, "0.4.13"); const units = reader.read(data); mainUnit = units[0]; diff --git a/test/unit/ast/reading/statement/do_while_050.spec.ts b/test/unit/ast/reading/statement/do_while_050.spec.ts index 2840c2d1..f87c4b49 100644 --- a/test/unit/ast/reading/statement/do_while_050.spec.ts +++ b/test/unit/ast/reading/statement/do_while_050.spec.ts @@ -16,9 +16,9 @@ describe("DoWhileStatement (Solc 0.5.0)", () => { let mainUnit: SourceUnit; let funcs: FunctionDefinition[]; - before(() => { + before(async () => { const reader = new ASTReader(); - const { data } = compileJson(sample, "0.5.0", []); + const { data } = await compileJson(sample, "0.5.0"); const units = reader.read(data); mainUnit = units[0]; diff --git a/test/unit/ast/reading/statement/emit_0421.spec.ts b/test/unit/ast/reading/statement/emit_0421.spec.ts index dccaad3f..1d5a8443 100644 --- a/test/unit/ast/reading/statement/emit_0421.spec.ts +++ b/test/unit/ast/reading/statement/emit_0421.spec.ts @@ -16,9 +16,9 @@ describe("EmitStatement (Solc 0.4.21)", () => { let mainUnit: SourceUnit; let funcs: FunctionDefinition[]; - before(() => { + before(async () => { const reader = new ASTReader(); - const { data } = compileJson(sample, "0.4.21", []); + const { data } = await compileJson(sample, "0.4.21"); const units = reader.read(data); mainUnit = units[0]; diff --git a/test/unit/ast/reading/statement/emit_050.spec.ts b/test/unit/ast/reading/statement/emit_050.spec.ts index f4772b16..2db6a9e8 100644 --- a/test/unit/ast/reading/statement/emit_050.spec.ts +++ b/test/unit/ast/reading/statement/emit_050.spec.ts @@ -16,9 +16,9 @@ describe("EmitStatement (Solc 0.5.0)", () => { let mainUnit: SourceUnit; let funcs: FunctionDefinition[]; - before(() => { + before(async () => { const reader = new ASTReader(); - const { data } = compileJson(sample, "0.5.0", []); + const { data } = await compileJson(sample, "0.5.0"); const units = reader.read(data); mainUnit = units[0]; diff --git a/test/unit/ast/reading/statement/expression_0413.spec.ts b/test/unit/ast/reading/statement/expression_0413.spec.ts index fd25a74e..fb0443e7 100644 --- a/test/unit/ast/reading/statement/expression_0413.spec.ts +++ b/test/unit/ast/reading/statement/expression_0413.spec.ts @@ -19,9 +19,9 @@ describe("ExpressionStatement (Solc 0.4.13)", () => { let mainUnit: SourceUnit; let funcs: FunctionDefinition[]; - before(() => { + before(async () => { const reader = new ASTReader(); - const { data } = compileJson(sample, "0.4.13", []); + const { data } = await compileJson(sample, "0.4.13"); const units = reader.read(data); mainUnit = units[0]; diff --git a/test/unit/ast/reading/statement/expression_050.spec.ts b/test/unit/ast/reading/statement/expression_050.spec.ts index 29bd8c70..d44c3d1a 100644 --- a/test/unit/ast/reading/statement/expression_050.spec.ts +++ b/test/unit/ast/reading/statement/expression_050.spec.ts @@ -19,9 +19,9 @@ describe("ExpressionStatement (Solc 0.5.0)", () => { let mainUnit: SourceUnit; let funcs: FunctionDefinition[]; - before(() => { + before(async () => { const reader = new ASTReader(); - const { data } = compileJson(sample, "0.5.0", []); + const { data } = await compileJson(sample, "0.5.0"); const units = reader.read(data); mainUnit = units[0]; diff --git a/test/unit/ast/reading/statement/for_0413.spec.ts b/test/unit/ast/reading/statement/for_0413.spec.ts index 6b2c3e71..a212a637 100644 --- a/test/unit/ast/reading/statement/for_0413.spec.ts +++ b/test/unit/ast/reading/statement/for_0413.spec.ts @@ -17,9 +17,9 @@ describe("ForStatement (Solc 0.4.13)", () => { let mainUnit: SourceUnit; let funcs: FunctionDefinition[]; - before(() => { + before(async () => { const reader = new ASTReader(); - const { data } = compileJson(sample, "0.4.13", []); + const { data } = await compileJson(sample, "0.4.13"); const units = reader.read(data); mainUnit = units[0]; diff --git a/test/unit/ast/reading/statement/for_050.spec.ts b/test/unit/ast/reading/statement/for_050.spec.ts index e00a8f60..68e3285f 100644 --- a/test/unit/ast/reading/statement/for_050.spec.ts +++ b/test/unit/ast/reading/statement/for_050.spec.ts @@ -17,9 +17,9 @@ describe("ForStatement (Solc 0.5.0)", () => { let mainUnit: SourceUnit; let funcs: FunctionDefinition[]; - before(() => { + before(async () => { const reader = new ASTReader(); - const { data } = compileJson(sample, "0.5.0", []); + const { data } = await compileJson(sample, "0.5.0"); const units = reader.read(data); mainUnit = units[0]; diff --git a/test/unit/ast/reading/statement/if_0413.spec.ts b/test/unit/ast/reading/statement/if_0413.spec.ts index 83f5e193..57574e49 100644 --- a/test/unit/ast/reading/statement/if_0413.spec.ts +++ b/test/unit/ast/reading/statement/if_0413.spec.ts @@ -16,9 +16,9 @@ describe("IfStatement (Solc 0.4.13)", () => { let mainUnit: SourceUnit; let funcs: FunctionDefinition[]; - before(() => { + before(async () => { const reader = new ASTReader(); - const { data } = compileJson(sample, "0.4.13", []); + const { data } = await compileJson(sample, "0.4.13"); const units = reader.read(data); mainUnit = units[0]; diff --git a/test/unit/ast/reading/statement/if_050.spec.ts b/test/unit/ast/reading/statement/if_050.spec.ts index c24f288c..75cde45f 100644 --- a/test/unit/ast/reading/statement/if_050.spec.ts +++ b/test/unit/ast/reading/statement/if_050.spec.ts @@ -16,9 +16,9 @@ describe("IfStatement (Solc 0.5.0)", () => { let mainUnit: SourceUnit; let funcs: FunctionDefinition[]; - before(() => { + before(async () => { const reader = new ASTReader(); - const { data } = compileJson(sample, "0.5.0", []); + const { data } = await compileJson(sample, "0.5.0"); const units = reader.read(data); mainUnit = units[0]; diff --git a/test/unit/ast/reading/statement/inline_assembly_0413.spec.ts b/test/unit/ast/reading/statement/inline_assembly_0413.spec.ts index c7e8d261..07187777 100644 --- a/test/unit/ast/reading/statement/inline_assembly_0413.spec.ts +++ b/test/unit/ast/reading/statement/inline_assembly_0413.spec.ts @@ -15,9 +15,9 @@ describe("InlineAssembly (Solc 0.4.13)", () => { let mainUnit: SourceUnit; let funcs: FunctionDefinition[]; - before(() => { + before(async () => { const reader = new ASTReader(); - const { data } = compileJson(sample, "0.4.13", []); + const { data } = await compileJson(sample, "0.4.13"); const units = reader.read(data); mainUnit = units[0]; diff --git a/test/unit/ast/reading/statement/inline_assembly_050.spec.ts b/test/unit/ast/reading/statement/inline_assembly_050.spec.ts index b3c521b6..b85864c4 100644 --- a/test/unit/ast/reading/statement/inline_assembly_050.spec.ts +++ b/test/unit/ast/reading/statement/inline_assembly_050.spec.ts @@ -15,9 +15,9 @@ describe("InlineAssembly (Solc 0.5.0)", () => { let mainUnit: SourceUnit; let funcs: FunctionDefinition[]; - before(() => { + before(async () => { const reader = new ASTReader(); - const { data } = compileJson(sample, "0.5.0", []); + const { data } = await compileJson(sample, "0.5.0"); const units = reader.read(data); mainUnit = units[0]; diff --git a/test/unit/ast/reading/statement/placeholder_0413.spec.ts b/test/unit/ast/reading/statement/placeholder_0413.spec.ts index 69ce1a28..ea615ccc 100644 --- a/test/unit/ast/reading/statement/placeholder_0413.spec.ts +++ b/test/unit/ast/reading/statement/placeholder_0413.spec.ts @@ -16,9 +16,9 @@ describe("PlaceholderStatement (Solc 0.4.13)", () => { let mainUnit: SourceUnit; let mods: ModifierDefinition[]; - before(() => { + before(async () => { const reader = new ASTReader(); - const { data } = compileJson(sample, "0.4.13", []); + const { data } = await compileJson(sample, "0.4.13"); const units = reader.read(data); mainUnit = units[0]; diff --git a/test/unit/ast/reading/statement/placeholder_050.spec.ts b/test/unit/ast/reading/statement/placeholder_050.spec.ts index f7577997..ddcf96d0 100644 --- a/test/unit/ast/reading/statement/placeholder_050.spec.ts +++ b/test/unit/ast/reading/statement/placeholder_050.spec.ts @@ -16,9 +16,9 @@ describe("PlaceholderStatement (Solc 0.5.0)", () => { let mainUnit: SourceUnit; let mods: ModifierDefinition[]; - before(() => { + before(async () => { const reader = new ASTReader(); - const { data } = compileJson(sample, "0.5.0", []); + const { data } = await compileJson(sample, "0.5.0"); const units = reader.read(data); mainUnit = units[0]; diff --git a/test/unit/ast/reading/statement/return_0413.spec.ts b/test/unit/ast/reading/statement/return_0413.spec.ts index 7fe68598..de512d61 100644 --- a/test/unit/ast/reading/statement/return_0413.spec.ts +++ b/test/unit/ast/reading/statement/return_0413.spec.ts @@ -20,9 +20,9 @@ describe("Return (Solc 0.4.13)", () => { let mainUnit: SourceUnit; let funcs: FunctionDefinition[]; - before(() => { + before(async () => { const reader = new ASTReader(); - const { data } = compileJson(sample, "0.4.13", []); + const { data } = await compileJson(sample, "0.4.13"); const units = reader.read(data); mainUnit = units[0]; diff --git a/test/unit/ast/reading/statement/return_050.spec.ts b/test/unit/ast/reading/statement/return_050.spec.ts index c7bb0d65..9d5ab67c 100644 --- a/test/unit/ast/reading/statement/return_050.spec.ts +++ b/test/unit/ast/reading/statement/return_050.spec.ts @@ -20,9 +20,9 @@ describe("Return (Solc 0.5.0)", () => { let mainUnit: SourceUnit; let funcs: FunctionDefinition[]; - before(() => { + before(async () => { const reader = new ASTReader(); - const { data } = compileJson(sample, "0.5.0", []); + const { data } = await compileJson(sample, "0.5.0"); const units = reader.read(data); mainUnit = units[0]; diff --git a/test/unit/ast/reading/statement/throw_0413.spec.ts b/test/unit/ast/reading/statement/throw_0413.spec.ts index 5169947b..eed3aa11 100644 --- a/test/unit/ast/reading/statement/throw_0413.spec.ts +++ b/test/unit/ast/reading/statement/throw_0413.spec.ts @@ -16,9 +16,9 @@ describe("Throw (Solc 0.4.13)", () => { let mainUnit: SourceUnit; let funcs: FunctionDefinition[]; - before(() => { + before(async () => { const reader = new ASTReader(); - const { data } = compileJson(sample, "0.4.13", []); + const { data } = await compileJson(sample, "0.4.13"); const units = reader.read(data); mainUnit = units[0]; diff --git a/test/unit/ast/reading/statement/variable_declaration_0413.spec.ts b/test/unit/ast/reading/statement/variable_declaration_0413.spec.ts index 54634b29..d2f0f737 100644 --- a/test/unit/ast/reading/statement/variable_declaration_0413.spec.ts +++ b/test/unit/ast/reading/statement/variable_declaration_0413.spec.ts @@ -19,9 +19,9 @@ describe("VariableDeclarationStatement (Solc 0.4.13)", () => { let mainUnit: SourceUnit; let funcs: FunctionDefinition[]; - before(() => { + before(async () => { const reader = new ASTReader(); - const { data } = compileJson(sample, "0.4.13", []); + const { data } = await compileJson(sample, "0.4.13"); const units = reader.read(data); mainUnit = units[0]; diff --git a/test/unit/ast/reading/statement/variable_declaration_050.spec.ts b/test/unit/ast/reading/statement/variable_declaration_050.spec.ts index 1ac71463..906d8817 100644 --- a/test/unit/ast/reading/statement/variable_declaration_050.spec.ts +++ b/test/unit/ast/reading/statement/variable_declaration_050.spec.ts @@ -19,9 +19,9 @@ describe("VariableDeclarationStatement (Solc 0.5.0)", () => { let mainUnit: SourceUnit; let funcs: FunctionDefinition[]; - before(() => { + before(async () => { const reader = new ASTReader(); - const { data } = compileJson(sample, "0.5.0", []); + const { data } = await compileJson(sample, "0.5.0"); const units = reader.read(data); mainUnit = units[0]; diff --git a/test/unit/ast/reading/statement/while_0413.spec.ts b/test/unit/ast/reading/statement/while_0413.spec.ts index 5f1879ee..ad4202c0 100644 --- a/test/unit/ast/reading/statement/while_0413.spec.ts +++ b/test/unit/ast/reading/statement/while_0413.spec.ts @@ -16,9 +16,9 @@ describe("WhileStatement (Solc 0.4.13)", () => { let mainUnit: SourceUnit; let funcs: FunctionDefinition[]; - before(() => { + before(async () => { const reader = new ASTReader(); - const { data } = compileJson(sample, "0.4.13", []); + const { data } = await compileJson(sample, "0.4.13"); const units = reader.read(data); mainUnit = units[0]; diff --git a/test/unit/ast/reading/statement/while_050.spec.ts b/test/unit/ast/reading/statement/while_050.spec.ts index f5361e10..bb1169d8 100644 --- a/test/unit/ast/reading/statement/while_050.spec.ts +++ b/test/unit/ast/reading/statement/while_050.spec.ts @@ -16,9 +16,9 @@ describe("WhileStatement (Solc 0.5.0)", () => { let mainUnit: SourceUnit; let funcs: FunctionDefinition[]; - before(() => { + before(async () => { const reader = new ASTReader(); - const { data } = compileJson(sample, "0.5.0", []); + const { data } = await compileJson(sample, "0.5.0"); const units = reader.read(data); mainUnit = units[0]; diff --git a/test/unit/ast/reading/type/array_type_name.spec.ts b/test/unit/ast/reading/type/array_type_name.spec.ts index c6b0ea91..8e7d1d46 100644 --- a/test/unit/ast/reading/type/array_type_name.spec.ts +++ b/test/unit/ast/reading/type/array_type_name.spec.ts @@ -17,9 +17,9 @@ describe("ArrayTypeName", () => { describe(`Solc ${version}: ${sample}`, () => { let nodes: ArrayTypeName[]; - before(() => { + before(async () => { const reader = new ASTReader(); - const { data } = compileJson(sample, version, []); + const { data } = await compileJson(sample, version); const [mainUnit] = reader.read(data); nodes = mainUnit.getChildrenByType(ArrayTypeName); diff --git a/test/unit/ast/reading/type/elementary_type_name.spec.ts b/test/unit/ast/reading/type/elementary_type_name.spec.ts index 7c172dd2..6f65dc0e 100644 --- a/test/unit/ast/reading/type/elementary_type_name.spec.ts +++ b/test/unit/ast/reading/type/elementary_type_name.spec.ts @@ -11,9 +11,9 @@ describe("ElementaryTypeName", () => { describe(`Solc ${version}: ${sample}`, () => { let nodes: ElementaryTypeName[]; - before(() => { + before(async () => { const reader = new ASTReader(); - const { data } = compileJson(sample, version, []); + const { data } = await compileJson(sample, version); const [mainUnit] = reader.read(data); nodes = mainUnit.getChildrenByType(ElementaryTypeName); diff --git a/test/unit/ast/reading/type/function_type_name.spec.ts b/test/unit/ast/reading/type/function_type_name.spec.ts index 9d99af98..d3c8a2c7 100644 --- a/test/unit/ast/reading/type/function_type_name.spec.ts +++ b/test/unit/ast/reading/type/function_type_name.spec.ts @@ -19,9 +19,9 @@ describe("FunctionTypeName", () => { describe(`Solc ${version}: ${sample}`, () => { let nodes: FunctionTypeName[]; - before(() => { + before(async () => { const reader = new ASTReader(); - const { data } = compileJson(sample, version, []); + const { data } = await compileJson(sample, version); const [mainUnit] = reader.read(data); nodes = mainUnit.getChildrenByType(FunctionTypeName); diff --git a/test/unit/ast/reading/type/mapping.spec.ts b/test/unit/ast/reading/type/mapping.spec.ts index 3107d65e..8e25dab3 100644 --- a/test/unit/ast/reading/type/mapping.spec.ts +++ b/test/unit/ast/reading/type/mapping.spec.ts @@ -17,9 +17,9 @@ describe("Mapping", () => { describe(`Solc ${version}: ${sample}`, () => { let nodes: Mapping[]; - before(() => { + before(async () => { const reader = new ASTReader(); - const { data } = compileJson(sample, version, []); + const { data } = await compileJson(sample, version); const [mainUnit] = reader.read(data); nodes = mainUnit.getChildrenByType(Mapping); diff --git a/test/unit/compile/compiler_selection.spec.ts b/test/unit/compile/compiler_selection.spec.ts index 1dd975f0..61113f19 100644 --- a/test/unit/compile/compiler_selection.spec.ts +++ b/test/unit/compile/compiler_selection.spec.ts @@ -179,7 +179,7 @@ describe("VersionDetectionStrategy", () => { it(`Returns ${JSON.stringify(range)} for ${JSON.stringify(source)} and ${ fallback.constructor.name } in constructor`, () => { - const strategy = new VersionDetectionStrategy(source, fallback); + const strategy = new VersionDetectionStrategy([source], fallback); expect(strategy.select()).toEqual(range); }); diff --git a/test/unit/compile/import_resolver.spec.ts b/test/unit/compile/import_resolver.spec.ts index 064a3503..cd089646 100644 --- a/test/unit/compile/import_resolver.spec.ts +++ b/test/unit/compile/import_resolver.spec.ts @@ -1,6 +1,6 @@ import expect from "expect"; import path from "path"; -import { FileSystemResolver, LocalNpmResolver, RemappingResolver } from "../../../src"; +import { FileSystemResolver, LocalNpmResolver } from "../../../src"; describe("FileSystemResolver", () => { describe("resolve()", () => { @@ -18,25 +18,6 @@ describe("FileSystemResolver", () => { }); }); -describe("RemappingResolver", () => { - describe("resolve()", () => { - const resolver = new RemappingResolver([["", "@x/", "test/samples/solidity/"]]); - - const cases: Array<[string, string | undefined]> = [ - ["@x/node.sol", "test/samples/solidity/node.sol"], - ["@x/missing.sol", undefined], - ["test/samples/solidity/node.sol", undefined], - ["test/samples/solidity/missing.sol", undefined] - ]; - - for (const [fileName, result] of cases) { - it(`Returns ${JSON.stringify(result)} for "${fileName}"`, () => { - expect(resolver.resolve(fileName)).toEqual(result); - }); - } - }); -}); - describe("LocalNpmResolver", () => { describe("resolve()", () => { const resolver = new LocalNpmResolver("test/"); diff --git a/test/unit/compile/inference/file_level_definitions_parser.spec.ts b/test/unit/compile/inference/file_level_definitions_parser.spec.ts new file mode 100644 index 00000000..7389648d --- /dev/null +++ b/test/unit/compile/inference/file_level_definitions_parser.spec.ts @@ -0,0 +1,558 @@ +import { fail } from "assert"; +import expect from "expect"; +import fse from "fs-extra"; +import { parseFileLevelDefinitions } from "../../../../src"; +import { searchRecursive } from "../../../utils"; + +const good_samples: Array<[string, string, any]> = [ + // Imports + ["import1", `import "a.sol";`, [{ path: "a.sol", unitAlias: null, symbols: [] }]], + [ + "import2", + `import {foo} from "a.sol";`, + [{ path: "a.sol", symbols: [{ alias: null, name: "foo" }], unitAlias: null }] + ], + [ + "import3", + `import {foo as bar} from "a.sol";`, + [{ path: "a.sol", symbols: [{ alias: "bar", name: "foo" }], unitAlias: null }] + ], + ["import4", `import "a.sol" as boo;`, [{ path: "a.sol", symbols: [], unitAlias: "boo" }]], + [ + "import5", + `/*sup brah */ import "a.sol" as boo;`, + [{ path: "a.sol", symbols: [], unitAlias: "boo" }] + ], + [ + "import6", + `/*sup brah */ import /* import foo */ "a.sol" /* boo * */ as /* mo*o */ /**/ /* */ boo; // for realzies?`, + [{ path: "a.sol", symbols: [], unitAlias: "boo" }] + ], + + // Constants + ["constant1", "uint constant a = 1;", [{ name: "a", kind: "constant", value: "1" }]], + [ + "constant2", + `string constant a = "asdfasd; nasdf (;)}{;/**/ // /*";`, + [{ name: "a", kind: "constant", value: `"asdfasd; nasdf (;)}{;/**/ // /*"` }] + ], + [ + "constant3", + `string constant a = 'asdfasd; nasdf (;)}{;/**/ // /*';`, + [{ name: "a", kind: "constant", value: `'asdfasd; nasdf (;)}{;/**/ // /*'` }] + ], + [ + "invalid escape sequence (legacy)", + `string constant a = '\\2';`, + [{ name: "a", kind: "constant", value: `'\\2'` }] + ], + + // Free functions + [ + "free fun $foo$", + `function $foo$(uint $arg) {}`, + [ + { + kind: "function", + name: "$foo$", + args: "(uint $arg)", + mutability: "", + returns: null, + body: "{}" + } + ] + ], + [ + "free fun foo0", + `function foo0() {}`, + [{ kind: "function", name: "foo0", args: "()", mutability: "", returns: null, body: "{}" }] + ], + [ + "free fun foo1", + `function foo1(uint x) {}`, + [ + { + kind: "function", + name: "foo1", + args: "(uint x)", + mutability: "", + returns: null, + body: "{}" + } + ] + ], + [ + "free fun foo2", + `function foo2(uint x) pure {}`, + [ + { + kind: "function", + name: "foo2", + args: "(uint x)", + mutability: "pure", + returns: null, + body: "{}" + } + ] + ], + [ + "free fun foo3", + `function foo3(uint x) returns (uint y) {}`, + [ + { + kind: "function", + name: "foo3", + args: "(uint x)", + mutability: "", + returns: "returns (uint y)", + body: "{}" + } + ] + ], + [ + "free fun foo4", + `function foo4(uint x) view returns (uint y) {}`, + [ + { + kind: "function", + name: "foo4", + args: "(uint x)", + mutability: "view", + returns: "returns (uint y)", + body: "{}" + } + ] + ], + [ + "free fun foo5", + `function foo5(uint x, uint[] memory y, mapping (uint => bytes) storage t) returns (mapping (uint => bytes) storage, string memory, bytes storage) { + string memory x; + bytes storage t1 = t[0]; + + return (t, x, t1); +}`, + [ + { + kind: "function", + name: "foo5", + args: "(uint x, uint[] memory y, mapping (uint => bytes) storage t)", + mutability: "", + returns: "returns (mapping (uint => bytes) storage, string memory, bytes storage)", + body: `{ + string memory x; + bytes storage t1 = t[0]; + + return (t, x, t1); +}` + } + ] + ], + [ + "free fun foo6", + `function foo6(uint x, uint[] memory y, mapping (uint => bytes) storage t) view returns (mapping (uint => bytes) storage, string memory, bytes storage) { + string memory x; + bytes storage t1 = t[0]; + + return (t, x, t1); +}`, + [ + { + kind: "function", + name: "foo6", + args: "(uint x, uint[] memory y, mapping (uint => bytes) storage t)", + mutability: "view", + returns: "returns (mapping (uint => bytes) storage, string memory, bytes storage)", + body: `{ + string memory x; + bytes storage t1 = t[0]; + + return (t, x, t1); +}` + } + ] + ], + [ + "free fun foo7", + `function foo7(uint x) view returns (uint y) { + for (uint i = 0; i < x; i++) { + if (i > 5) { + // haha + } else { + // hoho + } + } + return 1; +}`, + [ + { + kind: "function", + name: "foo7", + args: "(uint x)", + mutability: "view", + returns: "returns (uint y)", + body: `{ + for (uint i = 0; i < x; i++) { + if (i > 5) { + // haha + } else { + // hoho + } + } + return 1; +}` + } + ] + ], + [ + "free fun foo8", + `function /* soo */ foo8(uint x, // many + /* comments */ uint[/***/] /* you*/ memory y, mapping (uint /*wouldnt*/=> bytes) storage t) /*believe*/ view + returns (mapping (uint + => bytes) storage, string memory, bytes storage) { + string memory x; + /* it */ + bytes storage t1 = t[0]; // for + + return (t, x, t1); //realzies +} // bruh`, + [ + { + kind: "function", + name: "foo8", + args: `(uint x, // many + /* comments */ uint[/***/] /* you*/ memory y, mapping (uint /*wouldnt*/=> bytes) storage t)`, + mutability: "view", + returns: `returns (mapping (uint + => bytes) storage, string memory, bytes storage)`, + body: `{ + string memory x; + /* it */ + bytes storage t1 = t[0]; // for + + return (t, x, t1); //realzies +}` + } + ] + ], + [ + "library Brah", + `library Brah {}`, + [ + { + abstract: false, + kind: "contract", + contractKind: "library", + name: "Brah", + bases: null, + body: "{}" + } + ] + ], + [ + "contract Foo", + `contract Foo {}`, + [ + { + abstract: false, + kind: "contract", + contractKind: "contract", + name: "Foo", + bases: null, + body: "{}" + } + ] + ], + [ + "contract Foo1", + `abstract contract Foo1 {}`, + [ + { + abstract: true, + kind: "contract", + contractKind: "contract", + name: "Foo1", + bases: null, + body: "{}" + } + ] + ], + [ + "interface Moo", + `interface Moo {}`, + [ + { + abstract: false, + kind: "contract", + contractKind: "interface", + name: "Moo", + bases: null, + body: "{}" + } + ] + ], + [ + "contract Bar", + `contract Bar is Foo { + constructor(uint x) {} +}`, + [ + { + abstract: false, + kind: "contract", + contractKind: "contract", + name: "Bar", + bases: "Foo", + body: `{ + constructor(uint x) {} +}` + } + ] + ], + [ + "contract Boo", + `contract Boo is Foo, Bar(1) { + constructor(uint x, uint y) {} +}`, + [ + { + abstract: false, + kind: "contract", + contractKind: "contract", + name: "Boo", + bases: "Foo, Bar(1)", + body: `{ + constructor(uint x, uint y) {} +}` + } + ] + ], + [ + "contract Baz", + `contract /* soo */ Baz +/* much*/ is /* comment */ Boo(1,//wow +/*such */2 /*whitespace*/) /**/ +{ + int // so + a; + function /*cray*/ foo() public pure { + string memory t = "}}*\\*"; + } +}`, + [ + { + abstract: false, + kind: "contract", + contractKind: "contract", + name: "Baz", + bases: `Boo(1,//wow +/*such */2 /*whitespace*/)`, + body: `{ + int // so + a; + function /*cray*/ foo() public pure { + string memory t = "}}*\\*"; + } +}` + } + ] + ], + [ + "struct A", + `struct A { + uint x; +}`, + [ + { + kind: "struct", + name: "A", + body: `{ + uint x; +}` + } + ] + ], + [ + "struct B", + `struct /** wow*/ B // reeeeal shit? +{ + uint /** why doe? */ z/**/;/***/ +/****/}`, + [ + { + kind: "struct", + name: "B", + body: `{ + uint /** why doe? */ z/**/;/***/ +/****/}` + } + ] + ], + [ + "enum EA", + `enum EA { + A, B, + C +}`, + [ + { + kind: "enum", + name: "EA", + body: `{ + A, B, + C +}` + } + ] + ], + [ + "enum EB", + `enum /*1*/ EB //2 + { /*3*/ + A,/*3*/ B/**/, + C//5 +}`, + [ + { + kind: "enum", + name: "EB", + body: `{ /*3*/ + A,/*3*/ B/**/, + C//5 +}` + } + ] + ], + [ + "type T1", + `type T1 is uint;`, + [ + { + kind: "userValueType", + name: "T1", + valueType: `uint` + } + ] + ], + [ + "type T2", + `type T2 is bytes4;`, + [ + { + kind: "userValueType", + name: "T2", + valueType: `bytes4` + } + ] + ], + [ + "type T3", + `type /*1*/ T3 //2 +is /*3*/ int24;`, + [ + { + kind: "userValueType", + name: "T3", + valueType: `int24` + } + ] + ], + [ + "type T4", + `type /*1*/ T4 //2 +is /*3*/ int24/*;*/;`, + [ + { + kind: "userValueType", + name: "T4", + valueType: `int24/*;*/` + } + ] + ], + [ + "pragma solidity ^0.8.8;", + `pragma solidity ^0.8.8;`, + [ + { + kind: "pragma", + name: "solidity", + value: `^0.8.8` + } + ] + ], + [ + "pragma experimental ABIEncoderV2;", + `pragma experimental ABIEncoderV2;`, + [ + { + kind: "pragma", + name: "experimental", + value: `ABIEncoderV2` + } + ] + ], + [ + "pragma with comments", + `pragma /*;*/ solidity // oh yeah; +0.8.9/*;*/;`, + [ + { + kind: "pragma", + name: "solidity", + value: `0.8.9/*;*/` + } + ] + ] +]; + +/** + * Checks that a and b have the same number of nodes, and for each a_i and b_i, + * where a_i and b_i are objects, b_i is a "subset" of a_i + */ +function expectTopLevelNodesMatch(a: any[], b: any[]) { + // Uncomment the next line to see the parsed nodes for which the match fails + //console.error(`a: ${JSON.stringify(a)} b: ${JSON.stringify(b)}`); + expect(a.length).toEqual(b.length); + + for (let i = 0; i < a.length; i++) { + expect(a[i]).toMatchObject(b[i]); + } +} + +describe("File-level definitions parser unit tests", () => { + for (const [name, sample, expected] of good_samples) { + it(`${name} should parse successfully`, () => { + const parsed = parseFileLevelDefinitions(sample); + + expectTopLevelNodesMatch(parsed, expected); + }); + } +}); + +const SAMPLES_DIR = + process.env.SOLC_SAMPLES_TEST_DIR === undefined + ? "test/samples/solidity" + : process.env.SOLC_SAMPLES_TEST_DIR; + +describe("File-level definitions parser samples test", () => { + for (const fileName of searchRecursive(SAMPLES_DIR, (name) => name.endsWith(".sol"))) { + it(fileName, () => { + const contents = fse.readFileSync(fileName).toString(); + + let tlds; + + try { + tlds = parseFileLevelDefinitions(contents); + } catch (e: any) { + fail( + `Failed compiling ${fileName}: msg: ${e.message} loc: ${JSON.stringify( + e.location, + undefined, + 2 + )}` + ); + } + + expect(tlds.length).toBeGreaterThan(0); + }); + } +}); diff --git a/test/unit/compile/inference/findAllFiles.spec.ts b/test/unit/compile/inference/findAllFiles.spec.ts new file mode 100644 index 00000000..fd584631 --- /dev/null +++ b/test/unit/compile/inference/findAllFiles.spec.ts @@ -0,0 +1,91 @@ +import expect from "expect"; +import fse from "fs-extra"; +import { join } from "path"; +import { FileSystemResolver } from "../../../../src"; +import { findAllFiles, normalizeImportPath } from "../../../../src/compile/inference"; + +const SAMPLES_DIR = join("test", "samples", "solidity"); + +const samples: Array<[string, string[]]> = [ + [ + join(SAMPLES_DIR, "latest_08.sol"), + [join(SAMPLES_DIR, "latest_08.sol"), join(SAMPLES_DIR, "latest_imports_08.sol")] + ], + [ + join(SAMPLES_DIR, "resolving", "imports_and_source_unit_function_overloading.sol"), + [ + join(SAMPLES_DIR, "resolving", "imports_and_source_unit_function_overloading.sol"), + join(SAMPLES_DIR, "resolving", "boo.sol"), + join(SAMPLES_DIR, "resolving", "foo.sol") + ] + ], + [ + join(SAMPLES_DIR, "resolving", "id_paths.sol"), + [ + join(SAMPLES_DIR, "resolving", "id_paths.sol"), + join(SAMPLES_DIR, "resolving", "id_paths_lib.sol"), + join(SAMPLES_DIR, "resolving", "id_paths_lib2.sol") + ] + ], + [ + join(SAMPLES_DIR, "meta", "complex_imports", "c.sol"), + [ + join(SAMPLES_DIR, "meta", "complex_imports", "c.sol"), + join(SAMPLES_DIR, "meta", "complex_imports", "b.sol"), + join(SAMPLES_DIR, "meta", "complex_imports", "a.sol") + ] + ], + [ + join(SAMPLES_DIR, "meta", "imports", "A.sol"), + [ + join(SAMPLES_DIR, "meta", "imports", "A.sol"), + join(SAMPLES_DIR, "meta", "imports", "lib", "B.sol"), + join(SAMPLES_DIR, "meta", "imports", "lib2", "C.sol"), + join(SAMPLES_DIR, "meta", "imports", "lib2", "D.sol") + ] + ] +]; + +describe("findAllFiles() find all needed imports", () => { + for (const [fileName, expectedAllFiles] of samples) { + it(`All imports for ${fileName} should be ${expectedAllFiles.join(", ")}`, () => { + const contents = fse.readFileSync(fileName).toString(); + const files = new Map([[normalizeImportPath(fileName), contents]]); + const additionalFiles = findAllFiles(files, [], [new FileSystemResolver()]); + const allFiles = new Set([normalizeImportPath(fileName), ...additionalFiles.keys()]); + expect(allFiles).toEqual(new Set(expectedAllFiles.map(normalizeImportPath))); + }); + } +}); + +describe("findAllFiles() throws proper errors", () => { + it("Parsing error", () => { + const files = new Map([ + [ + "foo.sol", + `import a +contract Foo { +} +` + ] + ]); + + expect(() => findAllFiles(files, [], [new FileSystemResolver()])).toThrow( + /Failed parsing imports/ + ); + }); + + it("Missing file error", () => { + const files = new Map([ + [ + "foo.sol", + `import "a.sol"; +contract Foo { +} +` + ] + ]); + + expect(() => findAllFiles(files, [], [])).toThrow(/Couldn't find a.sol/); + }); +}); diff --git a/test/unit/compile/utils.spec.ts b/test/unit/compile/utils.spec.ts index 84c97851..a471c36b 100644 --- a/test/unit/compile/utils.spec.ts +++ b/test/unit/compile/utils.spec.ts @@ -2,30 +2,29 @@ import expect from "expect"; import fse from "fs-extra"; import { compileJson, - createFileSystemImportFinder, - createMemoryImportFinder, detectCompileErrors, - getCompilerForVersion, + getWasmCompilerForVersion, LatestAndFirstVersionInEachSeriesStrategy, LatestCompilerVersion, - parsePathRemapping + parsePathRemapping, + WasmCompiler } from "../../../src"; describe("Compile general utils", () => { - describe("getCompilerForVersion()", () => { + describe("getWasmCompilerForVersion()", () => { it("Non-exact version of compiler triggers an error", () => { - expect(() => getCompilerForVersion("^0.5.0")).toThrow(); + expect(() => getWasmCompilerForVersion("^0.5.0")).toThrow(); }); it("Unsupported version of compiler triggers an error", () => { - expect(() => getCompilerForVersion("0.4.10")).toThrow(); + expect(() => getWasmCompilerForVersion("0.4.10").module).toThrow(); }); const strategy = new LatestAndFirstVersionInEachSeriesStrategy(); for (const version of strategy.select()) { it(`Compiler ${version} is accessible`, () => { - expect(getCompilerForVersion(version)).toBeInstanceOf(Object); + expect(getWasmCompilerForVersion(version)).toBeInstanceOf(WasmCompiler); }); } }); @@ -49,85 +48,6 @@ describe("Compile general utils", () => { }); }); - describe("createFileSystemImportFinder()", () => { - const files = new Map(); - const finder = createFileSystemImportFinder( - "test/samples/solidity/node.sol", - files, - parsePathRemapping(["@x/=test/samples/solidity/"]) - ); - - const cases = [ - ["test/samples/solidity/node.sol", "pragma solidity"], - ["@x/missing_pragma.sol", "contract Test"], - [".bin/tsc", "#!/usr/bin/env"] - ]; - - for (const [fileName, contentPrefix] of cases) { - it(`Created finder resolves "${fileName}"`, () => { - const result = finder(fileName) as { contents: string }; - - expect(result.contents).toBeDefined(); - expect(result.contents.startsWith(contentPrefix)).toEqual(true); - - const cacheValue = files.get(fileName) as string; - - expect(cacheValue).toBeDefined(); - expect(cacheValue.startsWith(contentPrefix)).toEqual(true); - }); - } - - it('Created finder not resolves "missing"', () => { - const result = finder("missing") as { error: string }; - - expect(result.error).toBeDefined(); - expect(result.error).toMatch(/^Unable to find import path "[^"]+"$/); - }); - }); - - describe("createMemoryImportFinder()", () => { - const storage: any = { - "a/b.sol": { - source: "test" - }, - "c.sol": {} - }; - - const files = new Map(); - const finder = createMemoryImportFinder(storage, files); - - it(`Created finder resolves "a/b.sol"`, () => { - const result = finder("a/b.sol") as { contents: string }; - - expect(result.contents).toBeDefined(); - expect(result.contents).toEqual("test"); - - const cacheValue = files.get("a/b.sol") as string; - - expect(cacheValue).toBeDefined(); - expect(cacheValue).toEqual("test"); - }); - - it('Created finder not resolves "c.sol"', () => { - const result = finder("c.sol") as { error: string }; - - expect(result.error).toBeDefined(); - expect(result.error).toMatch(/^Entry at "[^"]+" contains no "source" property$/); - }); - - it('Created finder not resolves "missing"', () => { - const result = finder("missing") as { error: string }; - - expect(result.error).toBeDefined(); - expect(result.error).toMatch(/^Import path "[^"]+" not found in storage$/); - }); - - it("Creation of finder fails for null or undefined", () => { - expect(() => createMemoryImportFinder(undefined as any, new Map())).toThrow(); - expect(() => createMemoryImportFinder(null as any, new Map())).toThrow(); - }); - }); - describe("detectCompileErrors()", () => { const cases: Array<[string, string[]]> = [ [ @@ -174,16 +94,7 @@ describe("Compile general utils", () => { undefined, /^Unable to process data structure: neither consistent AST or code values are present$/ ], - [ - "test/samples/json/code_no_main.json", - undefined, - /^Unable to detect main source to compile$/ - ], - [ - "test/samples/json/code_main_source_invalid.json", - undefined, - /^Unable to detect main source to compile$/ - ], + ["test/samples/json/code_no_main.json", LatestCompilerVersion, undefined], ["test/samples/json/code_and_ast.json", undefined, undefined], ["test/samples/json/code_main_source.json", LatestCompilerVersion, undefined], ["test/samples/json/code_main_in_sources.json", LatestCompilerVersion, undefined] @@ -191,12 +102,18 @@ describe("Compile general utils", () => { for (const [fileName, version, result] of cases) { if (result instanceof RegExp) { - it(`Throws an error for ${JSON.stringify(fileName)}`, () => { - expect(() => compileJson(fileName, "auto", [])).toThrow(result); + it(`Throws an error for ${JSON.stringify(fileName)}`, async () => { + expect.assertions(1); + + try { + await compileJson(fileName, "auto"); + } catch (e: any) { + expect(e.message).toMatch(result); + } }); } else { - it(`Compiles ${JSON.stringify(fileName)} successfully`, () => { - const { data, compilerVersion, files } = compileJson(fileName, "auto", []); + it(`Compiles ${JSON.stringify(fileName)} successfully`, async () => { + const { data, compilerVersion, files } = await compileJson(fileName, "auto"); expect(data.sources).toBeDefined(); expect(detectCompileErrors(data)).toHaveLength(0); diff --git a/test/unit/misc/definitions.spec.ts b/test/unit/misc/definitions.spec.ts index 6a6eabb2..4951d906 100644 --- a/test/unit/misc/definitions.spec.ts +++ b/test/unit/misc/definitions.spec.ts @@ -90,11 +90,12 @@ const samples: Array<[string, string, ASTKind]> = [ ]; describe("resolveAny() correctly resolves all Identifiers/UserDefinedTypeNames/FunctionCalls", () => { - for (const [sample, compilerVersion, kind] of samples) { - it(`All definitions in ${sample} resolve correctly`, () => { - const result = compileSol(sample, "auto", []); + for (const [sample, compilerVersion, astKind] of samples) { + it(`All definitions in ${sample} resolve correctly`, async () => { + const result = await compileSol(sample, "auto", []); expect(result.compilerVersion).toEqual(compilerVersion); + const errors = detectCompileErrors(result.data); expect(errors).toHaveLength(0); @@ -102,7 +103,7 @@ describe("resolveAny() correctly resolves all Identifiers/UserDefinedTypeNames/F const data = result.data; const reader = new ASTReader(); - const sourceUnits = reader.read(data, kind); + const sourceUnits = reader.read(data, astKind); for (const unit of sourceUnits) { for (const node of unit.getChildrenBySelector( @@ -134,6 +135,7 @@ describe("resolveAny() correctly resolves all Identifiers/UserDefinedTypeNames/F } else { def = namedNode; } + let name: string; let ctx: ASTNode; @@ -147,6 +149,7 @@ describe("resolveAny() correctly resolves all Identifiers/UserDefinedTypeNames/F } name = namedNode.vFunctionName; + ctx = namedNode.vReferencedDeclaration.vScope instanceof ContractDefinition ? namedNode.vReferencedDeclaration @@ -174,8 +177,10 @@ describe("resolveAny() correctly resolves all Identifiers/UserDefinedTypeNames/F const resolved = [...resolveAny(name, ctx, compilerVersion)]; expect(resolved.length).toBeGreaterThanOrEqual(1); + if (resolved.length > 1) { const areEvents = resolved[0] instanceof EventDefinition; + expect( forAll(resolved, (def) => areEvents @@ -189,6 +194,7 @@ describe("resolveAny() correctly resolves all Identifiers/UserDefinedTypeNames/F } const resolvedIds = new Set(resolved.map((node) => node.id)); + expect(resolvedIds.has(expectedID)).toBeTruthy(); } } @@ -281,59 +287,6 @@ const unitSamples: Array< ] ] ], - [ - "./test/samples/solidity/resolving/imports_and_source_unit_function_overloading.sol", - CompilerVersions08[CompilerVersions08.length - 1], - ASTKind.Modern, - [ - [ - 62, // Function declaration for moo in "foo.sol" - [ - ["foo", [68], 'foo in "foo.sol" refers to struct def imported from "boo.sol"'], - [ - "roo", - [68], - 'roo in "foo.sol" refers to struct def imported via alias from "boo.sol"' - ] - ] - ], - [ - 15, // Body of function declaration for moo in "imports_and_source_unit_function_overloading.sol" - [ - [ - "moo", - [16, 63], - 'moo in the body of "moo()" refers to both overloaded functions' - ] - ] - ], - [ - 41, // Body of main in "imports_and_source_unit_function_overloading.sol" - [ - [ - "moo", - [16, 63], - 'moo in the body of "main()" refers to both overloaded functions' - ], - [ - "goo", - [20, 63], - 'moo in the body of "main()" refers to both overloaded functions' - ], - [ - "roo", - [68], - 'roo in the body of "main()" refers to the struct def in "boo.sol"' - ], - [ - "foo", - [68], - 'foo in the body of "main()" refers to the struct def in "boo.sol"' - ] - ] - ] - ] - ], [ "./test/samples/solidity/resolving/shadowing_overloading_and_overriding.sol", CompilerVersions08[CompilerVersions08.length - 1], @@ -465,11 +418,12 @@ const unitSamples: Array< ]; describe("resolveAny() unit tests", () => { - for (const [sample, compilerVersion, kind, sampleTests] of unitSamples) { - describe(`In sample ${sample}`, () => { - const result = compileSol(sample, "auto", []); + for (const [sample, compilerVersion, astKind, sampleTests] of unitSamples) { + describe(sample, async () => { + const result = await compileSol(sample, "auto", []); expect(result.compilerVersion).toEqual(compilerVersion); + const errors = detectCompileErrors(result.data); expect(errors).toHaveLength(0); @@ -477,13 +431,16 @@ describe("resolveAny() unit tests", () => { const data = result.data; const reader = new ASTReader(); - reader.read(data, kind); + + reader.read(data, astKind); for (const [ctxId, unitTests] of sampleTests) { const ctxNode = reader.context.locate(ctxId); + for (const [name, expectedIds, testName] of unitTests) { it(testName, () => { const resolvedNodes = resolveAny(name, ctxNode, compilerVersion); + expect(new Set(expectedIds)).toEqual( new Set([...resolvedNodes].map((node) => node.id)) ); diff --git a/test/unit/types/getters.spec.ts b/test/unit/types/getters.spec.ts index 86fbce81..bd038e5f 100644 --- a/test/unit/types/getters.spec.ts +++ b/test/unit/types/getters.spec.ts @@ -4,6 +4,7 @@ import { assert, ASTNodeConstructor, ASTReader, + CompilerKind, compileSol, ContractDefinition, DataLocation, @@ -17,6 +18,7 @@ import { getUserDefinedTypeFQName, IntType, PointerType, + PossibleCompilerKinds, SourceUnit, StringType, StructDefinition, @@ -378,39 +380,49 @@ const cases: Array<[string, Array<[string, TypeNode | DeferredTypeNode]>]> = [ describe("getterFunType()", () => { for (const [sample, mapping] of cases) { - describe(sample, () => { - let unit: SourceUnit; - - before(() => { - const { data } = compileSol(sample, "auto", []); - const errors = detectCompileErrors(data); + for (const kind of PossibleCompilerKinds) { + describe(`[${kind}] sample`, () => { + let unit: SourceUnit; + + before(async () => { + const { data } = await compileSol( + sample, + "auto", + [], + undefined, + undefined, + kind as CompilerKind + ); - expect(errors).toHaveLength(0); + const errors = detectCompileErrors(data); - const reader = new ASTReader(); - const units = reader.read(data); + expect(errors).toHaveLength(0); - expect(units.length).toEqual(1); + const reader = new ASTReader(); + const units = reader.read(data); - unit = units[0]; - }); + expect(units.length).toEqual(1); - for (const [stateVarName, typing] of mapping) { - it(`${stateVarName} -> ${ - typing instanceof TypeNode ? typing.pp() : "(deferred)" - }`, () => { - const expectedType = typing instanceof TypeNode ? typing : typing(unit); - const stateVar = getStateVar(unit, stateVarName); - const resultType = stateVar.getterFunType(); - - assert( - eq(resultType, expectedType), - "Expected {0}, got {1}", - expectedType, - resultType - ); + unit = units[0]; }); - } - }); + + for (const [stateVarName, typing] of mapping) { + it(`${stateVarName} -> ${ + typing instanceof TypeNode ? typing.pp() : "(deferred)" + }`, () => { + const expectedType = typing instanceof TypeNode ? typing : typing(unit); + const stateVar = getStateVar(unit, stateVarName); + const resultType = stateVar.getterFunType(); + + assert( + eq(resultType, expectedType), + "Expected {0}, got {1}", + expectedType, + resultType + ); + }); + } + }); + } } }); diff --git a/test/unit/types/signatures.spec.ts b/test/unit/types/signatures.spec.ts index ea767838..a12a0b09 100644 --- a/test/unit/types/signatures.spec.ts +++ b/test/unit/types/signatures.spec.ts @@ -1,10 +1,11 @@ import expect from "expect"; -import { gte, lt } from "semver"; +import { lt } from "semver"; import { AnyResolvable, assert, ASTKind, ASTReader, + CompilerKind, CompilerVersions08, compileSol, ContractDefinition, @@ -16,6 +17,7 @@ import { FunctionType, FunctionVisibility, generalizeType, + PossibleCompilerKinds, resolveAny, SourceUnit, VariableDeclaration, @@ -75,137 +77,161 @@ function resolveOne( describe("Check canonical signatures are generated correctly", () => { for (const [sample, compilerVersion, encoderVer] of samples) { - it(sample, () => { - const result = compileSol(sample, "auto", []); - - expect(result.compilerVersion).toEqual(compilerVersion); - - const errors = detectCompileErrors(result.data); - - expect(errors).toHaveLength(0); - - const data = result.data; + for (const kind of PossibleCompilerKinds) { + it(`[${kind}] ${sample}`, async () => { + const result = await compileSol( + sample, + "auto", + [], + undefined, + undefined, + kind as CompilerKind + ); + + expect(result.compilerVersion).toEqual(compilerVersion); + + const errors = detectCompileErrors(result.data); + + expect(errors).toHaveLength(0); + + const data = result.data; + + const reader = new ASTReader(); + const sourceUnits = reader.read(data, ASTKind.Any); + const unit = sourceUnits[0]; + + const runTestsHelper = ( + contractName: string, + functionHashes: any, + abiData: any + ) => { + for (const expectedSignature in functionHashes) { + const defName = expectedSignature.slice(0, expectedSignature.indexOf("(")); + const def = resolveOne(defName, contractName, unit, compilerVersion); + + if (def === undefined) { + continue; + } - const reader = new ASTReader(); - const sourceUnits = reader.read(data, ASTKind.Any); - const unit = sourceUnits[0]; + let signature: string; - const runTestsHelper = (contractName: string, functionHashes: any, abiData: any) => { - for (const expectedSignature in functionHashes) { - const defName = expectedSignature.slice(0, expectedSignature.indexOf("(")); - const def = resolveOne(defName, contractName, unit, compilerVersion); + if (def instanceof VariableDeclaration) { + signature = def.getterCanonicalSignature(encoderVer); + } else if (def instanceof FunctionDefinition) { + signature = def.canonicalSignature(encoderVer); + } else { + throw new Error(`NYI: ${def.print()}`); + } - if (def === undefined) { - continue; + expect(signature).toEqual(expectedSignature); } - let signature: string; - - if (def instanceof VariableDeclaration) { - signature = def.getterCanonicalSignature(encoderVer); - } else if (def instanceof FunctionDefinition) { - signature = def.canonicalSignature(encoderVer); - } else { - throw new Error(`NYI: ${def.print()}`); + /// 0.4.x doesn't report internal types in the ABI so we skip the ABI checks. + if (lt(compilerVersion, "0.5.0")) { + return; } - expect(signature).toEqual(expectedSignature); - } - - /// 0.4.x doesn't report internal types in the ABI so we skip the ABI checks. - if (lt(compilerVersion, "0.5.0")) { - return; - } - - for (const abiEntry of abiData) { - /// @todo fix the test so we can remove these - if ( - abiEntry.type === "constructor" || - abiEntry.type === "fallback" || - abiEntry.type === "receive" - ) { - continue; - } + for (const abiEntry of abiData) { + /// @todo fix the test so we can remove these + if ( + abiEntry.type === "constructor" || + abiEntry.type === "fallback" || + abiEntry.type === "receive" + ) { + continue; + } - const def = resolveOne(abiEntry.name, contractName, unit, compilerVersion); + const def = resolveOne(abiEntry.name, contractName, unit, compilerVersion); - if (def === undefined) { - continue; - } + if (def === undefined) { + continue; + } - let funT: FunctionType; - - if (def instanceof VariableDeclaration) { - funT = def.getterFunType(); - } else if (def instanceof FunctionDefinition) { - funT = new FunctionType( - def.name, - def.vParameters.vParameters.map(variableDeclarationToTypeNode), - def.vReturnParameters.vParameters.map(variableDeclarationToTypeNode), - def.visibility, - def.stateMutability - ); - } else if (def instanceof EventDefinition) { - funT = new FunctionType( - def.name, - def.vParameters.vParameters.map(variableDeclarationToTypeNode), - [], - FunctionVisibility.Default, - FunctionStateMutability.View - ); - } else if (def instanceof ErrorDefinition) { - funT = new FunctionType( - def.name, - def.vParameters.vParameters.map(variableDeclarationToTypeNode), - [], - FunctionVisibility.Default, - FunctionStateMutability.View - ); - } else { - throw new Error(`NYI: ${def.print()}`); - } + let funT: FunctionType; + + if (def instanceof VariableDeclaration) { + funT = def.getterFunType(); + } else if (def instanceof FunctionDefinition) { + funT = new FunctionType( + def.name, + def.vParameters.vParameters.map((param) => + variableDeclarationToTypeNode(param) + ), + def.vReturnParameters.vParameters.map((param) => + variableDeclarationToTypeNode(param) + ), + def.visibility, + def.stateMutability + ); + } else if (def instanceof EventDefinition) { + funT = new FunctionType( + def.name, + def.vParameters.vParameters.map((param) => + variableDeclarationToTypeNode(param) + ), + [], + FunctionVisibility.Default, + FunctionStateMutability.View + ); + } else if (def instanceof ErrorDefinition) { + funT = new FunctionType( + def.name, + def.vParameters.vParameters.map((param) => + variableDeclarationToTypeNode(param) + ), + [], + FunctionVisibility.Default, + FunctionStateMutability.View + ); + } else { + throw new Error(`NYI: ${def.print()}`); + } - expect(funT.parameters.length).toEqual(abiEntry.inputs.length); + expect(funT.parameters.length).toEqual(abiEntry.inputs.length); - for (let i = 0; i < funT.parameters.length; i++) { - expect(generalizeType(funT.parameters[i])[0].pp()).toEqual( - abiEntry.inputs[i].internalType - ); - } + for (let i = 0; i < funT.parameters.length; i++) { + expect(generalizeType(funT.parameters[i])[0].pp()).toEqual( + abiEntry.inputs[i].internalType + ); + } - if (abiEntry.type === "function") { - expect(funT.returns.length).toEqual(abiEntry.outputs.length); + if (abiEntry.type === "function") { + expect(funT.returns.length).toEqual(abiEntry.outputs.length); - for (let i = 0; i < funT.returns.length; i++) { - expect(generalizeType(funT.returns[i])[0].pp()).toEqual( - abiEntry.outputs[i].internalType - ); + for (let i = 0; i < funT.returns.length; i++) { + expect(generalizeType(funT.returns[i])[0].pp()).toEqual( + abiEntry.outputs[i].internalType + ); + } } } - } - }; + }; - // Standrad Json is laid out differently between 0.4.x and 0.5.x - if (gte(compilerVersion, "0.5.0")) { for (const fileName in data.contracts) { - for (const contractName in data.contracts[fileName]) { - const contractData = data.contracts[fileName][contractName]; - const functionHashes = contractData.evm.methodIdentifiers; - const abiData = contractData.abi; + if ("functionHashes" in data.contracts[fileName]) { + /** + * Legacy compiler data structure + */ + const contractName = fileName.slice(fileName.lastIndexOf(":") + 1); + const contractData = data.contracts[fileName]; + const functionHashes = contractData.functionHashes; + const abiData = JSON.parse(contractData.interface); runTestsHelper(contractName, functionHashes, abiData); + } else { + /** + * Modern compiler data structure + */ + for (const contractName in data.contracts[fileName]) { + const contractData = data.contracts[fileName][contractName]; + const functionHashes = contractData.evm.methodIdentifiers; + const abiData = contractData.abi; + + runTestsHelper(contractName, functionHashes, abiData); + } } } - } else { - for (const fileAndContractName of Object.keys(data.contracts)) { - const contractName = fileAndContractName.split(":")[1]; - const contractData = data.contracts[fileAndContractName]; - const functionHashes = contractData.functionHashes; - const abiData = JSON.parse(contractData.interface); - - runTestsHelper(contractName, functionHashes, abiData); - } - } - }); + }); + } } }); diff --git a/test/unit/types/typestrings.spec.ts b/test/unit/types/typestrings.spec.ts index e447f1a9..9f8520df 100644 --- a/test/unit/types/typestrings.spec.ts +++ b/test/unit/types/typestrings.spec.ts @@ -3,6 +3,7 @@ import { gte } from "semver"; import { ASTKind, ASTReader, + CompilerKind, CompilerVersions04, CompilerVersions05, CompilerVersions06, @@ -16,6 +17,7 @@ import { FunctionTypeName, Identifier, ModifierInvocation, + PossibleCompilerKinds, VariableDeclaration } from "../../../src"; import { @@ -96,102 +98,111 @@ const samples: Array<[string, string, ASTKind]> = [ ]; describe("Round-trip tests for typestring parser/printer", () => { - for (const [sample, compilerVersion, kind] of samples) { - it(sample, () => { - const result = compileSol(sample, "auto", []); - - expect(result.compilerVersion).toEqual(compilerVersion); - - const errors = detectCompileErrors(result.data); - - expect(errors).toHaveLength(0); - - const data = result.data; - - const reader = new ASTReader(); - const sourceUnits = reader.read(data, kind); - - for (const unit of sourceUnits) { - for (const node of unit.getChildrenBySelector( - (child) => child instanceof Expression || child instanceof VariableDeclaration - )) { - const typedASTNode = node as Expression | VariableDeclaration; - - // typeStrings for Identifiers in ImportDirectives may be undefined. - if (typedASTNode.typeString === undefined) { - continue; - } - - // Skip modifier invocations - if (typedASTNode.parent instanceof ModifierInvocation) { - continue; - } - - const typeNode = getNodeType(typedASTNode, compilerVersion); - - // Edge case: We don't fully model type strings for external function type names. - // External function type strings contain the funtion name as well, which we ignore - // and treat them as normal type names. - if ( - typeNode instanceof FunctionTypeName && - typedASTNode.typeString.includes("SampleInterface.infFunc") - ) { - continue; - } + for (const [sample, compilerVersion, astKind] of samples) { + for (const compilerKind of PossibleCompilerKinds) { + it(`[${compilerKind}] ${sample}`, async () => { + const result = await compileSol( + sample, + "auto", + [], + undefined, + undefined, + compilerKind as CompilerKind + ); + + expect(result.compilerVersion).toEqual(compilerVersion); + const errors = detectCompileErrors(result.data); + + expect(errors).toHaveLength(0); + + const data = result.data; + + const reader = new ASTReader(); + const sourceUnits = reader.read(data, astKind); + + for (const unit of sourceUnits) { + for (const node of unit.getChildrenBySelector( + (child) => + child instanceof Expression || child instanceof VariableDeclaration + )) { + const typedASTNode = node as Expression | VariableDeclaration; + + // typeStrings for Identifiers in ImportDirectives may be undefined. + if (typedASTNode.typeString === undefined) { + continue; + } - const compTypeString = typeNode.pp(); + // Skip modifier invocations + if (typedASTNode.parent instanceof ModifierInvocation) { + continue; + } - let skipTypeStringEqCheck = false; + const typeNode = getNodeType(typedASTNode, compilerVersion); - // We disagree with the normal TypeStrings for mappings - we always wrap them in a pointer. - if (typeNode instanceof PointerType && typeNode.to instanceof MappingType) { - skipTypeStringEqCheck = true; - } + // Edge case: We don't fully model type strings for external function type names. + // External function type strings contain the funtion name as well, which we ignore + // and treat them as normal type names. + if ( + typeNode instanceof FunctionTypeName && + typedASTNode.typeString.includes("SampleInterface.infFunc") + ) { + continue; + } - // typeStrings shorten some int_const by omitting digits. - // Ignore those as we can't correctly reproduce them. - if ( - typedASTNode.typeString.trim() !== compTypeString && - typedASTNode.typeString.includes("digits omitted") - ) { - skipTypeStringEqCheck = true; - } + const compTypeString = typeNode.pp(); - if (!skipTypeStringEqCheck) { - expect(typedASTNode.typeString.trim()).toEqual(compTypeString.trim()); - } + let skipTypeStringEqCheck = false; - // Check that the conversion from TypeNode ast nodes to - if ( - gte(compilerVersion, "0.5.0") && - typedASTNode instanceof Identifier && - typedASTNode.vReferencedDeclaration instanceof VariableDeclaration && - typedASTNode.vReferencedDeclaration.vType !== undefined - ) { - const compType2 = variableDeclarationToTypeNode( - typedASTNode.vReferencedDeclaration - ); + // We disagree with the normal TypeStrings for mappings - we always wrap them in a pointer. + if (typeNode instanceof PointerType && typeNode.to instanceof MappingType) { + skipTypeStringEqCheck = true; + } + // typeStrings shorten some int_const by omitting digits. + // Ignore those as we can't correctly reproduce them. if ( - compType2 instanceof PointerType && - compType2.location === DataLocation.Default + typedASTNode.typeString.trim() !== compTypeString && + typedASTNode.typeString.includes("digits omitted") ) { - continue; + skipTypeStringEqCheck = true; } - expect(eq(compType2, typeNode)).toBeTruthy(); - // Check that specialize and generalize are inverses - const [generalizedType, loc] = generalizeType(typeNode); - - const reSpecializedType = specializeType( - generalizedType, - loc === undefined ? DataLocation.Default : loc - ); + if (!skipTypeStringEqCheck) { + expect(typedASTNode.typeString.trim()).toEqual(compTypeString.trim()); + } - expect(eq(typeNode, reSpecializedType)).toBeTruthy(); + // Check that the conversion from TypeNode ast nodes to + if ( + gte(compilerVersion, "0.5.0") && + typedASTNode instanceof Identifier && + typedASTNode.vReferencedDeclaration instanceof VariableDeclaration && + typedASTNode.vReferencedDeclaration.vType !== undefined + ) { + const compType2 = variableDeclarationToTypeNode( + typedASTNode.vReferencedDeclaration + ); + + if ( + compType2 instanceof PointerType && + compType2.location === DataLocation.Default + ) { + continue; + } + + expect(eq(compType2, typeNode)).toBeTruthy(); + // Check that specialize and generalize are inverses + const [generalizedType, loc] = generalizeType(typeNode); + + const reSpecializedType = specializeType( + generalizedType, + loc === undefined ? DataLocation.Default : loc + ); + + expect(eq(typeNode, reSpecializedType)).toBeTruthy(); + } } } - } - }); + }); + } } }); diff --git a/test/utils/file.ts b/test/utils/file.ts new file mode 100644 index 00000000..2618acc7 --- /dev/null +++ b/test/utils/file.ts @@ -0,0 +1,28 @@ +import fse from "fs-extra"; +import path from "path"; + +export function searchRecursive(targetPath: string, filter: (entry: string) => boolean): string[] { + const stat = fse.statSync(targetPath); + const results: string[] = []; + + if (stat.isFile()) { + if (filter(targetPath)) { + results.push(path.resolve(targetPath)); + } + + return results; + } + + for (const entry of fse.readdirSync(targetPath)) { + const resolvedEntry = path.resolve(targetPath, entry); + const stat = fse.statSync(resolvedEntry); + + if (stat.isDirectory()) { + results.push(...searchRecursive(resolvedEntry, filter)); + } else if (stat.isFile() && filter(resolvedEntry)) { + results.push(resolvedEntry); + } + } + + return results; +} diff --git a/test/utils/index.ts b/test/utils/index.ts new file mode 100644 index 00000000..375123f7 --- /dev/null +++ b/test/utils/index.ts @@ -0,0 +1 @@ +export * from "./file";