mirror of
https://github.com/AleoHQ/leo.git
synced 2024-12-26 02:53:08 +03:00
resolve merge conflict, asg + grammar tests
This commit is contained in:
commit
26f9973e14
@ -1 +1 @@
|
||||
v1.1.8
|
||||
v1.2.0
|
199
Cargo.lock
generated
199
Cargo.lock
generated
@ -50,9 +50,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.37"
|
||||
version = "1.0.38"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ee67c11feeac938fae061b232e38e0b6d94f97a9df10e6271319325ac4c56a86"
|
||||
checksum = "afddf7f520a80dbf76e6f50a35bca42a2331ef227a28b3b6dc5c2e2338d114b1"
|
||||
|
||||
[[package]]
|
||||
name = "arrayref"
|
||||
@ -277,7 +277,7 @@ version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4b9434b9a5aa1450faa3f9cb14ea0e8c53bb5d2b3c1bfd1ab4fc03e9f33fbfb0"
|
||||
dependencies = [
|
||||
"rustc_version",
|
||||
"rustc_version 0.2.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -801,9 +801,18 @@ checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
|
||||
|
||||
[[package]]
|
||||
name = "futures"
|
||||
version = "0.1.30"
|
||||
version = "0.3.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4c7e4c2612746b0df8fed4ce0c69156021b704c9aefa360311c04e6e9e002eed"
|
||||
checksum = "9b3b0c040a1fe6529d30b3c5944b280c7f0dcb2930d2c3062bca967b602583d0"
|
||||
dependencies = [
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
"futures-executor",
|
||||
"futures-io",
|
||||
"futures-sink",
|
||||
"futures-task",
|
||||
"futures-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-channel"
|
||||
@ -812,6 +821,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4b7109687aa4e177ef6fe84553af6280ef2778bdb7783ba44c9dc3399110fe64"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-sink",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -820,12 +830,35 @@ version = "0.3.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "847ce131b72ffb13b6109a221da9ad97a64cbe48feb1028356b836b47b8f1748"
|
||||
|
||||
[[package]]
|
||||
name = "futures-executor"
|
||||
version = "0.3.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4caa2b2b68b880003057c1dd49f1ed937e38f22fcf6c212188a121f08cf40a65"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-task",
|
||||
"futures-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-io"
|
||||
version = "0.3.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "611834ce18aaa1bd13c4b374f5d653e1027cf99b6b502584ff8c9a64413b30bb"
|
||||
|
||||
[[package]]
|
||||
name = "futures-macro"
|
||||
version = "0.3.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "77408a692f1f97bcc61dc001d752e00643408fbc922e4d634c655df50d595556"
|
||||
dependencies = [
|
||||
"proc-macro-hack",
|
||||
"proc-macro2 1.0.24",
|
||||
"quote 1.0.7",
|
||||
"syn 1.0.60",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-sink"
|
||||
version = "0.3.8"
|
||||
@ -847,12 +880,17 @@ version = "0.3.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d304cff4a7b99cfb7986f7d43fbe93d175e72e704a8860787cc95e9ffd85cbd2"
|
||||
dependencies = [
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
"futures-io",
|
||||
"futures-macro",
|
||||
"futures-sink",
|
||||
"futures-task",
|
||||
"memchr",
|
||||
"pin-project 1.0.2",
|
||||
"pin-utils",
|
||||
"proc-macro-hack",
|
||||
"proc-macro-nested",
|
||||
"slab",
|
||||
]
|
||||
|
||||
@ -874,7 +912,7 @@ dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
"log",
|
||||
"rustc_version",
|
||||
"rustc_version 0.2.3",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
@ -1197,9 +1235,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "jsonrpc-core"
|
||||
version = "14.2.0"
|
||||
version = "17.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a0747307121ffb9703afd93afbd0fb4f854c38fb873f2c8b90e0e902f27c7b62"
|
||||
checksum = "07569945133257ff557eb37b015497104cea61a2c9edaf126c1cbd6e8332397f"
|
||||
dependencies = [
|
||||
"futures",
|
||||
"log",
|
||||
@ -1232,7 +1270,7 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
|
||||
|
||||
[[package]]
|
||||
name = "leo-asg"
|
||||
version = "1.1.8"
|
||||
version = "1.2.0"
|
||||
dependencies = [
|
||||
"criterion",
|
||||
"indexmap",
|
||||
@ -1247,7 +1285,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "leo-ast"
|
||||
version = "1.1.8"
|
||||
version = "1.2.0"
|
||||
dependencies = [
|
||||
"criterion",
|
||||
"indexmap",
|
||||
@ -1261,7 +1299,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "leo-compiler"
|
||||
version = "1.1.8"
|
||||
version = "1.2.0"
|
||||
dependencies = [
|
||||
"bincode",
|
||||
"hex",
|
||||
@ -1295,7 +1333,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "leo-gadgets"
|
||||
version = "1.1.8"
|
||||
version = "1.2.0"
|
||||
dependencies = [
|
||||
"criterion",
|
||||
"rand",
|
||||
@ -1308,7 +1346,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "leo-grammar"
|
||||
version = "1.1.8"
|
||||
version = "1.2.0"
|
||||
dependencies = [
|
||||
"criterion",
|
||||
"from-pest",
|
||||
@ -1324,7 +1362,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "leo-imports"
|
||||
version = "1.1.8"
|
||||
version = "1.2.0"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"leo-asg",
|
||||
@ -1336,7 +1374,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "leo-input"
|
||||
version = "1.1.8"
|
||||
version = "1.2.0"
|
||||
dependencies = [
|
||||
"from-pest",
|
||||
"pest",
|
||||
@ -1348,7 +1386,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "leo-lang"
|
||||
version = "1.1.8"
|
||||
version = "1.2.0"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"colored",
|
||||
@ -1387,11 +1425,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "leo-linter"
|
||||
version = "1.1.8"
|
||||
version = "1.2.0"
|
||||
|
||||
[[package]]
|
||||
name = "leo-package"
|
||||
version = "1.1.8"
|
||||
version = "1.2.0"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"serde",
|
||||
@ -1404,7 +1442,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "leo-state"
|
||||
version = "1.1.8"
|
||||
version = "1.2.0"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"leo-ast",
|
||||
@ -1996,6 +2034,50 @@ version = "0.2.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-crate"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785"
|
||||
dependencies = [
|
||||
"toml",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-error"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
|
||||
dependencies = [
|
||||
"proc-macro-error-attr",
|
||||
"proc-macro2 1.0.24",
|
||||
"quote 1.0.7",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-error-attr"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.24",
|
||||
"quote 1.0.7",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-hack"
|
||||
version = "0.5.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-nested"
|
||||
version = "0.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "0.4.30"
|
||||
@ -2261,6 +2343,15 @@ dependencies = [
|
||||
"semver 0.9.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc_version"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee"
|
||||
dependencies = [
|
||||
"semver 0.11.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rusty-hook"
|
||||
version = "0.11.2"
|
||||
@ -2451,9 +2542,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "sha2"
|
||||
version = "0.9.2"
|
||||
version = "0.9.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6e7aab86fe2149bad8c507606bdb3f4ef5e7b2380eb92350f56122cca72a42a8"
|
||||
checksum = "fa827a14b29ab7f44778d14a88d3cb76e949c45083f7dbfa507d0cb699dc12de"
|
||||
dependencies = [
|
||||
"block-buffer 0.9.0",
|
||||
"cfg-if 1.0.0",
|
||||
@ -2495,20 +2586,20 @@ checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
|
||||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
version = "1.5.1"
|
||||
version = "1.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ae524f056d7d770e174287294f562e95044c68e88dec909a00d2094805db9d75"
|
||||
checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e"
|
||||
|
||||
[[package]]
|
||||
name = "snarkvm-algorithms"
|
||||
version = "0.0.2"
|
||||
version = "0.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bdc4273884a3c5b1858e9ccb3dd6d7acfa60c0c38bb4876aeeb3181936dbe5f3"
|
||||
checksum = "ceb01228059c36bb95507d1df131dea4e7b600c87ac26dc66c07a651d8a03f6e"
|
||||
dependencies = [
|
||||
"blake2",
|
||||
"derivative",
|
||||
"digest 0.8.1",
|
||||
"itertools 0.9.0",
|
||||
"itertools 0.10.0",
|
||||
"rand",
|
||||
"rand_chacha",
|
||||
"rayon",
|
||||
@ -2522,14 +2613,14 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "snarkvm-curves"
|
||||
version = "0.0.2"
|
||||
version = "0.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "57c0ab5c370fa0e394acc14474ce0ed162ca673e87ac496e733d402b5c71f177"
|
||||
checksum = "e7f9bb31389dce334a6c0c5855829afbb1e4469c4c03143e167c5353ccb1e307"
|
||||
dependencies = [
|
||||
"derivative",
|
||||
"rand",
|
||||
"rand_xorshift",
|
||||
"rustc_version",
|
||||
"rustc_version 0.3.3",
|
||||
"serde",
|
||||
"snarkvm-errors",
|
||||
"snarkvm-models",
|
||||
@ -2538,10 +2629,12 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "snarkvm-derives"
|
||||
version = "0.0.2"
|
||||
version = "0.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b74eecab3b4bbcef183819fb414ad3498b6c962f21a41a2afaf73af2822eec98"
|
||||
checksum = "1ccaf7047e41bc356a3af8257e9ffe13a5b619c9f51278c019d5201790ddd677"
|
||||
dependencies = [
|
||||
"proc-macro-crate",
|
||||
"proc-macro-error",
|
||||
"proc-macro2 1.0.24",
|
||||
"quote 1.0.7",
|
||||
"syn 1.0.60",
|
||||
@ -2549,15 +2642,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "snarkvm-dpc"
|
||||
version = "0.0.2"
|
||||
version = "0.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2a3bbd6dcb0e100d514fa0f8cfb2fd8e0422660d5d816a47409d8111c536dddc"
|
||||
checksum = "ea20c9a289304d22755ddfc644e164e1232f41ebe016edc8bf7f0007b828b92d"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"blake2",
|
||||
"derivative",
|
||||
"hex",
|
||||
"itertools 0.9.0",
|
||||
"itertools 0.10.0",
|
||||
"rand",
|
||||
"snarkvm-algorithms",
|
||||
"snarkvm-curves",
|
||||
@ -2572,9 +2665,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "snarkvm-errors"
|
||||
version = "0.0.2"
|
||||
version = "0.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c7b46326076d2797280a335f6a4c3538e5ba57db37704233e55134b3e1ab2e79"
|
||||
checksum = "4dcff02240b6b5b36f47953ea9be5c29aef109164b0cebd84e7260ef7bf67f6c"
|
||||
dependencies = [
|
||||
"base58",
|
||||
"bech32",
|
||||
@ -2589,13 +2682,13 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "snarkvm-gadgets"
|
||||
version = "0.0.2"
|
||||
version = "0.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "12ec20358b56a972bf280690ace5e5c1ba809e4cd31d31932f0bd15491f9be0d"
|
||||
checksum = "e5692f39b5b9351b6584e1f9a2739b13d82e5a4a74a074eb0b743e9d7583fdb5"
|
||||
dependencies = [
|
||||
"derivative",
|
||||
"digest 0.8.1",
|
||||
"itertools 0.9.0",
|
||||
"itertools 0.10.0",
|
||||
"snarkvm-algorithms",
|
||||
"snarkvm-curves",
|
||||
"snarkvm-errors",
|
||||
@ -2605,17 +2698,17 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "snarkvm-models"
|
||||
version = "0.0.2"
|
||||
version = "0.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ae6d7532cfc6b888e8566e05e62384c4c7103fa3036555c54b98726fba4bb100"
|
||||
checksum = "e622885901322b1d2b26c1bc8d94a717df1e83672cbc41a16f2afc4d2702afab"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bincode",
|
||||
"cfg-if 0.1.10",
|
||||
"cfg-if 1.0.0",
|
||||
"derivative",
|
||||
"fxhash",
|
||||
"indexmap",
|
||||
"itertools 0.9.0",
|
||||
"itertools 0.10.0",
|
||||
"rand",
|
||||
"rand_xorshift",
|
||||
"serde",
|
||||
@ -2625,9 +2718,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "snarkvm-objects"
|
||||
version = "0.0.2"
|
||||
version = "0.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cd3ca38c2a7744f4dca2bdae9441da634b06f40f762323c9e361d6a2582f3353"
|
||||
checksum = "cd47dd986ba53600dd5762c72214250b37af114720dc494770114e9bf8281819"
|
||||
dependencies = [
|
||||
"base58",
|
||||
"bech32",
|
||||
@ -2647,9 +2740,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "snarkvm-parameters"
|
||||
version = "0.0.2"
|
||||
version = "0.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "02a6590e3860f1dc78335a2ef498b21cffa4655de4cfb7cc9027d29b1093d887"
|
||||
checksum = "dd0e2f9bdbce0750aa0def386e4324f278c7e0d58cfbdb42128c03d246c862f4"
|
||||
dependencies = [
|
||||
"curl",
|
||||
"hex",
|
||||
@ -2661,15 +2754,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "snarkvm-profiler"
|
||||
version = "0.0.2"
|
||||
version = "0.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ed9ec5eadd049ee06e676070d5402401373fe278a42b515141a9b14ca86a795a"
|
||||
checksum = "d5f9c37df04e66b18ef0c4a69861eaf1f83170f1e71509e208d6006c20e65b91"
|
||||
|
||||
[[package]]
|
||||
name = "snarkvm-storage"
|
||||
version = "0.0.2"
|
||||
version = "0.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cbf798e9883014175e2f019f019fc4db1756cf7d57408602315b270b93992258"
|
||||
checksum = "1cb4f7e299b888749224eada35624347e4c99d2e5972c1c416d2d18e005fe23b"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bincode",
|
||||
@ -2689,9 +2782,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "snarkvm-utilities"
|
||||
version = "0.0.2"
|
||||
version = "0.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d78a4a12c67cc013d6a9574f3231aaf915589cebfd38d27d5f8ad24f1be5794f"
|
||||
checksum = "e7518dfe2e8dc37beeaf3131ef5c77e4e9818843e6c33e7b665240dc8ec805b1"
|
||||
dependencies = [
|
||||
"bincode",
|
||||
"rand",
|
||||
|
32
Cargo.toml
32
Cargo.toml
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "leo-lang"
|
||||
version = "1.1.8"
|
||||
version = "1.2.0"
|
||||
authors = [ "The Aleo Team <hello@aleo.org>" ]
|
||||
description = "The Leo programming language"
|
||||
homepage = "https://aleo.org"
|
||||
@ -26,6 +26,7 @@ path = "leo/main.rs"
|
||||
|
||||
[workspace]
|
||||
members = [
|
||||
"asg",
|
||||
"ast",
|
||||
"compiler",
|
||||
"gadgets",
|
||||
@ -34,60 +35,59 @@ members = [
|
||||
"input",
|
||||
"linter",
|
||||
"package",
|
||||
"state",
|
||||
"asg"
|
||||
"state"
|
||||
]
|
||||
|
||||
[dependencies.leo-ast]
|
||||
path = "./ast"
|
||||
version = "1.1.8"
|
||||
version = "1.2.0"
|
||||
|
||||
[dependencies.leo-compiler]
|
||||
path = "./compiler"
|
||||
version = "1.1.8"
|
||||
version = "1.2.0"
|
||||
|
||||
[dependencies.leo-gadgets]
|
||||
path = "./gadgets"
|
||||
version = "1.1.8"
|
||||
version = "1.2.0"
|
||||
|
||||
[dependencies.leo-imports]
|
||||
path = "./imports"
|
||||
version = "1.1.8"
|
||||
version = "1.2.0"
|
||||
|
||||
[dependencies.leo-input]
|
||||
path = "./input"
|
||||
version = "1.1.8"
|
||||
version = "1.2.0"
|
||||
|
||||
[dependencies.leo-package]
|
||||
path = "./package"
|
||||
version = "1.1.8"
|
||||
version = "1.2.0"
|
||||
|
||||
[dependencies.leo-state]
|
||||
path = "./state"
|
||||
version = "1.1.8"
|
||||
version = "1.2.0"
|
||||
|
||||
[dependencies.snarkvm-algorithms]
|
||||
version = "0.0.2"
|
||||
version = "0.0.3"
|
||||
default-features = false
|
||||
|
||||
[dependencies.snarkvm-curves]
|
||||
version = "0.0.2"
|
||||
version = "0.0.3"
|
||||
default-features = false
|
||||
|
||||
[dependencies.snarkvm-errors]
|
||||
version = "0.0.2"
|
||||
version = "0.0.3"
|
||||
default-features = false
|
||||
|
||||
[dependencies.snarkvm-gadgets]
|
||||
version = "0.0.2"
|
||||
version = "0.0.3"
|
||||
default-features = false
|
||||
|
||||
[dependencies.snarkvm-models]
|
||||
version = "0.0.2"
|
||||
version = "0.0.3"
|
||||
default-features = false
|
||||
|
||||
[dependencies.snarkvm-utilities]
|
||||
version = "0.0.2"
|
||||
version = "0.0.3"
|
||||
|
||||
[dependencies.clap]
|
||||
version = "2.33.3"
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "leo-asg"
|
||||
version = "1.1.8"
|
||||
version = "1.2.0"
|
||||
authors = [ "The Aleo Team <hello@aleo.org>" ]
|
||||
description = "ASG of the Leo programming language"
|
||||
homepage = "https://aleo.org"
|
||||
@ -30,11 +30,11 @@ version = "1.6"
|
||||
version = "1.0"
|
||||
|
||||
[dependencies.leo-ast]
|
||||
version = "1.1"
|
||||
version = "1.2.0"
|
||||
path = "../ast"
|
||||
|
||||
[dependencies.leo-grammar]
|
||||
version = "1.1"
|
||||
version = "1.2.0"
|
||||
path = "../grammar"
|
||||
|
||||
[dependencies.uuid]
|
||||
|
@ -22,6 +22,7 @@ use std::{
|
||||
sync::{Arc, Weak},
|
||||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ArrayAccessExpression {
|
||||
pub parent: RefCell<Option<Weak<Expression>>>,
|
||||
pub span: Option<Span>,
|
||||
|
@ -21,6 +21,7 @@ use std::{
|
||||
sync::{Arc, Weak},
|
||||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ArrayInitExpression {
|
||||
pub parent: RefCell<Option<Weak<Expression>>>,
|
||||
pub span: Option<Span>,
|
||||
|
@ -22,6 +22,7 @@ use std::{
|
||||
sync::{Arc, Weak},
|
||||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ArrayInlineExpression {
|
||||
pub parent: RefCell<Option<Weak<Expression>>>,
|
||||
pub span: Option<Span>,
|
||||
|
@ -22,6 +22,7 @@ use std::{
|
||||
sync::{Arc, Weak},
|
||||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ArrayRangeAccessExpression {
|
||||
pub parent: RefCell<Option<Weak<Expression>>>,
|
||||
pub span: Option<Span>,
|
||||
|
@ -22,6 +22,7 @@ use std::{
|
||||
sync::{Arc, Weak},
|
||||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct BinaryExpression {
|
||||
pub parent: RefCell<Option<Weak<Expression>>>,
|
||||
pub span: Option<Span>,
|
||||
|
@ -29,13 +29,14 @@ use crate::{
|
||||
Span,
|
||||
Type,
|
||||
};
|
||||
pub use leo_ast::BinaryOperation;
|
||||
pub use leo_ast::{BinaryOperation, Node as AstNode};
|
||||
|
||||
use std::{
|
||||
cell::RefCell,
|
||||
sync::{Arc, Weak},
|
||||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct CallExpression {
|
||||
pub parent: RefCell<Option<Weak<Expression>>>,
|
||||
pub span: Option<Span>,
|
||||
@ -194,25 +195,33 @@ impl FromAst<leo_ast::CallExpression> for CallExpression {
|
||||
));
|
||||
}
|
||||
}
|
||||
if value.arguments.len() != function.argument_types.len() {
|
||||
if value.arguments.len() != function.arguments.len() {
|
||||
return Err(AsgConvertError::unexpected_call_argument_count(
|
||||
function.argument_types.len(),
|
||||
function.arguments.len(),
|
||||
value.arguments.len(),
|
||||
&value.span,
|
||||
));
|
||||
}
|
||||
|
||||
let arguments = value
|
||||
.arguments
|
||||
.iter()
|
||||
.zip(function.arguments.iter())
|
||||
.map(|(expr, argument)| {
|
||||
let argument = argument.borrow();
|
||||
let converted =
|
||||
Arc::<Expression>::from_ast(scope, expr, Some(argument.type_.clone().strong().partial()))?;
|
||||
if argument.const_ && !converted.is_consty() {
|
||||
return Err(AsgConvertError::unexpected_nonconst(&expr.span()));
|
||||
}
|
||||
Ok(converted)
|
||||
})
|
||||
.collect::<Result<Vec<_>, AsgConvertError>>()?;
|
||||
|
||||
Ok(CallExpression {
|
||||
parent: RefCell::new(None),
|
||||
span: Some(value.span.clone()),
|
||||
arguments: value
|
||||
.arguments
|
||||
.iter()
|
||||
.zip(function.argument_types.iter())
|
||||
.map(|(expr, argument)| {
|
||||
Arc::<Expression>::from_ast(scope, expr, Some(argument.clone().strong().partial()))
|
||||
})
|
||||
.collect::<Result<Vec<_>, AsgConvertError>>()?,
|
||||
arguments,
|
||||
function,
|
||||
target,
|
||||
})
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{
|
||||
AsgConvertError,
|
||||
Circuit,
|
||||
@ -52,6 +36,7 @@ use std::{
|
||||
sync::{Arc, Weak},
|
||||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct CircuitAccessExpression {
|
||||
pub parent: RefCell<Option<Weak<Expression>>>,
|
||||
pub span: Option<Span>,
|
||||
|
@ -36,6 +36,7 @@ use std::{
|
||||
sync::{Arc, Weak},
|
||||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct CircuitInitExpression {
|
||||
pub parent: RefCell<Option<Weak<Expression>>>,
|
||||
pub span: Option<Span>,
|
||||
@ -166,7 +167,7 @@ impl Into<leo_ast::CircuitInitExpression> for &CircuitInitExpression {
|
||||
members: self
|
||||
.values
|
||||
.iter()
|
||||
.map(|(name, value)| leo_ast::CircuitVariableDefinition {
|
||||
.map(|(name, value)| leo_ast::CircuitImpliedVariableDefinition {
|
||||
identifier: name.clone(),
|
||||
expression: value.as_ref().into(),
|
||||
})
|
||||
|
@ -34,6 +34,7 @@ use std::{
|
||||
sync::{Arc, Weak},
|
||||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Constant {
|
||||
pub parent: RefCell<Option<Weak<Expression>>>,
|
||||
pub span: Option<Span>,
|
||||
@ -173,6 +174,11 @@ impl FromAst<leo_ast::ValueExpression> for Constant {
|
||||
span: Some(span.clone()),
|
||||
value: ConstValue::Field(value.parse().map_err(|_| AsgConvertError::invalid_int(&value, span))?),
|
||||
},
|
||||
Some(PartialType::Type(Type::Group)) => Constant {
|
||||
parent: RefCell::new(None),
|
||||
span: Some(span.clone()),
|
||||
value: ConstValue::Group(GroupValue::Single(value.to_string())),
|
||||
},
|
||||
Some(PartialType::Type(Type::Address)) => Constant {
|
||||
parent: RefCell::new(None),
|
||||
span: Some(span.clone()),
|
||||
|
@ -66,6 +66,7 @@ use crate::{AsgConvertError, ConstValue, FromAst, Node, PartialType, Scope, Span
|
||||
|
||||
use std::sync::{Arc, Weak};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum Expression {
|
||||
VariableRef(VariableRef),
|
||||
Constant(Constant),
|
||||
|
@ -21,6 +21,7 @@ use std::{
|
||||
sync::{Arc, Weak},
|
||||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct TernaryExpression {
|
||||
pub parent: RefCell<Option<Weak<Expression>>>,
|
||||
pub span: Option<Span>,
|
||||
|
@ -21,6 +21,7 @@ use std::{
|
||||
sync::{Arc, Weak},
|
||||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct TupleAccessExpression {
|
||||
pub parent: RefCell<Option<Weak<Expression>>>,
|
||||
pub span: Option<Span>,
|
||||
|
@ -21,6 +21,7 @@ use std::{
|
||||
sync::{Arc, Weak},
|
||||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct TupleInitExpression {
|
||||
pub parent: RefCell<Option<Weak<Expression>>>,
|
||||
pub span: Option<Span>,
|
||||
|
@ -22,6 +22,7 @@ use std::{
|
||||
sync::{Arc, Weak},
|
||||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct UnaryExpression {
|
||||
pub parent: RefCell<Option<Weak<Expression>>>,
|
||||
pub span: Option<Span>,
|
||||
|
@ -29,7 +29,6 @@ use crate::{
|
||||
Statement,
|
||||
Type,
|
||||
Variable,
|
||||
VariableDeclaration,
|
||||
};
|
||||
|
||||
use std::{
|
||||
@ -37,6 +36,7 @@ use std::{
|
||||
sync::{Arc, Weak},
|
||||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct VariableRef {
|
||||
pub parent: RefCell<Option<Weak<Expression>>>,
|
||||
pub span: Option<Span>,
|
||||
@ -61,7 +61,7 @@ impl ExpressionNode for VariableRef {
|
||||
fn enforce_parents(&self, _expr: &Arc<Expression>) {}
|
||||
|
||||
fn get_type(&self) -> Option<Type> {
|
||||
Some(self.variable.borrow().type_.clone())
|
||||
Some(self.variable.borrow().type_.clone().strong())
|
||||
}
|
||||
|
||||
fn is_mut_ref(&self) -> bool {
|
||||
@ -103,7 +103,7 @@ impl ExpressionNode for VariableRef {
|
||||
|
||||
fn is_consty(&self) -> bool {
|
||||
let variable = self.variable.borrow();
|
||||
if variable.declaration == VariableDeclaration::IterationDefinition {
|
||||
if variable.const_ {
|
||||
return true;
|
||||
}
|
||||
if variable.mutable || variable.assignments.len() != 1 {
|
||||
|
@ -23,7 +23,7 @@ use std::{
|
||||
};
|
||||
|
||||
/// Stores program input values as asg nodes.
|
||||
#[derive(Clone)]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Input {
|
||||
pub registers: Arc<CircuitBody>,
|
||||
pub state: Arc<CircuitBody>,
|
||||
@ -127,8 +127,9 @@ impl Input {
|
||||
container: Arc::new(RefCell::new(crate::InnerVariable {
|
||||
id: uuid::Uuid::new_v4(),
|
||||
name: Identifier::new("input".to_string()),
|
||||
type_: Type::Circuit(container_circuit),
|
||||
type_: Type::Circuit(container_circuit).weak(),
|
||||
mutable: false,
|
||||
const_: false,
|
||||
declaration: crate::VariableDeclaration::Input,
|
||||
references: vec![],
|
||||
assignments: vec![],
|
||||
|
@ -67,9 +67,9 @@ pub use type_::*;
|
||||
pub mod variable;
|
||||
pub use variable::*;
|
||||
|
||||
pub use leo_ast::{Identifier, Span};
|
||||
pub use leo_ast::{Ast, Identifier, Span};
|
||||
|
||||
use std::path::Path;
|
||||
use std::{cell::RefCell, path::Path, sync::Arc};
|
||||
|
||||
/// The abstract semantic graph (ASG) for a Leo program.
|
||||
///
|
||||
@ -77,42 +77,41 @@ use std::path::Path;
|
||||
/// These data types form a graph that begins from a [`Program`] type node.
|
||||
///
|
||||
/// A new [`Asg`] can be created from an [`Ast`] generated in the `ast` module.
|
||||
// #[derive(Debug, Eq, PartialEq)]
|
||||
// pub struct Asg {
|
||||
// asg: InnerProgram,
|
||||
// }
|
||||
//
|
||||
// impl Asg {
|
||||
// /// Creates a new asg from a given ast tree and import resolver.
|
||||
// pub fn new<T: ImportResolver + 'static>(
|
||||
// content: leo_ast::Program,
|
||||
// resolver: &mut T,
|
||||
// ) -> Result<Program, AsgConvertError> {
|
||||
// InnerProgram::new(&content, resolver)
|
||||
// }
|
||||
//
|
||||
// /// Returns a reference to the inner program ast representation.
|
||||
// pub fn into_repr(self) -> Program {
|
||||
// self.asg
|
||||
// }
|
||||
// }
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Asg {
|
||||
asg: Arc<RefCell<InternalProgram>>,
|
||||
}
|
||||
|
||||
pub fn load_ast<T: AsRef<Path>, Y: AsRef<str>>(path: T, content: Y) -> Result<leo_ast::Program, AsgConvertError> {
|
||||
impl Asg {
|
||||
/// Creates a new ASG from a given AST and import resolver.
|
||||
pub fn new<T: ImportResolver + 'static>(ast: &Ast, resolver: &mut T) -> Result<Self, AsgConvertError> {
|
||||
Ok(Self {
|
||||
asg: InternalProgram::new(&ast.as_repr(), resolver)?,
|
||||
})
|
||||
}
|
||||
|
||||
/// Returns the internal program ASG representation.
|
||||
pub fn as_repr(&self) -> Arc<RefCell<InternalProgram>> {
|
||||
self.asg.clone()
|
||||
}
|
||||
|
||||
// /// Serializes the ast into a JSON string.
|
||||
// pub fn to_json_string(&self) -> Result<String, serde_json::Error> {
|
||||
// serde_json::to_string_pretty(&self.asg)
|
||||
// }
|
||||
//
|
||||
// /// Deserializes the JSON string into a ast.
|
||||
// pub fn from_json_string(json: &str) -> Result<Self, serde_json::Error> {
|
||||
// let ast: Program = serde_json::from_str(json)?;
|
||||
// Ok(Self { ast })
|
||||
// }
|
||||
}
|
||||
|
||||
// TODO (howardwu): Remove this.
|
||||
pub fn load_asg<T: ImportResolver + 'static>(content: &str, resolver: &mut T) -> Result<Program, AsgConvertError> {
|
||||
// Parses the Leo file and constructs a grammar ast.
|
||||
let ast = leo_grammar::Grammar::new(path.as_ref(), content.as_ref())
|
||||
let ast = leo_grammar::Grammar::new(&Path::new("input.leo"), content)
|
||||
.map_err(|e| AsgConvertError::InternalError(format!("ast: {:?}", e)))?;
|
||||
|
||||
// Parses the pest ast and constructs a Leo ast.
|
||||
Ok(leo_ast::Ast::new("load_ast", &ast)?.into_repr())
|
||||
}
|
||||
|
||||
pub fn load_asg_from_ast<T: ImportResolver + 'static>(
|
||||
content: leo_ast::Program,
|
||||
resolver: &mut T,
|
||||
) -> Result<Program, AsgConvertError> {
|
||||
InnerProgram::new(&content, resolver)
|
||||
}
|
||||
|
||||
pub fn load_asg<T: ImportResolver + 'static>(content: &str, resolver: &mut T) -> Result<Program, AsgConvertError> {
|
||||
InnerProgram::new(&load_ast("input.leo", content)?, resolver)
|
||||
InternalProgram::new(leo_ast::Ast::new("load_ast", &ast)?.as_repr(), resolver)
|
||||
}
|
||||
|
@ -14,12 +14,12 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
//todo: we should merge this with core
|
||||
// TODO (protryon): We should merge this with core
|
||||
|
||||
use crate::{AsgConvertError, Program};
|
||||
|
||||
// todo: make asg deep copy so we can cache resolved core modules
|
||||
// todo: figure out how to do headers without bogus returns
|
||||
// TODO (protryon): Make asg deep copy so we can cache resolved core modules
|
||||
// TODO (protryon): Figure out how to do headers without bogus returns
|
||||
|
||||
pub fn resolve_core_module(module: &str) -> Result<Option<Program>, AsgConvertError> {
|
||||
match module {
|
||||
|
@ -23,16 +23,19 @@ use std::{
|
||||
};
|
||||
use uuid::Uuid;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum CircuitMemberBody {
|
||||
Variable(Type),
|
||||
Function(Arc<FunctionBody>),
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum CircuitMember {
|
||||
Variable(WeakType),
|
||||
Function(Arc<Function>),
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Circuit {
|
||||
pub id: Uuid,
|
||||
pub name: RefCell<Identifier>,
|
||||
@ -51,6 +54,7 @@ impl PartialEq for Circuit {
|
||||
}
|
||||
impl Eq for Circuit {}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct CircuitBody {
|
||||
pub scope: Scope,
|
||||
pub span: Option<Span>,
|
||||
|
@ -38,19 +38,20 @@ use std::{
|
||||
};
|
||||
use uuid::Uuid;
|
||||
|
||||
#[derive(PartialEq)]
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum FunctionQualifier {
|
||||
SelfRef,
|
||||
MutSelfRef,
|
||||
Static,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Function {
|
||||
pub id: Uuid,
|
||||
pub name: RefCell<Identifier>,
|
||||
pub output: WeakType,
|
||||
pub has_input: bool,
|
||||
pub argument_types: Vec<WeakType>,
|
||||
pub arguments: Vec<Variable>,
|
||||
pub circuit: RefCell<Option<Weak<Circuit>>>,
|
||||
pub body: RefCell<Weak<FunctionBody>>,
|
||||
pub qualifier: FunctionQualifier,
|
||||
@ -66,10 +67,10 @@ impl PartialEq for Function {
|
||||
}
|
||||
impl Eq for Function {}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct FunctionBody {
|
||||
pub span: Option<Span>,
|
||||
pub function: Arc<Function>,
|
||||
pub arguments: Vec<Variable>,
|
||||
pub body: Arc<Statement>,
|
||||
pub scope: Scope,
|
||||
}
|
||||
@ -92,7 +93,7 @@ impl Function {
|
||||
let mut qualifier = FunctionQualifier::Static;
|
||||
let mut has_input = false;
|
||||
|
||||
let mut argument_types = vec![];
|
||||
let mut arguments = vec![];
|
||||
{
|
||||
for input in value.input.iter() {
|
||||
match input {
|
||||
@ -105,8 +106,24 @@ impl Function {
|
||||
FunctionInput::MutSelfKeyword(_) => {
|
||||
qualifier = FunctionQualifier::MutSelfRef;
|
||||
}
|
||||
FunctionInput::Variable(leo_ast::FunctionInputVariable { type_, .. }) => {
|
||||
argument_types.push(scope.borrow().resolve_ast_type(&type_)?.into());
|
||||
FunctionInput::Variable(leo_ast::FunctionInputVariable {
|
||||
identifier,
|
||||
mutable,
|
||||
const_,
|
||||
type_,
|
||||
span: _span,
|
||||
}) => {
|
||||
let variable = Arc::new(RefCell::new(crate::InnerVariable {
|
||||
id: Uuid::new_v4(),
|
||||
name: identifier.clone(),
|
||||
type_: scope.borrow().resolve_ast_type(&type_)?.weak(),
|
||||
mutable: *mutable,
|
||||
const_: *const_,
|
||||
declaration: crate::VariableDeclaration::Parameter,
|
||||
references: vec![],
|
||||
assignments: vec![],
|
||||
}));
|
||||
arguments.push(variable.clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -119,7 +136,7 @@ impl Function {
|
||||
name: RefCell::new(value.identifier.clone()),
|
||||
output: output.into(),
|
||||
has_input,
|
||||
argument_types,
|
||||
arguments,
|
||||
circuit: RefCell::new(None),
|
||||
body: RefCell::new(Weak::new()),
|
||||
qualifier,
|
||||
@ -134,7 +151,6 @@ impl FunctionBody {
|
||||
function: Arc<Function>,
|
||||
) -> Result<FunctionBody, AsgConvertError> {
|
||||
let new_scope = InnerScope::make_subscope(scope);
|
||||
let mut arguments = vec![];
|
||||
{
|
||||
let mut scope_borrow = new_scope.borrow_mut();
|
||||
if function.qualifier != FunctionQualifier::Static {
|
||||
@ -142,8 +158,9 @@ impl FunctionBody {
|
||||
let self_variable = Arc::new(RefCell::new(crate::InnerVariable {
|
||||
id: Uuid::new_v4(),
|
||||
name: Identifier::new("self".to_string()),
|
||||
type_: Type::Circuit(circuit.as_ref().unwrap().upgrade().unwrap()),
|
||||
type_: WeakType::Circuit(circuit.as_ref().unwrap().clone()),
|
||||
mutable: function.qualifier == FunctionQualifier::MutSelfRef,
|
||||
const_: false,
|
||||
declaration: crate::VariableDeclaration::Parameter,
|
||||
references: vec![],
|
||||
assignments: vec![],
|
||||
@ -151,30 +168,9 @@ impl FunctionBody {
|
||||
scope_borrow.variables.insert("self".to_string(), self_variable);
|
||||
}
|
||||
scope_borrow.function = Some(function.clone());
|
||||
for input in value.input.iter() {
|
||||
match input {
|
||||
FunctionInput::InputKeyword(_) => {}
|
||||
FunctionInput::SelfKeyword(_) => {}
|
||||
FunctionInput::MutSelfKeyword(_) => {}
|
||||
FunctionInput::Variable(leo_ast::FunctionInputVariable {
|
||||
identifier,
|
||||
mutable,
|
||||
type_,
|
||||
span: _span,
|
||||
}) => {
|
||||
let variable = Arc::new(RefCell::new(crate::InnerVariable {
|
||||
id: Uuid::new_v4(),
|
||||
name: identifier.clone(),
|
||||
type_: scope_borrow.resolve_ast_type(&type_)?,
|
||||
mutable: *mutable,
|
||||
declaration: crate::VariableDeclaration::Parameter,
|
||||
references: vec![],
|
||||
assignments: vec![],
|
||||
}));
|
||||
arguments.push(variable.clone());
|
||||
scope_borrow.variables.insert(identifier.name.clone(), variable);
|
||||
}
|
||||
}
|
||||
for argument in function.arguments.iter() {
|
||||
let name = argument.borrow().name.name.clone();
|
||||
scope_borrow.variables.insert(name, argument.clone());
|
||||
}
|
||||
}
|
||||
let main_block = BlockStatement::from_ast(&new_scope, &value.block, None)?;
|
||||
@ -198,7 +194,6 @@ impl FunctionBody {
|
||||
Ok(FunctionBody {
|
||||
span: Some(value.span.clone()),
|
||||
function,
|
||||
arguments,
|
||||
body: Arc::new(Statement::Block(main_block)),
|
||||
scope: new_scope,
|
||||
})
|
||||
@ -209,14 +204,16 @@ impl Into<leo_ast::Function> for &Function {
|
||||
fn into(self) -> leo_ast::Function {
|
||||
let (input, body, span) = match self.body.borrow().upgrade() {
|
||||
Some(body) => (
|
||||
body.arguments
|
||||
body.function
|
||||
.arguments
|
||||
.iter()
|
||||
.map(|variable| {
|
||||
let variable = variable.borrow();
|
||||
leo_ast::FunctionInput::Variable(leo_ast::FunctionInputVariable {
|
||||
identifier: variable.name.clone(),
|
||||
mutable: variable.mutable,
|
||||
type_: (&variable.type_).into(),
|
||||
const_: variable.const_,
|
||||
type_: (&variable.type_.clone().strong()).into(),
|
||||
span: Span::default(),
|
||||
})
|
||||
})
|
||||
|
@ -32,8 +32,8 @@ use std::{cell::RefCell, sync::Arc};
|
||||
use uuid::Uuid;
|
||||
|
||||
/// Stores the Leo program abstract semantic graph (ASG).
|
||||
#[derive(Clone)]
|
||||
pub struct InnerProgram {
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct InternalProgram {
|
||||
/// The unique id of the program.
|
||||
pub id: Uuid,
|
||||
|
||||
@ -57,7 +57,7 @@ pub struct InnerProgram {
|
||||
pub scope: Scope,
|
||||
}
|
||||
|
||||
pub type Program = Arc<RefCell<InnerProgram>>;
|
||||
pub type Program = Arc<RefCell<InternalProgram>>;
|
||||
|
||||
/// Enumerates what names are imported from a package.
|
||||
enum ImportSymbol {
|
||||
@ -120,22 +120,22 @@ fn resolve_import_package_access(
|
||||
}
|
||||
}
|
||||
|
||||
impl InnerProgram {
|
||||
/// Returns a new Leo program asg from the given Leo program ast and imports.
|
||||
impl InternalProgram {
|
||||
/// Returns a new Leo program ASG from the given Leo program AST and its imports.
|
||||
///
|
||||
/// stages:
|
||||
/// Stages:
|
||||
/// 1. resolve imports into super scope
|
||||
/// 2. finalize declared types
|
||||
/// 3. finalize declared functions
|
||||
/// 4. resolve all asg nodes
|
||||
///
|
||||
pub fn new<T: ImportResolver + 'static>(
|
||||
value: &leo_ast::Program,
|
||||
program: &leo_ast::Program,
|
||||
import_resolver: &mut T,
|
||||
) -> Result<Program, AsgConvertError> {
|
||||
// Recursively extract imported symbols.
|
||||
let mut imported_symbols: Vec<(Vec<String>, ImportSymbol, Span)> = vec![];
|
||||
for import in value.imports.iter() {
|
||||
for import in program.imports.iter() {
|
||||
resolve_import_package(&mut imported_symbols, vec![], &import.package_type);
|
||||
}
|
||||
|
||||
@ -223,7 +223,7 @@ impl InnerProgram {
|
||||
|
||||
// Prepare header-like scope entries.
|
||||
let mut proto_circuits = IndexMap::new();
|
||||
for (name, circuit) in value.circuits.iter() {
|
||||
for (name, circuit) in program.circuits.iter() {
|
||||
assert_eq!(name.name, circuit.circuit_name.name);
|
||||
let asg_circuit = Circuit::init(circuit);
|
||||
|
||||
@ -244,7 +244,7 @@ impl InnerProgram {
|
||||
function: None,
|
||||
}));
|
||||
|
||||
for (name, circuit) in value.circuits.iter() {
|
||||
for (name, circuit) in program.circuits.iter() {
|
||||
assert_eq!(name.name, circuit.circuit_name.name);
|
||||
let asg_circuit = proto_circuits.get(&name.name).unwrap();
|
||||
|
||||
@ -252,7 +252,7 @@ impl InnerProgram {
|
||||
}
|
||||
|
||||
let mut proto_test_functions = IndexMap::new();
|
||||
for (name, test_function) in value.tests.iter() {
|
||||
for (name, test_function) in program.tests.iter() {
|
||||
assert_eq!(name.name, test_function.function.identifier.name);
|
||||
let function = Arc::new(Function::from_ast(&scope, &test_function.function)?);
|
||||
|
||||
@ -260,7 +260,7 @@ impl InnerProgram {
|
||||
}
|
||||
|
||||
let mut proto_functions = IndexMap::new();
|
||||
for (name, function) in value.functions.iter() {
|
||||
for (name, function) in program.functions.iter() {
|
||||
assert_eq!(name.name, function.identifier.name);
|
||||
let asg_function = Arc::new(Function::from_ast(&scope, function)?);
|
||||
|
||||
@ -273,7 +273,7 @@ impl InnerProgram {
|
||||
|
||||
// Load concrete definitions.
|
||||
let mut test_functions = IndexMap::new();
|
||||
for (name, test_function) in value.tests.iter() {
|
||||
for (name, test_function) in program.tests.iter() {
|
||||
assert_eq!(name.name, test_function.function.identifier.name);
|
||||
let function = proto_test_functions.get(&name.name).unwrap();
|
||||
|
||||
@ -288,7 +288,7 @@ impl InnerProgram {
|
||||
}
|
||||
|
||||
let mut functions = IndexMap::new();
|
||||
for (name, function) in value.functions.iter() {
|
||||
for (name, function) in program.functions.iter() {
|
||||
assert_eq!(name.name, function.identifier.name);
|
||||
let asg_function = proto_functions.get(&name.name).unwrap();
|
||||
|
||||
@ -299,7 +299,7 @@ impl InnerProgram {
|
||||
}
|
||||
|
||||
let mut circuits = IndexMap::new();
|
||||
for (name, circuit) in value.circuits.iter() {
|
||||
for (name, circuit) in program.circuits.iter() {
|
||||
assert_eq!(name.name, circuit.circuit_name.name);
|
||||
let asg_circuit = proto_circuits.get(&name.name).unwrap();
|
||||
let body = Arc::new(CircuitBody::from_ast(&scope, circuit, asg_circuit.clone())?);
|
||||
@ -308,9 +308,9 @@ impl InnerProgram {
|
||||
circuits.insert(name.name.clone(), body);
|
||||
}
|
||||
|
||||
Ok(Arc::new(RefCell::new(InnerProgram {
|
||||
Ok(Arc::new(RefCell::new(InternalProgram {
|
||||
id: Uuid::new_v4(),
|
||||
name: value.name.clone(),
|
||||
name: program.name.clone(),
|
||||
test_functions,
|
||||
functions,
|
||||
circuits,
|
||||
@ -342,7 +342,7 @@ impl Iterator for InternalIdentifierGenerator {
|
||||
Some(out)
|
||||
}
|
||||
}
|
||||
/// Returns an ast from the given asg program.
|
||||
/// Returns an AST from the given ASG program.
|
||||
pub fn reform_ast(program: &Program) -> leo_ast::Program {
|
||||
let mut all_programs: IndexMap<String, Program> = IndexMap::new();
|
||||
let mut program_stack = program.borrow().imported_modules.clone();
|
||||
@ -427,7 +427,7 @@ pub fn reform_ast(program: &Program) -> leo_ast::Program {
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<leo_ast::Program> for &InnerProgram {
|
||||
impl Into<leo_ast::Program> for &InternalProgram {
|
||||
fn into(self) -> leo_ast::Program {
|
||||
leo_ast::Program {
|
||||
name: self.name.clone(),
|
||||
|
@ -157,7 +157,7 @@ pub trait MonoidalReducerProgram<T: Monoid>: MonoidalReducerStatement<T> {
|
||||
|
||||
fn reduce_program(
|
||||
&mut self,
|
||||
input: &InnerProgram,
|
||||
input: &InternalProgram,
|
||||
imported_modules: Vec<T>,
|
||||
test_functions: Vec<T>,
|
||||
functions: Vec<T>,
|
||||
|
@ -21,6 +21,7 @@ use std::{cell::RefCell, sync::Arc};
|
||||
use uuid::Uuid;
|
||||
|
||||
/// An abstract data type that track the current bindings for variables, functions, and circuits.
|
||||
#[derive(Debug)]
|
||||
pub struct InnerScope {
|
||||
/// The unique id of the scope.
|
||||
pub id: Uuid,
|
||||
|
@ -37,6 +37,7 @@ use leo_ast::AssigneeAccess as AstAssigneeAccess;
|
||||
|
||||
use std::sync::{Arc, Weak};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum AssignAccess {
|
||||
ArrayRange(Option<Arc<Expression>>, Option<Arc<Expression>>),
|
||||
ArrayIndex(Arc<Expression>),
|
||||
@ -44,6 +45,7 @@ pub enum AssignAccess {
|
||||
Member(Identifier),
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct AssignStatement {
|
||||
pub parent: Option<Weak<Statement>>,
|
||||
pub span: Option<Span>,
|
||||
@ -92,7 +94,7 @@ impl FromAst<leo_ast::AssignStatement> for Arc<Statement> {
|
||||
if !variable.borrow().mutable {
|
||||
return Err(AsgConvertError::immutable_assignment(&name, &statement.span));
|
||||
}
|
||||
let mut target_type: Option<PartialType> = Some(variable.borrow().type_.clone().into());
|
||||
let mut target_type: Option<PartialType> = Some(variable.borrow().type_.clone().strong().into());
|
||||
|
||||
let mut target_accesses = vec![];
|
||||
for access in statement.assignee.accesses.iter() {
|
||||
|
@ -18,6 +18,7 @@ use crate::{AsgConvertError, FromAst, InnerScope, Node, PartialType, Scope, Span
|
||||
|
||||
use std::sync::{Arc, Weak};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct BlockStatement {
|
||||
pub parent: Option<Weak<Statement>>,
|
||||
pub span: Option<Span>,
|
||||
|
@ -18,6 +18,7 @@ use crate::{AsgConvertError, BlockStatement, Expression, FromAst, Node, PartialT
|
||||
|
||||
use std::sync::{Arc, Weak};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ConditionalStatement {
|
||||
pub parent: Option<Weak<Statement>>,
|
||||
pub span: Option<Span>,
|
||||
|
@ -19,7 +19,8 @@ use leo_ast::ConsoleFunction as AstConsoleFunction;
|
||||
|
||||
use std::sync::{Arc, Weak};
|
||||
|
||||
//todo: refactor to not require/depend on span
|
||||
// TODO (protryon): Refactor to not require/depend on span
|
||||
#[derive(Debug)]
|
||||
pub struct FormattedString {
|
||||
pub string: String,
|
||||
pub containers: Vec<Span>,
|
||||
@ -27,6 +28,7 @@ pub struct FormattedString {
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum ConsoleFunction {
|
||||
Assert(Arc<Expression>),
|
||||
Debug(FormattedString),
|
||||
@ -34,6 +36,7 @@ pub enum ConsoleFunction {
|
||||
Log(FormattedString),
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ConsoleStatement {
|
||||
pub parent: Option<Weak<Statement>>,
|
||||
pub span: Option<Span>,
|
||||
|
@ -34,6 +34,7 @@ use std::{
|
||||
sync::{Arc, Weak},
|
||||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct DefinitionStatement {
|
||||
pub parent: Option<Weak<Statement>>,
|
||||
pub span: Option<Span>,
|
||||
@ -98,8 +99,10 @@ impl FromAst<leo_ast::DefinitionStatement> for Arc<Statement> {
|
||||
id: uuid::Uuid::new_v4(),
|
||||
name: variable.identifier.clone(),
|
||||
type_: type_
|
||||
.ok_or_else(|| AsgConvertError::unresolved_type(&variable.identifier.name, &statement.span))?,
|
||||
.ok_or_else(|| AsgConvertError::unresolved_type(&variable.identifier.name, &statement.span))?
|
||||
.weak(),
|
||||
mutable: variable.mutable,
|
||||
const_: false,
|
||||
declaration: crate::VariableDeclaration::Definition,
|
||||
references: vec![],
|
||||
assignments: vec![],
|
||||
@ -144,7 +147,7 @@ impl Into<leo_ast::DefinitionStatement> for &DefinitionStatement {
|
||||
span: variable.name.span.clone(),
|
||||
});
|
||||
if type_.is_none() {
|
||||
type_ = Some((&variable.type_).into());
|
||||
type_ = Some((&variable.type_.clone().strong()).into());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@ use crate::{AsgConvertError, Expression, FromAst, Node, PartialType, Scope, Span
|
||||
|
||||
use std::sync::{Arc, Weak};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ExpressionStatement {
|
||||
pub parent: Option<Weak<Statement>>,
|
||||
pub span: Option<Span>,
|
||||
|
@ -35,6 +35,7 @@ use std::{
|
||||
sync::{Arc, Weak},
|
||||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct IterationStatement {
|
||||
pub parent: Option<Weak<Statement>>,
|
||||
pub span: Option<Span>,
|
||||
@ -64,8 +65,10 @@ impl FromAst<leo_ast::IterationStatement> for Arc<Statement> {
|
||||
name: statement.variable.clone(),
|
||||
type_: start
|
||||
.get_type()
|
||||
.ok_or_else(|| AsgConvertError::unresolved_type(&statement.variable.name, &statement.span))?,
|
||||
.ok_or_else(|| AsgConvertError::unresolved_type(&statement.variable.name, &statement.span))?
|
||||
.weak(),
|
||||
mutable: false,
|
||||
const_: true,
|
||||
declaration: crate::VariableDeclaration::IterationDefinition,
|
||||
references: vec![],
|
||||
assignments: vec![],
|
||||
|
@ -46,6 +46,7 @@ use crate::{AsgConvertError, FromAst, Node, PartialType, Scope, Span};
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum Statement {
|
||||
Return(ReturnStatement),
|
||||
Definition(DefinitionStatement),
|
||||
|
@ -18,6 +18,7 @@ use crate::{AsgConvertError, Expression, FromAst, Node, PartialType, Scope, Span
|
||||
|
||||
use std::sync::{Arc, Weak};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ReturnStatement {
|
||||
pub parent: Option<Weak<Statement>>,
|
||||
pub span: Option<Span>,
|
||||
|
@ -22,8 +22,8 @@ use std::{
|
||||
sync::{Arc, Weak},
|
||||
};
|
||||
|
||||
/// A type in an asg.
|
||||
#[derive(Clone, PartialEq)]
|
||||
/// A type in an ASG.
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum Type {
|
||||
// Data types
|
||||
Address,
|
||||
@ -38,13 +38,13 @@ pub enum Type {
|
||||
Circuit(Arc<Circuit>),
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum WeakType {
|
||||
Type(Type), // circuit not allowed
|
||||
Circuit(Weak<Circuit>),
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq)]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum PartialType {
|
||||
Type(Type), // non-array or tuple
|
||||
Integer(Option<IntegerType>, Option<IntegerType>), // specific, context-specific
|
||||
@ -157,6 +157,10 @@ impl Type {
|
||||
self.into()
|
||||
}
|
||||
|
||||
pub fn weak(self) -> WeakType {
|
||||
self.into()
|
||||
}
|
||||
|
||||
pub fn is_unit(&self) -> bool {
|
||||
matches!(self, Type::Tuple(t) if t.is_empty())
|
||||
}
|
||||
|
@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{Expression, Statement, Type};
|
||||
use crate::{Expression, Statement, WeakType};
|
||||
use leo_ast::Identifier;
|
||||
|
||||
use std::{
|
||||
@ -24,7 +24,7 @@ use std::{
|
||||
use uuid::Uuid;
|
||||
|
||||
/// Specifies how a program variable was declared.
|
||||
#[derive(PartialEq)]
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum VariableDeclaration {
|
||||
Definition,
|
||||
IterationDefinition,
|
||||
@ -33,11 +33,13 @@ pub enum VariableDeclaration {
|
||||
}
|
||||
|
||||
/// Stores information on a program variable.
|
||||
#[derive(Debug)]
|
||||
pub struct InnerVariable {
|
||||
pub id: Uuid,
|
||||
pub name: Identifier,
|
||||
pub type_: Type,
|
||||
pub type_: WeakType,
|
||||
pub mutable: bool,
|
||||
pub const_: bool, // only function arguments, const var definitions NOT included
|
||||
pub declaration: VariableDeclaration,
|
||||
pub references: Vec<Weak<Expression>>, // all Expression::VariableRef or panic
|
||||
pub assignments: Vec<Weak<Statement>>, // all Statement::Assign or panic -- must be 1 if not mutable, or 0 if declaration == input | parameter
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::load_asg;
|
||||
|
||||
#[test]
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::load_asg;
|
||||
|
||||
// Expressions
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::load_asg;
|
||||
|
||||
#[test]
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::load_asg;
|
||||
|
||||
// Expressions
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::load_asg;
|
||||
|
||||
#[test]
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::load_asg;
|
||||
|
||||
#[test]
|
||||
|
@ -13,19 +13,3 @@
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
@ -13,19 +13,3 @@
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::load_asg;
|
||||
|
||||
#[test]
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::load_asg;
|
||||
|
||||
#[test]
|
||||
|
@ -13,19 +13,3 @@
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use super::IntegerTester;
|
||||
|
||||
test_int!(TestI128);
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use super::IntegerTester;
|
||||
|
||||
test_int!(TestI16);
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use super::IntegerTester;
|
||||
|
||||
test_int!(TestI32);
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use super::IntegerTester;
|
||||
|
||||
test_int!(TestI64);
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use super::IntegerTester;
|
||||
|
||||
test_int!(TestI8);
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
macro_rules! test_int {
|
||||
($name: ident) => {
|
||||
pub struct $name {}
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
pub trait IntegerTester {
|
||||
/// Tests defining the smallest value - 1
|
||||
fn test_min_fail();
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#[macro_use]
|
||||
pub mod int_macro;
|
||||
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use super::IntegerTester;
|
||||
|
||||
test_uint!(TestU128);
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use super::IntegerTester;
|
||||
|
||||
test_uint!(TestU16);
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use super::IntegerTester;
|
||||
|
||||
test_uint!(TestU32);
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use super::IntegerTester;
|
||||
|
||||
test_uint!(TestU64);
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use super::IntegerTester;
|
||||
|
||||
test_uint!(TestU8);
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
macro_rules! test_uint {
|
||||
($name: ident) => {
|
||||
pub struct $name {}
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
pub mod address;
|
||||
pub mod array;
|
||||
pub mod boolean;
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::load_asg;
|
||||
|
||||
#[test]
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::load_asg;
|
||||
|
||||
#[test]
|
||||
|
@ -13,19 +13,3 @@
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
@ -15,16 +15,28 @@
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use leo_asg::*;
|
||||
use leo_ast::Ast;
|
||||
use leo_grammar::Grammar;
|
||||
|
||||
use std::path::Path;
|
||||
|
||||
mod fail;
|
||||
mod pass;
|
||||
|
||||
fn load_asg(content: &str) -> Result<Program, AsgConvertError> {
|
||||
leo_asg::load_asg(content, &mut NullImportResolver)
|
||||
const TESTING_FILEPATH: &str = "input.leo";
|
||||
const TESTING_PROGRAM_NAME: &str = "test_program";
|
||||
|
||||
fn load_asg(program_string: &str) -> Result<Program, AsgConvertError> {
|
||||
load_asg_imports(program_string, &mut NullImportResolver)
|
||||
}
|
||||
|
||||
fn load_asg_imports<T: ImportResolver + 'static>(content: &str, imports: &mut T) -> Result<Program, AsgConvertError> {
|
||||
leo_asg::load_asg(content, imports)
|
||||
fn load_asg_imports<T: ImportResolver + 'static>(
|
||||
program_string: &str,
|
||||
imports: &mut T,
|
||||
) -> Result<Program, AsgConvertError> {
|
||||
let grammar = Grammar::new(Path::new(&TESTING_FILEPATH), program_string)?;
|
||||
let ast = Ast::new(TESTING_PROGRAM_NAME, &grammar)?;
|
||||
InternalProgram::new(&ast.as_repr(), imports)
|
||||
}
|
||||
|
||||
fn mocked_resolver() -> MockedImportResolver {
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::load_asg;
|
||||
|
||||
#[test]
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::load_asg;
|
||||
|
||||
// Registers
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::load_asg;
|
||||
|
||||
#[test]
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::load_asg;
|
||||
|
||||
// Expressions
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::load_asg;
|
||||
|
||||
#[test]
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::load_asg;
|
||||
|
||||
#[test]
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::load_asg;
|
||||
|
||||
#[test]
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::load_asg;
|
||||
|
||||
#[test]
|
||||
|
@ -15,6 +15,10 @@
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::load_asg;
|
||||
use leo_ast::Ast;
|
||||
use leo_grammar::Grammar;
|
||||
|
||||
use std::path::Path;
|
||||
|
||||
#[test]
|
||||
fn test_basic() {
|
||||
@ -73,14 +77,19 @@ fn test_imports() {
|
||||
console.assert(foo() == 1u32);
|
||||
}
|
||||
"#;
|
||||
|
||||
let test_import_grammar = Grammar::new(Path::new("test-import.leo"), test_import).unwrap();
|
||||
println!(
|
||||
"{}",
|
||||
serde_json::to_string(&crate::load_ast("test-import.leo", test_import).unwrap()).unwrap()
|
||||
serde_json::to_string(Ast::new("test-import", &test_import_grammar).unwrap().as_repr()).unwrap()
|
||||
);
|
||||
|
||||
let test_grammar = Grammar::new(Path::new("test.leo"), program_string).unwrap();
|
||||
println!(
|
||||
"{}",
|
||||
serde_json::to_string(&crate::load_ast("test.leo", program_string).unwrap()).unwrap()
|
||||
serde_json::to_string(Ast::new("test", &test_grammar).unwrap().as_repr()).unwrap()
|
||||
);
|
||||
|
||||
let asg = crate::load_asg_imports(program_string, &mut imports).unwrap();
|
||||
let reformed_ast = leo_asg::reform_ast(&asg);
|
||||
println!("{}", serde_json::to_string(&reformed_ast).unwrap());
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::load_asg;
|
||||
|
||||
#[test]
|
||||
@ -44,6 +28,66 @@ fn test_iteration() {
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_const_args() {
|
||||
let program_string = r#"
|
||||
function one(const value: u32) -> u32 {
|
||||
return value + 1
|
||||
}
|
||||
|
||||
function main() {
|
||||
let mut a = 0u32;
|
||||
|
||||
for i in 0..10 {
|
||||
a += one(i);
|
||||
}
|
||||
|
||||
console.assert(a == 20u32);
|
||||
}
|
||||
"#;
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_const_args_used() {
|
||||
let program_string = r#"
|
||||
function index(arr: [u8; 3], const value: u32) -> u8 {
|
||||
return arr[value]
|
||||
}
|
||||
|
||||
function main() {
|
||||
let mut a = 0u8;
|
||||
let arr = [1u8, 2, 3];
|
||||
|
||||
for i in 0..3 {
|
||||
a += index(arr, i);
|
||||
}
|
||||
|
||||
console.assert(a == 6u8);
|
||||
}
|
||||
"#;
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_const_args_fail() {
|
||||
let program_string = r#"
|
||||
function index(arr: [u8; 3], const value: u32) -> u8 {
|
||||
return arr[value]
|
||||
}
|
||||
|
||||
function main(x_value: u32) {
|
||||
let mut a = 0u8;
|
||||
let arr = [1u8, 2, 3];
|
||||
|
||||
a += index(arr, x_value);
|
||||
|
||||
console.assert(a == 1u8);
|
||||
}
|
||||
"#;
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_iteration_repeated() {
|
||||
let program_string = include_str!("iteration_repeated.leo");
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::load_asg;
|
||||
|
||||
#[test]
|
||||
@ -38,6 +22,16 @@ fn test_one() {
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_implicit() {
|
||||
let program_string = r#"
|
||||
function main() {
|
||||
let element: group = 0;
|
||||
}
|
||||
"#;
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_zero() {
|
||||
let program_string = include_str!("zero.leo");
|
||||
|
@ -1,3 +1,7 @@
|
||||
circuit Baz {
|
||||
z: u32
|
||||
}
|
||||
|
||||
circuit Bazzar {
|
||||
a: u32
|
||||
}
|
@ -5,7 +5,7 @@ import test-import.( // local import
|
||||
|
||||
import bar.( // imports directory import
|
||||
Bar,
|
||||
baz.Baz,
|
||||
baz.(Baz, Bazzar),
|
||||
bat.bat.Bat,
|
||||
);
|
||||
|
||||
@ -17,6 +17,7 @@ function main() {
|
||||
|
||||
const bar = Bar { r: 1u32 };
|
||||
const baz = Baz { z: 1u32 };
|
||||
const bazzar = Bazzar { a: 1u32 };
|
||||
const bat = Bat { t: 1u32 };
|
||||
|
||||
const car = Car { c: 1u32 };
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{load_asg, load_asg_imports, mocked_resolver};
|
||||
|
||||
#[test]
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
mod program_input;
|
||||
mod program_input_and_program_state;
|
||||
mod program_state;
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::load_asg;
|
||||
|
||||
#[test]
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::load_asg;
|
||||
|
||||
#[test]
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::load_asg;
|
||||
|
||||
#[test]
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use super::IntegerTester;
|
||||
|
||||
test_int!(TestI128);
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use super::IntegerTester;
|
||||
|
||||
test_int!(TestI16);
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use super::IntegerTester;
|
||||
|
||||
test_int!(TestI32);
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use super::IntegerTester;
|
||||
|
||||
test_int!(TestI64);
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use super::IntegerTester;
|
||||
|
||||
test_int!(TestI8);
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
macro_rules! test_int {
|
||||
($name: ident) => {
|
||||
pub struct $name {}
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
pub trait IntegerTester {
|
||||
/// Tests defining the smalled value that can be represented by the integer type
|
||||
fn test_min();
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#[macro_use]
|
||||
pub mod int_macro;
|
||||
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use super::IntegerTester;
|
||||
|
||||
test_uint!(TestU128);
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use super::IntegerTester;
|
||||
|
||||
test_uint!(TestU16);
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use super::IntegerTester;
|
||||
|
||||
test_uint!(TestU32);
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use super::IntegerTester;
|
||||
|
||||
test_uint!(TestU64);
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use super::IntegerTester;
|
||||
|
||||
test_uint!(TestU8);
|
||||
|
@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
macro_rules! test_uint {
|
||||
($name: ident) => {
|
||||
pub struct $name {}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user