mirror of
https://github.com/AleoHQ/leo.git
synced 2024-09-22 04:27:25 +03:00
merge master, resolve conflicts, login test is failing
This commit is contained in:
commit
438c20c14d
@ -1,2 +1,2 @@
|
||||
[target.'cfg(not(target_arch = "wasm32"))']
|
||||
[target.'cfg(any(not(target_arch = "wasm32"), feature = "noconfig"))']
|
||||
rustflags = ["-C", "target-cpu=native"]
|
||||
|
@ -44,7 +44,7 @@ jobs:
|
||||
|
||||
rust-stable:
|
||||
docker:
|
||||
- image: cimg/rust:1.50.0
|
||||
- image: cimg/rust:1.51.0
|
||||
resource_class: xlarge
|
||||
steps:
|
||||
- checkout
|
||||
@ -62,7 +62,7 @@ jobs:
|
||||
|
||||
rust-nightly:
|
||||
docker:
|
||||
- image: howardwu/snarkos-ci:2021-01-31
|
||||
- image: howardwu/snarkos-ci:2021-03-25
|
||||
resource_class: xlarge
|
||||
steps:
|
||||
- checkout
|
||||
@ -77,7 +77,7 @@ jobs:
|
||||
|
||||
leo-executable:
|
||||
docker:
|
||||
- image: cimg/rust:1.50.0
|
||||
- image: cimg/rust:1.51.0
|
||||
resource_class: xlarge
|
||||
steps:
|
||||
- checkout
|
||||
@ -86,7 +86,7 @@ jobs:
|
||||
- run:
|
||||
name: Build and install Leo
|
||||
no_output_timeout: 30m
|
||||
command: cargo install --path . --root .
|
||||
command: cargo install --path . --root . --locked
|
||||
- persist_to_workspace:
|
||||
root: ~/
|
||||
paths: project/
|
||||
@ -95,7 +95,7 @@ jobs:
|
||||
|
||||
leo-new:
|
||||
docker:
|
||||
- image: cimg/rust:1.50.0
|
||||
- image: cimg/rust:1.51.0
|
||||
resource_class: xlarge
|
||||
steps:
|
||||
- attach_workspace:
|
||||
@ -108,7 +108,7 @@ jobs:
|
||||
|
||||
leo-init:
|
||||
docker:
|
||||
- image: cimg/rust:1.50.0
|
||||
- image: cimg/rust:1.51.0
|
||||
resource_class: xlarge
|
||||
steps:
|
||||
- attach_workspace:
|
||||
@ -121,7 +121,7 @@ jobs:
|
||||
|
||||
leo-clean:
|
||||
docker:
|
||||
- image: cimg/rust:1.50.0
|
||||
- image: cimg/rust:1.51.0
|
||||
resource_class: xlarge
|
||||
steps:
|
||||
- attach_workspace:
|
||||
@ -134,7 +134,7 @@ jobs:
|
||||
|
||||
leo-setup:
|
||||
docker:
|
||||
- image: cimg/rust:1.50.0
|
||||
- image: cimg/rust:1.51.0
|
||||
resource_class: xlarge
|
||||
steps:
|
||||
- attach_workspace:
|
||||
@ -147,7 +147,7 @@ jobs:
|
||||
|
||||
leo-add-remove:
|
||||
docker:
|
||||
- image: cimg/rust:1.50.0
|
||||
- image: cimg/rust:1.51.0
|
||||
resource_class: xlarge
|
||||
steps:
|
||||
- attach_workspace:
|
||||
@ -158,10 +158,23 @@ jobs:
|
||||
export LEO=/home/circleci/project/project/bin/leo
|
||||
./project/.circleci/leo-add-remove.sh
|
||||
|
||||
leo-login-logout:
|
||||
leo-check-constraints:
|
||||
docker:
|
||||
- image: cimg/rust:1.50.0
|
||||
resource_class: xlarge
|
||||
steps:
|
||||
- attach_workspace:
|
||||
at: /home/circleci/project/
|
||||
- run:
|
||||
name: leo check constraints for Pedersen Hash
|
||||
command: |
|
||||
export LEO=/home/circleci/project/project/bin/leo
|
||||
./project/.circleci/leo-check-constraints.sh
|
||||
|
||||
leo-login-logout:
|
||||
docker:
|
||||
- image: cimg/rust:1.51.0
|
||||
resource_class: xlarge
|
||||
steps:
|
||||
- attach_workspace:
|
||||
at: /home/circleci/project/
|
||||
@ -173,7 +186,7 @@ jobs:
|
||||
|
||||
leo-clone:
|
||||
docker:
|
||||
- image: cimg/rust:1.50.0
|
||||
- image: cimg/rust:1.51.0
|
||||
resource_class: xlarge
|
||||
steps:
|
||||
- attach_workspace:
|
||||
@ -186,7 +199,7 @@ jobs:
|
||||
|
||||
leo-publish:
|
||||
docker:
|
||||
- image: cimg/rust:1.50.0
|
||||
- image: cimg/rust:1.51.0
|
||||
resource_class: xlarge
|
||||
steps:
|
||||
- attach_workspace:
|
||||
@ -219,6 +232,9 @@ workflows:
|
||||
- leo-add-remove:
|
||||
requires:
|
||||
- leo-executable
|
||||
- leo-check-constraints:
|
||||
requires:
|
||||
- leo-executable
|
||||
- leo-login-logout:
|
||||
requires:
|
||||
- leo-executable
|
||||
|
@ -1,6 +1,6 @@
|
||||
# leo add (w/o login) & remove
|
||||
|
||||
$LEO new my-app && cd my-app
|
||||
$LEO new my-app && cd my-app || exit 1
|
||||
$LEO add howard/silly-sudoku
|
||||
$LEO remove silly-sudoku
|
||||
$LEO clean
|
||||
|
16
.circleci/leo-check-constraints.sh
Executable file
16
.circleci/leo-check-constraints.sh
Executable file
@ -0,0 +1,16 @@
|
||||
# leo new hello-world
|
||||
|
||||
cd ./project/examples/pedersen-hash
|
||||
|
||||
export PEDERSEN_HASH_CONSTRAINTS=1539;
|
||||
|
||||
# line that we're searching for is:
|
||||
# `Build Number of constraints - 1539`
|
||||
export ACTUAL_CONSTRAINTS=$($LEO build | grep constraints | awk '{print $NF}')
|
||||
|
||||
# if else expression with only else block
|
||||
[[ PEDERSEN_HASH_CONSTRAINTS -eq ACTUAL_CONSTRAINTS ]] || {
|
||||
echo >&2 "Number of constraints for Pedersen Hash is not $PEDERSEN_HASH_CONSTRAINTS";
|
||||
echo >&2 "Real number of constraints is $ACTUAL_CONSTRAINTS";
|
||||
exit 1;
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
mkdir hello-world && cd hello-world || exit 1
|
||||
$LEO init
|
||||
ls -la
|
||||
mkdir hello-world
|
||||
cd hello-world
|
||||
$LEO init || exit 1
|
||||
ls -la hello-world
|
||||
$LEO run
|
||||
|
@ -1,7 +1,15 @@
|
||||
# leo login & logout
|
||||
|
||||
$LEO new my-app && cd my-app || exit 1
|
||||
$LEO login -u "$ALEO_PM_USERNAME" -p "$ALEO_PM_PASSWORD"
|
||||
$LEO new my-app && cd my-app || exit 1
|
||||
|
||||
cat Leo.toml
|
||||
|
||||
# verify that in Leo.toml there's no line with [AUTHOR];
|
||||
# since CI does not allow showing credentials, we won't see it in the file;
|
||||
# so the only way to test is to make sure that there's just no [AUTHOR] there
|
||||
[[ $(cat Leo.toml | grep "\[AUTHOR\]" | wc -l) -eq 0 ]] || exit 1
|
||||
|
||||
$LEO add howard/silly-sudoku
|
||||
$LEO remove silly-sudoku
|
||||
$LEO logout
|
||||
|
@ -1,4 +1,9 @@
|
||||
$LEO new hello-world
|
||||
ls -la
|
||||
cd hello-world && ls -la
|
||||
|
||||
# verify that in Leo.toml there's a placeholder for author
|
||||
# because at the time of calling `leo new` user is not logged in
|
||||
[[ $(cat Leo.toml | grep "\[AUTHOR\]" | wc -l) -eq 1 ]] || exit 1
|
||||
|
||||
$LEO run
|
||||
|
0
.circleci/r
Normal file
0
.circleci/r
Normal file
23
.github/workflows/release.yml
vendored
23
.github/workflows/release.yml
vendored
@ -25,7 +25,7 @@ jobs:
|
||||
|
||||
- name: Build Leo
|
||||
run: |
|
||||
cargo build --all --release && strip target/release/leo
|
||||
cargo build --all --release --features noconfig && strip target/release/leo
|
||||
env:
|
||||
CARGO_NET_GIT_FETCH_WITH_CLI: true
|
||||
|
||||
@ -67,7 +67,7 @@ jobs:
|
||||
|
||||
- name: Build Leo
|
||||
run: |
|
||||
cargo build --all --release && strip target/release/leo
|
||||
cargo build --all --release --features noconfig && strip target/release/leo
|
||||
env:
|
||||
CARGO_NET_GIT_FETCH_WITH_CLI: true
|
||||
|
||||
@ -95,7 +95,6 @@ jobs:
|
||||
windows:
|
||||
name: Windows
|
||||
runs-on: windows-latest
|
||||
continue-on-error: true
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v1
|
||||
@ -111,12 +110,15 @@ jobs:
|
||||
- name: Install LLVM and Clang
|
||||
uses: KyleMayes/install-llvm-action@v1
|
||||
with:
|
||||
version: "10.0"
|
||||
directory: ~ / .clang
|
||||
version: "11"
|
||||
directory: ${{ runner.temp }}/llvm
|
||||
|
||||
- name: Set LIBCLANG_PATH
|
||||
run: echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> $env:GITHUB_ENV
|
||||
|
||||
- name: Build Leo
|
||||
run: |
|
||||
cargo build --all --release
|
||||
cargo build --all --release --features noconfig
|
||||
env:
|
||||
CARGO_NET_GIT_FETCH_WITH_CLI: true
|
||||
|
||||
@ -125,18 +127,13 @@ jobs:
|
||||
|
||||
- name: Zip
|
||||
run: |
|
||||
mkdir tempdir
|
||||
mv target/release/leo tempdir
|
||||
cd tempdir
|
||||
Compress-Archive leo-${{ steps.get_version.outputs.version }}-x86_64-pc-windows-gnu leo
|
||||
cd ..
|
||||
mv leo-${{ steps.get_version.outputs.version }}-x86_64-pc-windows-gnu .
|
||||
Compress-Archive target/release/leo.exe leo-${{ steps.get_version.outputs.version }}-x86_64-pc-windows-msvc.zip
|
||||
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
files: |
|
||||
leo-${{ steps.get_version.outputs.version }}-x86_64-pc-windows-gnu.zip
|
||||
leo-${{ steps.get_version.outputs.version }}-x86_64-pc-windows-msvc.zip
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
@ -1 +1 @@
|
||||
v1.2.3
|
||||
v1.4.0
|
309
Cargo.lock
generated
309
Cargo.lock
generated
@ -4,9 +4,9 @@ version = 3
|
||||
|
||||
[[package]]
|
||||
name = "abnf"
|
||||
version = "0.10.0"
|
||||
version = "0.11.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "020babd9b431b239cffff9eb1e49d8cad5f3581674d3938540801e633a3b5f69"
|
||||
checksum = "96e669320c520d87931e752d603dd442b4709c73b1b8b1fcba838f9c5acc1791"
|
||||
dependencies = [
|
||||
"abnf-core",
|
||||
"nom 6.1.2",
|
||||
@ -71,9 +71,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.39"
|
||||
version = "1.0.40"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "81cddc5f91628367664cc7c69714ff08deee8a3efc54623011c772544d7b2767"
|
||||
checksum = "28b2cd92db5cbd74e8e5028f7e27dd7aa3090e89e4f2a197cc7c8dfb69c7063b"
|
||||
|
||||
[[package]]
|
||||
name = "arrayref"
|
||||
@ -87,6 +87,20 @@ version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
|
||||
|
||||
[[package]]
|
||||
name = "assert_cmd"
|
||||
version = "1.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f2475b58cd94eb4f70159f4fd8844ba3b807532fe3131b3373fae060bbe30396"
|
||||
dependencies = [
|
||||
"bstr",
|
||||
"doc-comment",
|
||||
"predicates",
|
||||
"predicates-core",
|
||||
"predicates-tree",
|
||||
"wait-timeout",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "atty"
|
||||
version = "0.2.14"
|
||||
@ -138,11 +152,10 @@ checksum = "58946044516aa9dc922182e0d6e9d124a31aafe6b421614654eb27cf90cec09c"
|
||||
|
||||
[[package]]
|
||||
name = "bincode"
|
||||
version = "1.3.2"
|
||||
version = "1.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d175dfa69e619905c4c3cdb7c3c203fa3bdd5d51184e3afdb2742c0280493772"
|
||||
checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"serde",
|
||||
]
|
||||
|
||||
@ -602,6 +615,12 @@ dependencies = [
|
||||
"syn 1.0.64",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "difference"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198"
|
||||
|
||||
[[package]]
|
||||
name = "digest"
|
||||
version = "0.8.1"
|
||||
@ -640,6 +659,18 @@ dependencies = [
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "doc-comment"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"
|
||||
|
||||
[[package]]
|
||||
name = "dtoa"
|
||||
version = "0.4.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "56899898ce76aaf4a0f24d914c97ea6ed976d42fec6ad33fcbb0a1103e07b2b0"
|
||||
|
||||
[[package]]
|
||||
name = "either"
|
||||
version = "1.6.1"
|
||||
@ -1241,7 +1272,7 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
|
||||
|
||||
[[package]]
|
||||
name = "leo-abnf"
|
||||
version = "1.2.3"
|
||||
version = "1.4.0"
|
||||
dependencies = [
|
||||
"abnf",
|
||||
"anyhow",
|
||||
@ -1249,7 +1280,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "leo-asg"
|
||||
version = "1.2.3"
|
||||
version = "1.4.0"
|
||||
dependencies = [
|
||||
"criterion",
|
||||
"indexmap",
|
||||
@ -1265,14 +1296,14 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "leo-asg-passes"
|
||||
version = "1.2.3"
|
||||
version = "1.4.0"
|
||||
dependencies = [
|
||||
"leo-asg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "leo-ast"
|
||||
version = "1.2.3"
|
||||
version = "1.4.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"criterion",
|
||||
@ -1287,7 +1318,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "leo-compiler"
|
||||
version = "1.2.3"
|
||||
version = "1.4.0"
|
||||
dependencies = [
|
||||
"bincode",
|
||||
"hex",
|
||||
@ -1302,8 +1333,8 @@ dependencies = [
|
||||
"leo-state",
|
||||
"num-bigint",
|
||||
"pest",
|
||||
"rand",
|
||||
"rand_core",
|
||||
"rand 0.8.3",
|
||||
"rand_core 0.6.2",
|
||||
"rand_xorshift",
|
||||
"serde",
|
||||
"sha2",
|
||||
@ -1314,13 +1345,15 @@ dependencies = [
|
||||
"snarkvm-gadgets",
|
||||
"snarkvm-r1cs",
|
||||
"snarkvm-utilities",
|
||||
"tempfile",
|
||||
"tendril",
|
||||
"thiserror",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "leo-imports"
|
||||
version = "1.2.3"
|
||||
version = "1.4.0"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"leo-asg",
|
||||
@ -1332,7 +1365,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "leo-input"
|
||||
version = "1.2.3"
|
||||
version = "1.4.0"
|
||||
dependencies = [
|
||||
"from-pest",
|
||||
"pest",
|
||||
@ -1344,9 +1377,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "leo-lang"
|
||||
version = "1.2.3"
|
||||
version = "1.4.0"
|
||||
dependencies = [
|
||||
"ansi_term 0.12.1",
|
||||
"anyhow",
|
||||
"assert_cmd",
|
||||
"clap",
|
||||
"colored",
|
||||
"console",
|
||||
@ -1361,8 +1396,8 @@ dependencies = [
|
||||
"leo-state",
|
||||
"leo-synthesizer",
|
||||
"notify",
|
||||
"rand",
|
||||
"rand_core",
|
||||
"rand 0.8.3",
|
||||
"rand_core 0.6.2",
|
||||
"reqwest",
|
||||
"rusty-hook",
|
||||
"self_update",
|
||||
@ -1374,6 +1409,7 @@ dependencies = [
|
||||
"snarkvm-r1cs",
|
||||
"snarkvm-utilities",
|
||||
"structopt",
|
||||
"test_dir",
|
||||
"thiserror",
|
||||
"toml",
|
||||
"tracing",
|
||||
@ -1383,11 +1419,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "leo-linter"
|
||||
version = "1.2.3"
|
||||
version = "1.4.0"
|
||||
|
||||
[[package]]
|
||||
name = "leo-package"
|
||||
version = "1.2.3"
|
||||
version = "1.4.0"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"serde",
|
||||
@ -1400,14 +1436,16 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "leo-parser"
|
||||
version = "1.2.3"
|
||||
version = "1.4.0"
|
||||
dependencies = [
|
||||
"criterion",
|
||||
"indexmap",
|
||||
"lazy_static",
|
||||
"leo-ast",
|
||||
"leo-test-framework",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_yaml",
|
||||
"tendril",
|
||||
"thiserror",
|
||||
"tracing",
|
||||
@ -1415,13 +1453,13 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "leo-state"
|
||||
version = "1.2.3"
|
||||
version = "1.4.0"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"leo-ast",
|
||||
"leo-input",
|
||||
"rand",
|
||||
"rand_core",
|
||||
"rand 0.8.3",
|
||||
"rand_core 0.6.2",
|
||||
"rand_xorshift",
|
||||
"snarkvm-algorithms",
|
||||
"snarkvm-curves",
|
||||
@ -1433,7 +1471,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "leo-synthesizer"
|
||||
version = "1.2.3"
|
||||
version = "1.4.0"
|
||||
dependencies = [
|
||||
"num-bigint",
|
||||
"serde",
|
||||
@ -1444,6 +1482,15 @@ dependencies = [
|
||||
"snarkvm-r1cs",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "leo-test-framework"
|
||||
version = "1.4.0"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_yaml",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lexical-core"
|
||||
version = "0.7.5"
|
||||
@ -1497,6 +1544,12 @@ dependencies = [
|
||||
"vcpkg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "linked-hash-map"
|
||||
version = "0.5.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3"
|
||||
|
||||
[[package]]
|
||||
name = "lock_api"
|
||||
version = "0.4.2"
|
||||
@ -1724,9 +1777,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "notify"
|
||||
version = "4.0.15"
|
||||
version = "4.0.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "80ae4a7688d1fab81c5bf19c64fc8db920be8d519ce6336ed4e7efe024724dbd"
|
||||
checksum = "2599080e87c9bd051ddb11b10074f4da7b1223298df65d4c2ec5bcf309af1533"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"filetime",
|
||||
@ -2023,6 +2076,32 @@ version = "0.2.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857"
|
||||
|
||||
[[package]]
|
||||
name = "predicates"
|
||||
version = "1.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eeb433456c1a57cc93554dea3ce40b4c19c4057e41c55d4a0f3d84ea71c325aa"
|
||||
dependencies = [
|
||||
"difference",
|
||||
"predicates-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "predicates-core"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "57e35a3326b75e49aa85f5dc6ec15b41108cf5aee58eabb1f274dd18b73c2451"
|
||||
|
||||
[[package]]
|
||||
name = "predicates-tree"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "15f553275e5721409451eb85e15fd9a860a6e5ab4496eb215987502b5f5391f2"
|
||||
dependencies = [
|
||||
"predicates-core",
|
||||
"treeline",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-crate"
|
||||
version = "0.1.5"
|
||||
@ -2113,6 +2192,19 @@ version = "0.5.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "941ba9d78d8e2f7ce474c015eea4d9c6d25b6a3327f9832ee29a4de27f91bbb8"
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.7.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
|
||||
dependencies = [
|
||||
"getrandom 0.1.16",
|
||||
"libc",
|
||||
"rand_chacha 0.2.2",
|
||||
"rand_core 0.5.1",
|
||||
"rand_hc 0.2.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.8.3"
|
||||
@ -2120,9 +2212,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"rand_chacha",
|
||||
"rand_core",
|
||||
"rand_hc",
|
||||
"rand_chacha 0.3.0",
|
||||
"rand_core 0.6.2",
|
||||
"rand_hc 0.3.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_chacha"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
|
||||
dependencies = [
|
||||
"ppv-lite86",
|
||||
"rand_core 0.5.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2132,7 +2234,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d"
|
||||
dependencies = [
|
||||
"ppv-lite86",
|
||||
"rand_core",
|
||||
"rand_core 0.6.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
|
||||
dependencies = [
|
||||
"getrandom 0.1.16",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2144,13 +2255,22 @@ dependencies = [
|
||||
"getrandom 0.2.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_hc"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
|
||||
dependencies = [
|
||||
"rand_core 0.5.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_hc"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73"
|
||||
dependencies = [
|
||||
"rand_core",
|
||||
"rand_core 0.6.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2159,7 +2279,7 @@ version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f"
|
||||
dependencies = [
|
||||
"rand_core",
|
||||
"rand_core 0.6.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2251,9 +2371,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "reqwest"
|
||||
version = "0.11.2"
|
||||
version = "0.11.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bf12057f289428dbf5c591c74bf10392e4a8003f993405a902f20117019022d4"
|
||||
checksum = "2296f2fac53979e8ccbc4a1136b25dcefd37be9ed7e4a1f6b05a6029c84ff124"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"bytes",
|
||||
@ -2507,6 +2627,18 @@ dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_yaml"
|
||||
version = "0.8.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "15654ed4ab61726bf918a39cb8d98a2e2995b002387807fa6ba58fdf7f59bb23"
|
||||
dependencies = [
|
||||
"dtoa",
|
||||
"linked-hash-map",
|
||||
"serde",
|
||||
"yaml-rust",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sha-1"
|
||||
version = "0.8.2"
|
||||
@ -2570,16 +2702,16 @@ checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e"
|
||||
|
||||
[[package]]
|
||||
name = "snarkvm-algorithms"
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "472ed062cdd1f54076312dd34e5fb56bd585c80c12209045f4b5bbbd368e9000"
|
||||
checksum = "bdf8ca73d429824090b96f751846e37e539f24c527f1f1ce0254984ade6d17b2"
|
||||
dependencies = [
|
||||
"blake2",
|
||||
"derivative",
|
||||
"digest 0.9.0",
|
||||
"itertools 0.10.0",
|
||||
"rand",
|
||||
"rand_chacha",
|
||||
"rand 0.8.3",
|
||||
"rand_chacha 0.3.0",
|
||||
"rayon",
|
||||
"sha2",
|
||||
"smallvec",
|
||||
@ -2593,12 +2725,12 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "snarkvm-curves"
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cdfdfa3aa137f64a7f49df03393e5d0269f133ca8c8c79e569cb3bb13181aeb2"
|
||||
checksum = "64610b135b8b1152439d5dfa4f745515933366082f08651961344aa0bb5abfca"
|
||||
dependencies = [
|
||||
"derivative",
|
||||
"rand",
|
||||
"rand 0.8.3",
|
||||
"rand_xorshift",
|
||||
"rustc_version 0.3.3",
|
||||
"serde",
|
||||
@ -2609,9 +2741,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "snarkvm-derives"
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6a2ba967601ff2534adbc6a71a691be4285e61c83d23d54a59824f8fa80f6038"
|
||||
checksum = "46c9829b6e2023b4c7c4d6c55e88fe755dd997171a6c9c063b75c28161d04326"
|
||||
dependencies = [
|
||||
"proc-macro-crate",
|
||||
"proc-macro-error",
|
||||
@ -2622,9 +2754,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "snarkvm-dpc"
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ff4cb55898089843ba44b9f96448dcb2badcc1ce12daa8d7365d4e41513e37bc"
|
||||
checksum = "491ae936e24e17c358d112ff8638b260500b5a982ecefc804861e28b5279f552"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"base58",
|
||||
@ -2633,7 +2765,7 @@ dependencies = [
|
||||
"derivative",
|
||||
"hex",
|
||||
"itertools 0.10.0",
|
||||
"rand",
|
||||
"rand 0.8.3",
|
||||
"snarkvm-algorithms",
|
||||
"snarkvm-curves",
|
||||
"snarkvm-fields",
|
||||
@ -2648,13 +2780,13 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "snarkvm-fields"
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ca9ea954196e76fe8968fb99eced7ccf08f901ab22747c4c489bda6674a7cb39"
|
||||
checksum = "8c49c69d02df11be58e07f626c9d6f5804c6dd4ccf42e425f2be8d79fe6e5bb7"
|
||||
dependencies = [
|
||||
"bincode",
|
||||
"derivative",
|
||||
"rand",
|
||||
"rand 0.8.3",
|
||||
"rand_xorshift",
|
||||
"serde",
|
||||
"snarkvm-utilities",
|
||||
@ -2663,9 +2795,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "snarkvm-gadgets"
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fdda42a0a6484d9f008801a8a4d494a69a4db3f7b317057a8cc3c6e4b3ef6884"
|
||||
checksum = "bd6f9ac2a166d926e1755a06fdae21ce40ce6164c75c89120401b8d78f3b7ba4"
|
||||
dependencies = [
|
||||
"derivative",
|
||||
"digest 0.9.0",
|
||||
@ -2680,16 +2812,16 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "snarkvm-objects"
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e20d13db49cedc147df06c4a6f2dd727ea25640bdf50b876f40005331767a68f"
|
||||
checksum = "9bd9779ec6ab9211f34a6ba25566feb575a396f4c41cc0e002ec2d48d7560a2a"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bincode",
|
||||
"chrono",
|
||||
"hex",
|
||||
"once_cell",
|
||||
"rand",
|
||||
"rand 0.8.3",
|
||||
"serde",
|
||||
"sha2",
|
||||
"snarkvm-algorithms",
|
||||
@ -2701,9 +2833,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "snarkvm-parameters"
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d35fa1819d803e45b4e99fe822e6981f177716f5384eef27245b5f6ed59a8305"
|
||||
checksum = "98378f612206fc7dd44a26f4e345bd1f3ba51bd325acad1e5cc3785d14750ec5"
|
||||
dependencies = [
|
||||
"curl",
|
||||
"hex",
|
||||
@ -2714,15 +2846,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "snarkvm-profiler"
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7834d57af37a31f2f280f08b61d07a04a9a4b7720819b06ca325da32a5a925f5"
|
||||
checksum = "b2460ac01c25f79f5ea306e4de82a1d4105e811f868206b4fd31c0c9b62a3d7b"
|
||||
|
||||
[[package]]
|
||||
name = "snarkvm-r1cs"
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0838118f276e7bb673cbf3741f4966c56861aaff399a46d343fc98c12851d9eb"
|
||||
checksum = "a3a0d54b15802976aff7522765dd29d5733f338612449629cc57c5a4a4d51f05"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"fxhash",
|
||||
@ -2735,15 +2867,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "snarkvm-storage"
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a42d92a817502878f315cc264704fa2a3d563755f16186316d8177ea685769af"
|
||||
checksum = "1d76881939f008d7bba4c8cc4118d29567b5c71908ad66bef9880f8aa7c52881"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bincode",
|
||||
"hex",
|
||||
"parking_lot",
|
||||
"rand",
|
||||
"rand 0.8.3",
|
||||
"rocksdb",
|
||||
"serde",
|
||||
"snarkvm-algorithms",
|
||||
@ -2756,12 +2888,12 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "snarkvm-utilities"
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5598f7f71c8aaf4fc267b5b420b2440a4d86c9243cecd57ff0af5c366217e5cc"
|
||||
checksum = "c763843fa67a3aa4ce68173c8cd96b4f04aaa135a5792bc051c36eec0fe1cd73"
|
||||
dependencies = [
|
||||
"bincode",
|
||||
"rand",
|
||||
"rand 0.8.3",
|
||||
"snarkvm-derives",
|
||||
"thiserror",
|
||||
]
|
||||
@ -2867,7 +2999,7 @@ checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"libc",
|
||||
"rand",
|
||||
"rand 0.8.3",
|
||||
"redox_syscall 0.2.5",
|
||||
"remove_dir_all",
|
||||
"winapi 0.3.9",
|
||||
@ -2903,6 +3035,15 @@ dependencies = [
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "test_dir"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e571ebf9127a9da821890a9fa8a8ef777fce3e0f959ff6949cf06ca8b736381d"
|
||||
dependencies = [
|
||||
"rand 0.7.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "textwrap"
|
||||
version = "0.11.0"
|
||||
@ -3115,6 +3256,12 @@ dependencies = [
|
||||
"tracing-serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "treeline"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a7f741b240f1a48843f9b8e0444fb55fb2a4ff67293b50a9179dfd5ea67f8d41"
|
||||
|
||||
[[package]]
|
||||
name = "try-lock"
|
||||
version = "0.2.3"
|
||||
@ -3232,6 +3379,15 @@ version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
|
||||
|
||||
[[package]]
|
||||
name = "wait-timeout"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "walkdir"
|
||||
version = "2.3.2"
|
||||
@ -3421,10 +3577,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "85e60b0d1b5f99db2556934e21937020776a5d31520bf169e851ac44e6420214"
|
||||
|
||||
[[package]]
|
||||
name = "zip"
|
||||
version = "0.5.10"
|
||||
name = "yaml-rust"
|
||||
version = "0.4.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a8977234acab718eb2820494b2f96cbb16004c19dddf88b7445b27381450997"
|
||||
checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85"
|
||||
dependencies = [
|
||||
"linked-hash-map",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zip"
|
||||
version = "0.5.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9c83dc9b784d252127720168abd71ea82bf8c3d96b17dc565b5e2a02854f2b27"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"bzip2",
|
||||
|
44
Cargo.toml
44
Cargo.toml
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "leo-lang"
|
||||
version = "1.2.3"
|
||||
version = "1.4.0"
|
||||
authors = [ "The Aleo Team <hello@aleo.org>" ]
|
||||
description = "The Leo programming language"
|
||||
homepage = "https://aleo.org"
|
||||
@ -27,6 +27,7 @@ path = "leo/main.rs"
|
||||
[workspace]
|
||||
members = [
|
||||
"asg",
|
||||
"asg-passes",
|
||||
"ast",
|
||||
"compiler",
|
||||
"grammar",
|
||||
@ -37,55 +38,54 @@ members = [
|
||||
"parser",
|
||||
"state",
|
||||
"synthesizer",
|
||||
"asg-passes",
|
||||
"test-framework"
|
||||
]
|
||||
|
||||
[dependencies.leo-ast]
|
||||
path = "./ast"
|
||||
version = "1.2.3"
|
||||
version = "1.4.0"
|
||||
|
||||
[dependencies.leo-compiler]
|
||||
path = "./compiler"
|
||||
version = "1.2.3"
|
||||
version = "1.4.0"
|
||||
|
||||
[dependencies.leo-imports]
|
||||
path = "./imports"
|
||||
version = "1.2.3"
|
||||
version = "1.4.0"
|
||||
|
||||
[dependencies.leo-input]
|
||||
path = "./input"
|
||||
version = "1.2.3"
|
||||
version = "1.4.0"
|
||||
|
||||
[dependencies.leo-package]
|
||||
path = "./package"
|
||||
version = "1.2.3"
|
||||
version = "1.4.0"
|
||||
|
||||
[dependencies.leo-state]
|
||||
path = "./state"
|
||||
version = "1.2.3"
|
||||
version = "1.4.0"
|
||||
|
||||
[dependencies.leo-synthesizer]
|
||||
path = "./synthesizer"
|
||||
version = "1.2.3"
|
||||
version = "1.4.0"
|
||||
|
||||
[dependencies.snarkvm-algorithms]
|
||||
version = "0.2.1"
|
||||
#default-features = false
|
||||
version = "0.2.2"
|
||||
|
||||
[dependencies.snarkvm-curves]
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
default-features = false
|
||||
|
||||
[dependencies.snarkvm-gadgets]
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
default-features = false
|
||||
|
||||
[dependencies.snarkvm-r1cs]
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
default-features = false
|
||||
|
||||
[dependencies.snarkvm-utilities]
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
|
||||
[dependencies.anyhow]
|
||||
version = "1.0"
|
||||
@ -112,7 +112,7 @@ version = "0.3.1"
|
||||
version = "1.4.0"
|
||||
|
||||
[dependencies.notify]
|
||||
version = "4.0.15"
|
||||
version = "4.0.16"
|
||||
|
||||
[dependencies.rand]
|
||||
version = "0.8"
|
||||
@ -121,7 +121,7 @@ version = "0.8"
|
||||
version = "0.6.2"
|
||||
|
||||
[dependencies.reqwest]
|
||||
version = "0.11.2"
|
||||
version = "0.11.3"
|
||||
features = [ "blocking", "json", "multipart" ]
|
||||
|
||||
[dependencies.self_update]
|
||||
@ -151,12 +151,22 @@ features = [ "fmt" ]
|
||||
[dependencies.zip]
|
||||
version = "0.5"
|
||||
|
||||
[target."cfg(windows)".dependencies.ansi_term]
|
||||
version = "0.12.1"
|
||||
|
||||
[dev-dependencies.rusty-hook]
|
||||
version = "0.11.2"
|
||||
|
||||
[dev-dependencies.assert_cmd]
|
||||
version = "1.0.3"
|
||||
|
||||
[dev-dependencies.test_dir]
|
||||
version = "0.1.0"
|
||||
|
||||
[features]
|
||||
default = [ ]
|
||||
ci_skip = [ "leo-compiler/ci_skip" ]
|
||||
noconfig = [ ]
|
||||
|
||||
[profile.release]
|
||||
opt-level = 3
|
||||
|
@ -95,9 +95,9 @@ This will generate an executable under the `./target/release` directory. To run
|
||||
Use the Leo CLI to create a new project
|
||||
|
||||
```bash
|
||||
# create a new `hello_world` Leo project
|
||||
leo new hello_world
|
||||
cd hello_world
|
||||
# create a new `hello-world` Leo project
|
||||
leo new hello-world
|
||||
cd hello-world
|
||||
|
||||
# build & setup & prove & verify
|
||||
leo run
|
||||
@ -113,6 +113,7 @@ Congratulations! You've just run your first Leo program.
|
||||
|
||||
* [Hello World - Next Steps](https://developer.aleo.org/developer/getting_started/hello_world)
|
||||
* [Leo Language Documentation](https://developer.aleo.org/developer/language/layout)
|
||||
* [Leo ABNF Grammar](./grammar/README.md)
|
||||
* [Leo CLI Documentation](https://developer.aleo.org/developer/cli/new)
|
||||
* [Homepage](https://developer.aleo.org/developer/getting_started/overview)
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "leo-asg-passes"
|
||||
version = "1.2.3"
|
||||
version = "1.4.0"
|
||||
authors = [ "The Aleo Team <hello@aleo.org>" ]
|
||||
description = "The Leo programming language"
|
||||
homepage = "https://aleo.org"
|
||||
@ -13,7 +13,7 @@ keywords = [
|
||||
"zero-knowledge"
|
||||
]
|
||||
categories = [ "cryptography::cryptocurrencies", "web-programming" ]
|
||||
include = [ "Cargo.toml", "leo", "README.md", "LICENSE.md" ]
|
||||
include = [ "Cargo.toml", "src", "README.md", "LICENSE.md" ]
|
||||
license = "GPL-3.0"
|
||||
edition = "2018"
|
||||
|
||||
@ -22,4 +22,4 @@ path = "src/lib.rs"
|
||||
|
||||
[dependencies.leo-asg]
|
||||
path = "../asg"
|
||||
version = "1.2.3"
|
||||
version = "1.4.0"
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "leo-asg"
|
||||
version = "1.2.3"
|
||||
version = "1.4.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.2.3"
|
||||
version = "1.4.0"
|
||||
path = "../ast"
|
||||
|
||||
[dependencies.leo-parser]
|
||||
version = "1.2.3"
|
||||
version = "1.4.0"
|
||||
path = "../parser"
|
||||
|
||||
[dependencies.num-bigint]
|
||||
|
@ -92,7 +92,7 @@ impl<'a> MonoidalReducerStatement<'a, BoolAnd> for ReturnPathReducer {
|
||||
if_true.append(if_false.unwrap_or(BoolAnd(false)))
|
||||
}
|
||||
|
||||
fn reduce_formatted_string(&mut self, input: &FormattedString, parameters: Vec<BoolAnd>) -> BoolAnd {
|
||||
fn reduce_formatted_string(&mut self, input: &FormatString, parameters: Vec<BoolAnd>) -> BoolAnd {
|
||||
BoolAnd(false)
|
||||
}
|
||||
|
||||
|
@ -172,6 +172,13 @@ impl AsgConvertError {
|
||||
)
|
||||
}
|
||||
|
||||
pub fn duplicate_function_definition(name: &str, span: &Span) -> Self {
|
||||
Self::new_from_span(
|
||||
format!("a function named \"{}\" already exists in this scope", name),
|
||||
span,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn index_into_non_tuple(name: &str, span: &Span) -> Self {
|
||||
Self::new_from_span(format!("failed to index into non-tuple '{}'", name), span)
|
||||
}
|
||||
@ -180,6 +187,14 @@ impl AsgConvertError {
|
||||
Self::new_from_span(format!("tuple index out of bounds: '{}'", index), span)
|
||||
}
|
||||
|
||||
pub fn array_index_out_of_bounds(index: usize, span: &Span) -> Self {
|
||||
Self::new_from_span(format!("array index out of bounds: '{}'", index), span)
|
||||
}
|
||||
|
||||
pub fn unknown_array_size(span: &Span) -> Self {
|
||||
Self::new_from_span("array size cannot be inferred, add explicit types".to_string(), span)
|
||||
}
|
||||
|
||||
pub fn unexpected_call_argument_count(expected: usize, got: usize, span: &Span) -> Self {
|
||||
Self::new_from_span(
|
||||
format!("function call expected {} arguments, got {}", expected, got),
|
||||
|
@ -89,8 +89,8 @@ impl<'a> FromAst<'a, leo_ast::ArrayAccessExpression> for ArrayAccessExpression<'
|
||||
&*value.array,
|
||||
Some(PartialType::Array(expected_type.map(Box::new), None)),
|
||||
)?;
|
||||
match array.get_type() {
|
||||
Some(Type::Array(..)) => (),
|
||||
let array_len = match array.get_type() {
|
||||
Some(Type::Array(_, len)) => len,
|
||||
type_ => {
|
||||
return Err(AsgConvertError::unexpected_type(
|
||||
"array",
|
||||
@ -98,7 +98,7 @@ impl<'a> FromAst<'a, leo_ast::ArrayAccessExpression> for ArrayAccessExpression<'
|
||||
&value.span,
|
||||
));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
let index = <&Expression<'a>>::from_ast(
|
||||
scope,
|
||||
@ -106,10 +106,17 @@ impl<'a> FromAst<'a, leo_ast::ArrayAccessExpression> for ArrayAccessExpression<'
|
||||
Some(PartialType::Integer(None, Some(IntegerType::U32))),
|
||||
)?;
|
||||
|
||||
if !index.is_consty() {
|
||||
return Err(AsgConvertError::unexpected_nonconst(
|
||||
&index.span().cloned().unwrap_or_default(),
|
||||
));
|
||||
if let Some(index) = index
|
||||
.const_value()
|
||||
.map(|x| x.int().map(|x| x.to_usize()).flatten())
|
||||
.flatten()
|
||||
{
|
||||
if index >= array_len {
|
||||
return Err(AsgConvertError::array_index_out_of_bounds(
|
||||
index,
|
||||
&array.span().cloned().unwrap_or_default(),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
Ok(ArrayAccessExpression {
|
||||
|
@ -26,6 +26,9 @@ pub struct ArrayRangeAccessExpression<'a> {
|
||||
pub array: Cell<&'a Expression<'a>>,
|
||||
pub left: Cell<Option<&'a Expression<'a>>>,
|
||||
pub right: Cell<Option<&'a Expression<'a>>>,
|
||||
// this is either const(right) - const(left) OR the length inferred by type checking
|
||||
// special attention must be made to update this if semantic-altering changes are made to left or right.
|
||||
pub length: usize,
|
||||
}
|
||||
|
||||
impl<'a> Node for ArrayRangeAccessExpression<'a> {
|
||||
@ -55,25 +58,12 @@ impl<'a> ExpressionNode<'a> for ArrayRangeAccessExpression<'a> {
|
||||
}
|
||||
|
||||
fn get_type(&self) -> Option<Type<'a>> {
|
||||
let (element, array_len) = match self.array.get().get_type() {
|
||||
Some(Type::Array(element, len)) => (element, len),
|
||||
let element = match self.array.get().get_type() {
|
||||
Some(Type::Array(element, _)) => element,
|
||||
_ => return None,
|
||||
};
|
||||
let const_left = match self.left.get().map(|x| x.const_value()) {
|
||||
Some(Some(ConstValue::Int(x))) => x.to_usize()?,
|
||||
None => 0,
|
||||
_ => return None,
|
||||
};
|
||||
let const_right = match self.right.get().map(|x| x.const_value()) {
|
||||
Some(Some(ConstValue::Int(x))) => x.to_usize()?,
|
||||
None => array_len,
|
||||
_ => return None,
|
||||
};
|
||||
if const_left > const_right || const_right > array_len {
|
||||
return None;
|
||||
}
|
||||
|
||||
Some(Type::Array(element, const_right - const_left))
|
||||
Some(Type::Array(element, self.length))
|
||||
}
|
||||
|
||||
fn is_mut_ref(&self) -> bool {
|
||||
@ -113,9 +103,9 @@ impl<'a> FromAst<'a, leo_ast::ArrayRangeAccessExpression> for ArrayRangeAccessEx
|
||||
value: &leo_ast::ArrayRangeAccessExpression,
|
||||
expected_type: Option<PartialType<'a>>,
|
||||
) -> Result<ArrayRangeAccessExpression<'a>, AsgConvertError> {
|
||||
let expected_array = match expected_type {
|
||||
Some(PartialType::Array(element, _len)) => Some(PartialType::Array(element, None)),
|
||||
None => None,
|
||||
let (expected_array, expected_len) = match expected_type.clone() {
|
||||
Some(PartialType::Array(element, len)) => (Some(PartialType::Array(element, None)), len),
|
||||
None => (None, None),
|
||||
Some(x) => {
|
||||
return Err(AsgConvertError::unexpected_type(
|
||||
&x.to_string(),
|
||||
@ -126,8 +116,8 @@ impl<'a> FromAst<'a, leo_ast::ArrayRangeAccessExpression> for ArrayRangeAccessEx
|
||||
};
|
||||
let array = <&Expression<'a>>::from_ast(scope, &*value.array, expected_array)?;
|
||||
let array_type = array.get_type();
|
||||
match array_type {
|
||||
Some(Type::Array(_, _)) => (),
|
||||
let (parent_element, parent_size) = match array_type {
|
||||
Some(Type::Array(inner, size)) => (inner, size),
|
||||
type_ => {
|
||||
return Err(AsgConvertError::unexpected_type(
|
||||
"array",
|
||||
@ -135,7 +125,8 @@ impl<'a> FromAst<'a, leo_ast::ArrayRangeAccessExpression> for ArrayRangeAccessEx
|
||||
&value.span,
|
||||
));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
let left = value
|
||||
.left
|
||||
.as_deref()
|
||||
@ -151,26 +142,72 @@ impl<'a> FromAst<'a, leo_ast::ArrayRangeAccessExpression> for ArrayRangeAccessEx
|
||||
})
|
||||
.transpose()?;
|
||||
|
||||
if let Some(left) = left.as_ref() {
|
||||
if !left.is_consty() {
|
||||
return Err(AsgConvertError::unexpected_nonconst(
|
||||
&left.span().cloned().unwrap_or_default(),
|
||||
));
|
||||
let const_left = match left.map(|x| x.const_value()) {
|
||||
Some(Some(ConstValue::Int(x))) => x.to_usize(),
|
||||
None => Some(0),
|
||||
_ => None,
|
||||
};
|
||||
let const_right = match right.map(|x| x.const_value()) {
|
||||
Some(Some(ConstValue::Int(value))) => {
|
||||
let value = value.to_usize();
|
||||
if let Some(value) = value {
|
||||
if value > parent_size {
|
||||
return Err(AsgConvertError::array_index_out_of_bounds(
|
||||
value,
|
||||
&right.unwrap().span().cloned().unwrap_or_default(),
|
||||
));
|
||||
} else if let Some(left) = const_left {
|
||||
if left > value {
|
||||
return Err(AsgConvertError::array_index_out_of_bounds(
|
||||
value,
|
||||
&right.unwrap().span().cloned().unwrap_or_default(),
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
value
|
||||
}
|
||||
}
|
||||
if let Some(right) = right.as_ref() {
|
||||
if !right.is_consty() {
|
||||
return Err(AsgConvertError::unexpected_nonconst(
|
||||
&right.span().cloned().unwrap_or_default(),
|
||||
));
|
||||
None => Some(parent_size),
|
||||
_ => None,
|
||||
};
|
||||
|
||||
let mut length = if let (Some(left), Some(right)) = (const_left, const_right) {
|
||||
Some(right - left)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
if let Some(expected_len) = expected_len {
|
||||
if let Some(length) = length {
|
||||
if length != expected_len {
|
||||
let concrete_type = Type::Array(parent_element, length);
|
||||
return Err(AsgConvertError::unexpected_type(
|
||||
&expected_type.as_ref().unwrap().to_string(),
|
||||
Some(&concrete_type.to_string()),
|
||||
&value.span,
|
||||
));
|
||||
}
|
||||
}
|
||||
if let Some(value) = const_left {
|
||||
if value + expected_len > parent_size {
|
||||
return Err(AsgConvertError::array_index_out_of_bounds(
|
||||
value,
|
||||
&left.unwrap().span().cloned().unwrap_or_default(),
|
||||
));
|
||||
}
|
||||
}
|
||||
length = Some(expected_len);
|
||||
}
|
||||
if length.is_none() {
|
||||
return Err(AsgConvertError::unknown_array_size(&value.span));
|
||||
}
|
||||
|
||||
Ok(ArrayRangeAccessExpression {
|
||||
parent: Cell::new(None),
|
||||
span: Some(value.span.clone()),
|
||||
array: Cell::new(array),
|
||||
left: Cell::new(left),
|
||||
right: Cell::new(right),
|
||||
length: length.unwrap(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ impl<'a> ExpressionNode<'a> for CallExpression<'a> {
|
||||
}
|
||||
|
||||
fn is_mut_ref(&self) -> bool {
|
||||
false
|
||||
true
|
||||
}
|
||||
|
||||
fn const_value(&self) -> Option<ConstValue> {
|
||||
|
@ -67,7 +67,7 @@ impl<'a> ExpressionNode<'a> for CircuitInitExpression<'a> {
|
||||
}
|
||||
|
||||
fn is_mut_ref(&self) -> bool {
|
||||
false
|
||||
true
|
||||
}
|
||||
|
||||
fn const_value(&self) -> Option<ConstValue> {
|
||||
|
@ -137,13 +137,6 @@ impl<'a> FromAst<'a, leo_ast::Identifier> for &'a Expression<'a> {
|
||||
expected_type: Option<PartialType<'a>>,
|
||||
) -> Result<&'a Expression<'a>, AsgConvertError> {
|
||||
let variable = if value.name.as_ref() == "input" {
|
||||
if let Some(function) = scope.resolve_current_function() {
|
||||
if !function.has_input {
|
||||
return Err(AsgConvertError::unresolved_reference(&value.name, &value.span));
|
||||
}
|
||||
} else {
|
||||
return Err(AsgConvertError::unresolved_reference(&value.name, &value.span));
|
||||
}
|
||||
if let Some(input) = scope.resolve_input() {
|
||||
input.container
|
||||
} else {
|
||||
|
@ -29,7 +29,7 @@ pub fn resolve_core_module<'a>(context: AsgContext<'a>, module: &str) -> Result<
|
||||
r#"
|
||||
circuit Blake2s {
|
||||
function hash(seed: [u8; 32], message: [u8; 32]) -> [u8; 32] {
|
||||
return [0; 32]
|
||||
return [0; 32];
|
||||
}
|
||||
}
|
||||
"#,
|
||||
|
@ -47,7 +47,6 @@ pub struct Function<'a> {
|
||||
pub id: u32,
|
||||
pub name: RefCell<Identifier>,
|
||||
pub output: Type<'a>,
|
||||
pub has_input: bool,
|
||||
pub arguments: IndexMap<String, Cell<&'a Variable<'a>>>,
|
||||
pub circuit: Cell<Option<&'a Circuit<'a>>>,
|
||||
pub span: Option<Span>,
|
||||
@ -77,16 +76,12 @@ impl<'a> Function<'a> {
|
||||
.transpose()?
|
||||
.unwrap_or_else(|| Type::Tuple(vec![]));
|
||||
let mut qualifier = FunctionQualifier::Static;
|
||||
let mut has_input = false;
|
||||
let new_scope = scope.make_subscope();
|
||||
|
||||
let mut arguments = IndexMap::new();
|
||||
{
|
||||
for input in value.input.iter() {
|
||||
match input {
|
||||
FunctionInput::InputKeyword(_) => {
|
||||
has_input = true;
|
||||
}
|
||||
FunctionInput::SelfKeyword(_) => {
|
||||
qualifier = FunctionQualifier::SelfRef;
|
||||
}
|
||||
@ -125,7 +120,6 @@ impl<'a> Function<'a> {
|
||||
id: scope.context.get_id(),
|
||||
name: RefCell::new(value.identifier.clone()),
|
||||
output,
|
||||
has_input,
|
||||
arguments,
|
||||
circuit: Cell::new(None),
|
||||
body: Cell::new(None),
|
||||
|
@ -306,7 +306,13 @@ impl<'a> Program<'a> {
|
||||
|
||||
asg_function.fill_from_ast(function)?;
|
||||
|
||||
functions.insert(name.name.to_string(), asg_function);
|
||||
let name = name.name.to_string();
|
||||
|
||||
if functions.contains_key(&name) {
|
||||
return Err(AsgConvertError::duplicate_function_definition(&name, &function.span));
|
||||
}
|
||||
|
||||
functions.insert(name, asg_function);
|
||||
}
|
||||
|
||||
let mut circuits = IndexMap::new();
|
||||
|
@ -225,7 +225,7 @@ impl<'a, T: Monoid, R: MonoidalReducerStatement<'a, T>> MonoidalDirector<'a, T,
|
||||
.reduce_conditional_statement(input, condition, if_true, if_false)
|
||||
}
|
||||
|
||||
pub fn reduce_formatted_string(&mut self, input: &FormattedString<'a>) -> T {
|
||||
pub fn reduce_formatted_string(&mut self, input: &FormatString<'a>) -> T {
|
||||
let parameters = input
|
||||
.parameters
|
||||
.iter()
|
||||
|
@ -118,7 +118,7 @@ pub trait MonoidalReducerStatement<'a, T: Monoid>: MonoidalReducerExpression<'a,
|
||||
condition.append(if_true).append_option(if_false)
|
||||
}
|
||||
|
||||
fn reduce_formatted_string(&mut self, input: &FormattedString<'a>, parameters: Vec<T>) -> T {
|
||||
fn reduce_formatted_string(&mut self, input: &FormatString<'a>, parameters: Vec<T>) -> T {
|
||||
T::default().append_all(parameters.into_iter())
|
||||
}
|
||||
|
||||
|
@ -243,7 +243,7 @@ impl<'a, R: ReconstructingReducerStatement<'a>> ReconstructingDirector<'a, R> {
|
||||
.reduce_conditional_statement(input, condition, if_true, if_false)
|
||||
}
|
||||
|
||||
pub fn reduce_formatted_string(&mut self, input: FormattedString<'a>) -> FormattedString<'a> {
|
||||
pub fn reduce_formatted_string(&mut self, input: FormatString<'a>) -> FormatString<'a> {
|
||||
let parameters = input
|
||||
.parameters
|
||||
.iter()
|
||||
|
@ -74,6 +74,7 @@ pub trait ReconstructingReducerExpression<'a> {
|
||||
left: Cell::new(left),
|
||||
right: Cell::new(right),
|
||||
span: input.span,
|
||||
length: input.length,
|
||||
})
|
||||
}
|
||||
|
||||
@ -273,10 +274,10 @@ pub trait ReconstructingReducerStatement<'a>: ReconstructingReducerExpression<'a
|
||||
|
||||
fn reduce_formatted_string(
|
||||
&mut self,
|
||||
input: FormattedString<'a>,
|
||||
input: FormatString<'a>,
|
||||
parameters: Vec<&'a Expression<'a>>,
|
||||
) -> FormattedString<'a> {
|
||||
FormattedString {
|
||||
) -> FormatString<'a> {
|
||||
FormatString {
|
||||
span: input.span,
|
||||
parts: input.parts,
|
||||
parameters: parameters.into_iter().map(Cell::new).collect(),
|
||||
@ -292,7 +293,7 @@ pub trait ReconstructingReducerStatement<'a>: ReconstructingReducerExpression<'a
|
||||
})
|
||||
}
|
||||
|
||||
fn reduce_console_log(&mut self, input: ConsoleStatement<'a>, argument: FormattedString<'a>) -> Statement<'a> {
|
||||
fn reduce_console_log(&mut self, input: ConsoleStatement<'a>, argument: FormatString<'a>) -> Statement<'a> {
|
||||
assert!(!matches!(input.function, ConsoleFunction::Assert(_)));
|
||||
Statement::Console(ConsoleStatement {
|
||||
parent: input.parent,
|
||||
|
@ -120,7 +120,7 @@ pub trait StatementVisitor<'a>: ExpressionVisitor<'a> {
|
||||
Default::default()
|
||||
}
|
||||
|
||||
fn visit_formatted_string(&mut self, input: &FormattedString<'a>) -> VisitResult {
|
||||
fn visit_formatted_string(&mut self, input: &FormatString<'a>) -> VisitResult {
|
||||
Default::default()
|
||||
}
|
||||
|
||||
|
@ -319,7 +319,7 @@ impl<'a, R: StatementVisitor<'a>> VisitorDirector<'a, R> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn visit_formatted_string(&mut self, input: &FormattedString<'a>) -> ConcreteVisitResult {
|
||||
pub fn visit_formatted_string(&mut self, input: &FormatString<'a>) -> ConcreteVisitResult {
|
||||
match self.visitor.visit_formatted_string(input) {
|
||||
VisitResult::VisitChildren => {
|
||||
for parameter in input.parameters.iter() {
|
||||
|
@ -70,13 +70,6 @@ impl<'a> FromAst<'a, leo_ast::AssignStatement> for &'a Statement<'a> {
|
||||
let (name, span) = (&statement.assignee.identifier.name, &statement.assignee.identifier.span);
|
||||
|
||||
let variable = if name.as_ref() == "input" {
|
||||
if let Some(function) = scope.resolve_current_function() {
|
||||
if !function.has_input {
|
||||
return Err(AsgConvertError::unresolved_reference(name, &span));
|
||||
}
|
||||
} else {
|
||||
return Err(AsgConvertError::unresolved_reference(name, &span));
|
||||
}
|
||||
if let Some(input) = scope.resolve_input() {
|
||||
input.container
|
||||
} else {
|
||||
|
@ -15,14 +15,14 @@
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{AsgConvertError, Expression, FromAst, Node, PartialType, Scope, Span, Statement, Type};
|
||||
use leo_ast::{ConsoleFunction as AstConsoleFunction, FormattedStringPart};
|
||||
use leo_ast::{ConsoleFunction as AstConsoleFunction, FormatStringPart};
|
||||
|
||||
use std::cell::Cell;
|
||||
|
||||
// TODO (protryon): Refactor to not require/depend on span
|
||||
#[derive(Clone)]
|
||||
pub struct FormattedString<'a> {
|
||||
pub parts: Vec<FormattedStringPart>,
|
||||
pub struct FormatString<'a> {
|
||||
pub parts: Vec<FormatStringPart>,
|
||||
pub parameters: Vec<Cell<&'a Expression<'a>>>,
|
||||
pub span: Span,
|
||||
}
|
||||
@ -30,9 +30,9 @@ pub struct FormattedString<'a> {
|
||||
#[derive(Clone)]
|
||||
pub enum ConsoleFunction<'a> {
|
||||
Assert(Cell<&'a Expression<'a>>),
|
||||
Debug(FormattedString<'a>),
|
||||
Error(FormattedString<'a>),
|
||||
Log(FormattedString<'a>),
|
||||
Debug(FormatString<'a>),
|
||||
Error(FormatString<'a>),
|
||||
Log(FormatString<'a>),
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
@ -48,16 +48,16 @@ impl<'a> Node for ConsoleStatement<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FromAst<'a, leo_ast::FormattedString> for FormattedString<'a> {
|
||||
impl<'a> FromAst<'a, leo_ast::FormatString> for FormatString<'a> {
|
||||
fn from_ast(
|
||||
scope: &'a Scope<'a>,
|
||||
value: &leo_ast::FormattedString,
|
||||
value: &leo_ast::FormatString,
|
||||
_expected_type: Option<PartialType<'a>>,
|
||||
) -> Result<Self, AsgConvertError> {
|
||||
let expected_param_len = value
|
||||
.parts
|
||||
.iter()
|
||||
.filter(|x| matches!(x, FormattedStringPart::Container))
|
||||
.filter(|x| matches!(x, FormatStringPart::Container))
|
||||
.count();
|
||||
if value.parameters.len() != expected_param_len {
|
||||
// + 1 for formatting string as to not confuse user
|
||||
@ -71,7 +71,7 @@ impl<'a> FromAst<'a, leo_ast::FormattedString> for FormattedString<'a> {
|
||||
for parameter in value.parameters.iter() {
|
||||
parameters.push(Cell::new(<&Expression<'a>>::from_ast(scope, parameter, None)?));
|
||||
}
|
||||
Ok(FormattedString {
|
||||
Ok(FormatString {
|
||||
parts: value.parts.clone(),
|
||||
parameters,
|
||||
span: value.span.clone(),
|
||||
@ -79,9 +79,9 @@ impl<'a> FromAst<'a, leo_ast::FormattedString> for FormattedString<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Into<leo_ast::FormattedString> for &FormattedString<'a> {
|
||||
fn into(self) -> leo_ast::FormattedString {
|
||||
leo_ast::FormattedString {
|
||||
impl<'a> Into<leo_ast::FormatString> for &FormatString<'a> {
|
||||
fn into(self) -> leo_ast::FormatString {
|
||||
leo_ast::FormatString {
|
||||
parts: self.parts.clone(),
|
||||
parameters: self.parameters.iter().map(|e| e.get().into()).collect(),
|
||||
span: self.span.clone(),
|
||||
@ -103,13 +103,13 @@ impl<'a> FromAst<'a, leo_ast::ConsoleStatement> for ConsoleStatement<'a> {
|
||||
<&Expression<'a>>::from_ast(scope, expression, Some(Type::Boolean.into()))?,
|
||||
)),
|
||||
AstConsoleFunction::Debug(formatted_string) => {
|
||||
ConsoleFunction::Debug(FormattedString::from_ast(scope, formatted_string, None)?)
|
||||
ConsoleFunction::Debug(FormatString::from_ast(scope, formatted_string, None)?)
|
||||
}
|
||||
AstConsoleFunction::Error(formatted_string) => {
|
||||
ConsoleFunction::Error(FormattedString::from_ast(scope, formatted_string, None)?)
|
||||
ConsoleFunction::Error(FormatString::from_ast(scope, formatted_string, None)?)
|
||||
}
|
||||
AstConsoleFunction::Log(formatted_string) => {
|
||||
ConsoleFunction::Log(FormattedString::from_ast(scope, formatted_string, None)?)
|
||||
ConsoleFunction::Log(FormatString::from_ast(scope, formatted_string, None)?)
|
||||
}
|
||||
},
|
||||
})
|
||||
|
@ -54,7 +54,7 @@ impl<'a> FromAst<'a, leo_ast::IterationStatement> for &'a Statement<'a> {
|
||||
statement: &leo_ast::IterationStatement,
|
||||
_expected_type: Option<PartialType<'a>>,
|
||||
) -> Result<Self, AsgConvertError> {
|
||||
let expected_index_type = Some(PartialType::Integer(None, Some(IntegerType::U32)));
|
||||
let expected_index_type = Some(PartialType::Integer(Some(IntegerType::U32), None));
|
||||
let start = <&Expression<'a>>::from_ast(scope, &statement.start, expected_index_type.clone())?;
|
||||
let stop = <&Expression<'a>>::from_ast(scope, &statement.stop, expected_index_type)?;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
circuit Foo {
|
||||
function echo(x: u32) -> u32 {
|
||||
return x
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
circuit Foo {
|
||||
function echo(x: u32) -> u32 {
|
||||
return x
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
circuit Foo {
|
||||
function echo(x: u32) -> u32 {
|
||||
return x
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
circuit Foo {
|
||||
function echo(x: u32) -> u32 {
|
||||
return x
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ fn test_mut_member_function_fail() {
|
||||
let program_string = r#"
|
||||
circuit Foo {
|
||||
function echo(mut self, x: u32) -> u32 {
|
||||
return x
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@ circuit Foo {
|
||||
f: u32,
|
||||
|
||||
function bar() -> u32 {
|
||||
return f
|
||||
return f;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
circuit Foo {
|
||||
function bar() -> u32 {
|
||||
return self.f
|
||||
return self.f;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
function main () -> i8 {
|
||||
if true {
|
||||
return 1i8 //ignored
|
||||
return 1i8; //ignored
|
||||
}
|
||||
return 2i8 //ignored
|
||||
return 3i8 //returns
|
||||
return 2i8; //ignored
|
||||
return 3i8; //returns
|
||||
}
|
@ -2,8 +2,8 @@ function main () -> u16 {
|
||||
if false {
|
||||
const a = 1u16;
|
||||
const b = a + 1u16;
|
||||
return b
|
||||
return b;
|
||||
} else if false {
|
||||
return 0u16
|
||||
return 0u16;
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
function main(input) -> u32 {
|
||||
if input.registers.a == 0 {
|
||||
return 0u32
|
||||
return 0u32;
|
||||
} else {
|
||||
return 1u32
|
||||
return 1u32;
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
function foo() -> field {
|
||||
return myGlobal
|
||||
return myGlobal;
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
@ -1,3 +1,3 @@
|
||||
function main() -> (bool, bool) {
|
||||
return true
|
||||
return true;
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
function main() {
|
||||
const address_1 = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8);
|
||||
const address_2 = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8);
|
||||
const address_1 = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;
|
||||
const address_2 = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;
|
||||
|
||||
console.assert(address_1 == address_2);
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
function main(owner: address) {
|
||||
const sender = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8);
|
||||
const sender = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;
|
||||
|
||||
console.assert(owner == sender);
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
function main(s: bool, c: address) {
|
||||
const a = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8);
|
||||
const b = address(aleo18qgam03qe483tdrcc3fkqwpp38ehff4a2xma6lu7hams6lfpgcpq3dq05r);
|
||||
const a = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;
|
||||
const b = aleo18qgam03qe483tdrcc3fkqwpp38ehff4a2xma6lu7hams6lfpgcpq3dq05r;
|
||||
|
||||
const r = s? a: b;
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
function main() {
|
||||
const public_key_string = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8);
|
||||
const public_key_string = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;
|
||||
}
|
@ -1,3 +1,3 @@
|
||||
function main(input) -> [u8; 3] {
|
||||
return input.registers.r
|
||||
}
|
||||
function main() -> [u8; 3] {
|
||||
return input.registers.r;
|
||||
}
|
||||
|
@ -1,3 +1,3 @@
|
||||
function main(input) -> bool {
|
||||
return input.registers.r
|
||||
}
|
||||
function main() -> bool {
|
||||
return input.registers.r;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
circuit Foo {
|
||||
function echo(self, x: u32) -> u32 {
|
||||
return x
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,11 +2,11 @@ circuit Foo {
|
||||
x: u32,
|
||||
|
||||
function add_x(self, y: u32) -> u32 {
|
||||
return self.x + y
|
||||
return self.x + y;
|
||||
}
|
||||
|
||||
function call_add_x(self, y: u32) -> u32 {
|
||||
return self.add_x(y)
|
||||
return self.add_x(y);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
circuit Foo {
|
||||
function echo(x: u32) -> u32 {
|
||||
return x
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@ circuit Foo {
|
||||
foo: u32,
|
||||
|
||||
function bar() -> u32 {
|
||||
return 1u32
|
||||
return 1u32;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ fn test_mut_member_function() {
|
||||
let program_string = r#"
|
||||
circuit Foo {
|
||||
function echo(mut self, x: u32) -> u32 {
|
||||
return x
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@ circuit PedersenHash {
|
||||
parameters: [u32; 512]
|
||||
|
||||
function new(parameters: [u32; 512]) -> Self {
|
||||
return Self { parameters: parameters }
|
||||
return Self { parameters: parameters };
|
||||
}
|
||||
|
||||
function hash(self, bits: [bool; 512]) -> u32 {
|
||||
@ -11,7 +11,7 @@ circuit PedersenHash {
|
||||
const base = bits[i] ? self.parameters[i] : 0u32;
|
||||
digest += base;
|
||||
}
|
||||
return digest
|
||||
return digest;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
circuit Foo {
|
||||
static function new() -> Self {
|
||||
return Self { }
|
||||
return Self { };
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@ circuit Foo {
|
||||
f: u32,
|
||||
|
||||
function bar(self) -> u32 {
|
||||
return self.f
|
||||
return self.f;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import core.unstable.blake2s.Blake2s;
|
||||
|
||||
function main(seed: [u8; 32], message: [u8; 32]) -> [u8; 32] {
|
||||
return Blake2s::hash(seed, message)
|
||||
return Blake2s::hash(seed, message);
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ fn test_function_rename() {
|
||||
a += 1;
|
||||
}
|
||||
|
||||
return a
|
||||
return a;
|
||||
}
|
||||
|
||||
function main() {
|
||||
@ -63,7 +63,7 @@ fn test_imports() {
|
||||
}
|
||||
|
||||
function foo() -> u32 {
|
||||
return 1u32
|
||||
return 1u32;
|
||||
}
|
||||
"#;
|
||||
imports
|
||||
|
@ -1,5 +1,5 @@
|
||||
function one() -> u32 {
|
||||
return 1u32
|
||||
return 1u32;
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
@ -5,7 +5,7 @@ function iteration() -> u32 {
|
||||
a += 1;
|
||||
}
|
||||
|
||||
return a
|
||||
return a;
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
@ -32,7 +32,7 @@ fn test_iteration() {
|
||||
fn test_const_args() {
|
||||
let program_string = r#"
|
||||
function one(const value: u32) -> u32 {
|
||||
return value + 1
|
||||
return value + 1;
|
||||
}
|
||||
|
||||
function main() {
|
||||
@ -52,7 +52,7 @@ fn test_const_args() {
|
||||
fn test_const_args_used() {
|
||||
let program_string = r#"
|
||||
function index(arr: [u8; 3], const value: u32) -> u8 {
|
||||
return arr[value]
|
||||
return arr[value];
|
||||
}
|
||||
|
||||
function main() {
|
||||
@ -73,7 +73,7 @@ fn test_const_args_used() {
|
||||
fn test_const_args_fail() {
|
||||
let program_string = r#"
|
||||
function index(arr: [u8; 3], const value: u32) -> u8 {
|
||||
return arr[value]
|
||||
return arr[value];
|
||||
}
|
||||
|
||||
function main(x_value: u32) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
function tuple() -> (bool, bool) {
|
||||
return (true, false)
|
||||
return (true, false);
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
@ -1,3 +1,3 @@
|
||||
function main(input) -> (bool, bool) {
|
||||
return (input.registers.a, input.registers.b)
|
||||
}
|
||||
function main() -> (bool, bool) {
|
||||
return (input.registers.a, input.registers.b);
|
||||
}
|
||||
|
@ -5,5 +5,5 @@ function main(
|
||||
u32,
|
||||
u32,
|
||||
) {
|
||||
return (a, b)
|
||||
return (a, b);
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
function one() -> bool {
|
||||
return true
|
||||
return true;
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
function one() -> u32 {
|
||||
return 1u32
|
||||
return 1u32;
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
@ -1,9 +1,9 @@
|
||||
function array_3x2_nested() -> [[u8; 2]; 3] {
|
||||
return [[0u8; 2]; 3]
|
||||
return [[0u8; 2]; 3];
|
||||
}
|
||||
|
||||
function array_3x2_tuple() -> [[u8; 2]; 3] {
|
||||
return [0u8; (3, 2)]
|
||||
return [0u8; (3, 2)];
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
@ -1,9 +1,9 @@
|
||||
function array_3x2_nested() -> [u8; (3, 2)] {
|
||||
return [[0u8; 2]; 3]
|
||||
return [[0u8; 2]; 3];
|
||||
}
|
||||
|
||||
function array_3x2_tuple() -> [u8; (3, 2)] {
|
||||
return [0u8; (3, 2)]
|
||||
return [0u8; (3, 2)];
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
@ -3,7 +3,7 @@ function tuples() -> ((u8, u8), u32) {
|
||||
const a: (u8, u8) = (1, 2);
|
||||
const b: u32 = 3;
|
||||
|
||||
return (a, b)
|
||||
return (a, b);
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
@ -4,9 +4,9 @@ function tuple_conditional () -> (
|
||||
i64
|
||||
) {
|
||||
if true {
|
||||
return (1, 1)
|
||||
return (1, 1);
|
||||
} else {
|
||||
return (2, 2)
|
||||
return (2, 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,5 +4,5 @@ circuit Point {
|
||||
}
|
||||
|
||||
function foo() -> u32 {
|
||||
return 1u32
|
||||
return 1u32;
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
function main(input, data: [u8; 32]) {
|
||||
function main(data: [u8; 32]) {
|
||||
console.assert(input.registers.value_balance == 0u64);
|
||||
|
||||
console.assert(input.state.leaf_index == 0u32);
|
||||
|
@ -1,4 +1,4 @@
|
||||
function main(input) {
|
||||
function main() {
|
||||
console.assert(input.state.root == [0u8; 32]);
|
||||
|
||||
const expected: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;
|
||||
|
@ -1,3 +1,3 @@
|
||||
function main(input) {
|
||||
function main() {
|
||||
console.assert(input.state.root == [0u8; 32]);
|
||||
}
|
@ -3,7 +3,7 @@ function swap(a: [u32; 2], const i: u32, const j: u32) -> [u32; 2] {
|
||||
const t = a[i];
|
||||
a[i] = a[j];
|
||||
a[j] = t;
|
||||
return a
|
||||
return a;
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
@ -1,7 +1,7 @@
|
||||
function main(input) -> u32 {
|
||||
function main() -> u32 {
|
||||
if input.registers.a == 0u32 {
|
||||
return 0u32
|
||||
return 0u32;
|
||||
} else {
|
||||
return 1u32
|
||||
return 1u32;
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
function foo() -> (bool, bool) {
|
||||
return (true, false)
|
||||
return (true, false);
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
function foo() -> (bool, bool) {
|
||||
return (true, false)
|
||||
return (true, false);
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
function foo() -> (bool, bool) {
|
||||
return (true, false)
|
||||
return (true, false);
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "leo-ast"
|
||||
version = "1.2.3"
|
||||
version = "1.4.0"
|
||||
authors = [ "The Aleo Team <hello@aleo.org>" ]
|
||||
description = "Core AST of the Leo programming language"
|
||||
homepage = "https://aleo.org"
|
||||
@ -19,7 +19,7 @@ edition = "2018"
|
||||
|
||||
[dependencies.leo-input]
|
||||
path = "../input"
|
||||
version = "1.2.3"
|
||||
version = "1.4.0"
|
||||
|
||||
[dependencies.indexmap]
|
||||
version = "1.6.2"
|
||||
@ -30,7 +30,7 @@ version = "2.0"
|
||||
|
||||
[dependencies.serde]
|
||||
version = "1.0"
|
||||
features = ["derive", "rc"]
|
||||
features = [ "derive", "rc" ]
|
||||
|
||||
[dependencies.serde_json]
|
||||
version = "1.0"
|
||||
|
@ -26,18 +26,6 @@ use std::fmt;
|
||||
pub struct ArrayDimensions(pub Vec<PositiveNumber>);
|
||||
|
||||
impl ArrayDimensions {
|
||||
///
|
||||
/// Creates a new `PositiveNumber` from the given `usize` and `Span`.
|
||||
/// Appends the new `PositiveNumber` to the array dimensions.
|
||||
///
|
||||
pub fn push_usize(&mut self, number: usize) {
|
||||
let positive_number = PositiveNumber {
|
||||
value: number.to_string().into(),
|
||||
};
|
||||
|
||||
self.0.push(positive_number)
|
||||
}
|
||||
|
||||
///
|
||||
/// Appends a vector of array dimensions to the self array dimensions.
|
||||
///
|
||||
|
@ -23,9 +23,6 @@ pub use const_self_keyword::*;
|
||||
pub mod identifier;
|
||||
pub use identifier::*;
|
||||
|
||||
pub mod input_keyword;
|
||||
pub use input_keyword::*;
|
||||
|
||||
pub mod mut_self_keyword;
|
||||
pub use mut_self_keyword::*;
|
||||
|
||||
|
@ -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::{FormattedError, Span};
|
||||
use crate::{FormattedError, LeoError, Span};
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum CanonicalizeError {
|
||||
@ -22,6 +22,8 @@ pub enum CanonicalizeError {
|
||||
Error(#[from] FormattedError),
|
||||
}
|
||||
|
||||
impl LeoError for CanonicalizeError {}
|
||||
|
||||
impl CanonicalizeError {
|
||||
fn new_from_span(message: String, span: &Span) -> Self {
|
||||
CanonicalizeError::Error(FormattedError::new_from_span(message, span))
|
@ -14,31 +14,30 @@
|
||||
// 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::{Identifier, Node, Span};
|
||||
use crate::{FormattedError, LeoError, Span};
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
|
||||
/// The `input` keyword can view program register, record, and state values.
|
||||
/// Values cannot be modified. The `input` keyword cannot be made mutable.
|
||||
#[derive(Clone, Serialize, Deserialize, Debug, PartialEq, Eq)]
|
||||
#[serde(transparent)]
|
||||
pub struct InputKeyword {
|
||||
pub identifier: Identifier,
|
||||
#[derive(Debug, Error)]
|
||||
pub enum CombinerError {
|
||||
#[error("{}", _0)]
|
||||
Error(#[from] FormattedError),
|
||||
}
|
||||
|
||||
impl fmt::Display for InputKeyword {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "input")
|
||||
}
|
||||
}
|
||||
impl LeoError for CombinerError {}
|
||||
|
||||
impl Node for InputKeyword {
|
||||
fn span(&self) -> &Span {
|
||||
&self.identifier.span
|
||||
impl CombinerError {
|
||||
fn new_from_span(message: String, span: &Span) -> Self {
|
||||
CombinerError::Error(FormattedError::new_from_span(message, span))
|
||||
}
|
||||
|
||||
fn set_span(&mut self, span: Span) {
|
||||
self.identifier.span = span;
|
||||
pub fn asg_statement_not_block(span: &Span) -> Self {
|
||||
let message = "AstStatement should be be a block".to_string();
|
||||
|
||||
Self::new_from_span(message, span)
|
||||
}
|
||||
|
||||
pub fn illegal_compound_array_range(span: &Span) -> Self {
|
||||
let message = "Illegal compound assignement with array range".to_string();
|
||||
|
||||
Self::new_from_span(message, span)
|
||||
}
|
||||
}
|
@ -75,11 +75,11 @@ fn underline(mut start: usize, mut end: usize) -> String {
|
||||
|
||||
impl fmt::Display for FormattedError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
let underline = underline(self.col_start - 1, self.col_stop - 1);
|
||||
let underline = underline(self.col_start, self.col_stop);
|
||||
|
||||
write!(
|
||||
f,
|
||||
"{indent }--> {path}: {line_start}:{start}\n\
|
||||
"{indent }--> {path}:{line_start}:{start}\n\
|
||||
{indent } |\n",
|
||||
indent = INDENT,
|
||||
path = &*self.path,
|
||||
@ -99,7 +99,7 @@ impl fmt::Display for FormattedError {
|
||||
|
||||
write!(
|
||||
f,
|
||||
"{indent } | {underline}\n\
|
||||
"{indent } |{underline}\n\
|
||||
{indent } |\n\
|
||||
{indent } = {message}",
|
||||
indent = INDENT,
|
||||
@ -121,8 +121,8 @@ fn test_error() {
|
||||
path: std::sync::Arc::new("file.leo".to_string()),
|
||||
line_start: 2,
|
||||
line_stop: 2,
|
||||
col_start: 8,
|
||||
col_stop: 9,
|
||||
col_start: 9,
|
||||
col_stop: 10,
|
||||
content: "let a = x;".into(),
|
||||
message: "undefined value `x`".to_string(),
|
||||
};
|
||||
@ -130,7 +130,7 @@ fn test_error() {
|
||||
assert_eq!(
|
||||
err.to_string(),
|
||||
vec![
|
||||
" --> file.leo: 2:8",
|
||||
" --> file.leo:2:9",
|
||||
" |",
|
||||
" 2 | let a = x;",
|
||||
" | ^",
|
||||
|
@ -14,7 +14,16 @@
|
||||
// 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 canonicalization;
|
||||
pub use canonicalization::*;
|
||||
|
||||
pub mod combiner;
|
||||
pub use combiner::*;
|
||||
|
||||
pub mod error;
|
||||
pub use error::*;
|
||||
|
||||
pub mod reducer;
|
||||
pub use reducer::*;
|
||||
|
||||
pub trait LeoError {}
|
||||
|
43
ast/src/errors/reducer.rs
Normal file
43
ast/src/errors/reducer.rs
Normal file
@ -0,0 +1,43 @@
|
||||
// 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::{CanonicalizeError, CombinerError, FormattedError, LeoError, Span};
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ReducerError {
|
||||
#[error("{}", _0)]
|
||||
Error(#[from] FormattedError),
|
||||
|
||||
#[error("{}", _0)]
|
||||
CanonicalizeError(#[from] CanonicalizeError),
|
||||
|
||||
#[error("{}", _0)]
|
||||
CombinerError(#[from] CombinerError),
|
||||
}
|
||||
|
||||
impl LeoError for ReducerError {}
|
||||
|
||||
impl ReducerError {
|
||||
fn new_from_span(message: String, span: &Span) -> Self {
|
||||
ReducerError::Error(FormattedError::new_from_span(message, span))
|
||||
}
|
||||
|
||||
pub fn impossible_console_assert_call(span: &Span) -> Self {
|
||||
let message = "Console::Assert cannot be matched here, its handled in another case.".to_string();
|
||||
|
||||
Self::new_from_span(message, span)
|
||||
}
|
||||
}
|
@ -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::{ConstSelfKeyword, FunctionInputVariable, InputKeyword, MutSelfKeyword, Node, SelfKeyword, Span};
|
||||
use crate::{ConstSelfKeyword, FunctionInputVariable, MutSelfKeyword, Node, SelfKeyword, Span};
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
@ -22,7 +22,6 @@ use std::fmt;
|
||||
/// Enumerates the possible inputs to a function.
|
||||
#[derive(Clone, Serialize, Deserialize)]
|
||||
pub enum FunctionInput {
|
||||
InputKeyword(InputKeyword),
|
||||
SelfKeyword(SelfKeyword),
|
||||
ConstSelfKeyword(ConstSelfKeyword),
|
||||
MutSelfKeyword(MutSelfKeyword),
|
||||
@ -36,7 +35,6 @@ impl FunctionInput {
|
||||
///
|
||||
pub fn is_self(&self) -> bool {
|
||||
match self {
|
||||
FunctionInput::InputKeyword(_) => false,
|
||||
FunctionInput::SelfKeyword(_) => true,
|
||||
FunctionInput::ConstSelfKeyword(_) => true,
|
||||
FunctionInput::MutSelfKeyword(_) => true,
|
||||
@ -50,7 +48,6 @@ impl FunctionInput {
|
||||
///
|
||||
pub fn is_const_self(&self) -> bool {
|
||||
match self {
|
||||
FunctionInput::InputKeyword(_) => false,
|
||||
FunctionInput::SelfKeyword(_) => false,
|
||||
FunctionInput::ConstSelfKeyword(_) => true,
|
||||
FunctionInput::MutSelfKeyword(_) => false,
|
||||
@ -64,7 +61,6 @@ impl FunctionInput {
|
||||
///
|
||||
pub fn is_mut_self(&self) -> bool {
|
||||
match self {
|
||||
FunctionInput::InputKeyword(_) => false,
|
||||
FunctionInput::SelfKeyword(_) => false,
|
||||
FunctionInput::ConstSelfKeyword(_) => false,
|
||||
FunctionInput::MutSelfKeyword(_) => true,
|
||||
@ -74,7 +70,6 @@ impl FunctionInput {
|
||||
|
||||
fn format(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match self {
|
||||
FunctionInput::InputKeyword(keyword) => write!(f, "{}", keyword),
|
||||
FunctionInput::SelfKeyword(keyword) => write!(f, "{}", keyword),
|
||||
FunctionInput::ConstSelfKeyword(keyword) => write!(f, "{}", keyword),
|
||||
FunctionInput::MutSelfKeyword(keyword) => write!(f, "{}", keyword),
|
||||
@ -99,7 +94,6 @@ impl PartialEq for FunctionInput {
|
||||
/// Returns true if `self == other`. Does not compare spans.
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
match (self, other) {
|
||||
(FunctionInput::InputKeyword(_), FunctionInput::InputKeyword(_)) => true,
|
||||
(FunctionInput::SelfKeyword(_), FunctionInput::SelfKeyword(_)) => true,
|
||||
(FunctionInput::ConstSelfKeyword(_), FunctionInput::ConstSelfKeyword(_)) => true,
|
||||
(FunctionInput::MutSelfKeyword(_), FunctionInput::MutSelfKeyword(_)) => true,
|
||||
@ -115,7 +109,6 @@ impl Node for FunctionInput {
|
||||
fn span(&self) -> &Span {
|
||||
use FunctionInput::*;
|
||||
match self {
|
||||
InputKeyword(keyword) => &keyword.identifier.span,
|
||||
SelfKeyword(keyword) => &keyword.identifier.span,
|
||||
ConstSelfKeyword(keyword) => &keyword.identifier.span,
|
||||
MutSelfKeyword(keyword) => &keyword.identifier.span,
|
||||
@ -126,7 +119,6 @@ impl Node for FunctionInput {
|
||||
fn set_span(&mut self, span: Span) {
|
||||
use FunctionInput::*;
|
||||
match self {
|
||||
InputKeyword(keyword) => keyword.identifier.span = span,
|
||||
SelfKeyword(keyword) => keyword.identifier.span = span,
|
||||
ConstSelfKeyword(keyword) => keyword.identifier.span = span,
|
||||
MutSelfKeyword(keyword) => keyword.identifier.span = span,
|
||||
|
@ -71,7 +71,7 @@ pub use node::*;
|
||||
/// These data types form a tree that begins from a [`Program`] type root.
|
||||
///
|
||||
/// A new [`Ast`] can be created from a [`Grammar`] generated by the pest parser in the `grammar` module.
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub struct Ast {
|
||||
ast: Program,
|
||||
}
|
||||
@ -83,7 +83,7 @@ impl Ast {
|
||||
}
|
||||
|
||||
/// Mutates the program ast by preforming canonicalization on it.
|
||||
pub fn canonicalize(&mut self) -> Result<(), CanonicalizeError> {
|
||||
pub fn canonicalize(&mut self) -> Result<(), ReducerError> {
|
||||
self.ast = ReconstructingDirector::new(Canonicalizer::default()).reduce_program(self.as_repr())?;
|
||||
Ok(())
|
||||
}
|
||||
|
@ -25,11 +25,78 @@ use crate::*;
|
||||
pub struct Canonicalizer {
|
||||
// If we are in a circuit keep track of the circuit name.
|
||||
circuit_name: Option<Identifier>,
|
||||
in_circuit: bool,
|
||||
}
|
||||
|
||||
impl Default for Canonicalizer {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
circuit_name: None,
|
||||
in_circuit: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Canonicalizer {
|
||||
pub fn default() -> Self {
|
||||
Self { circuit_name: None }
|
||||
pub fn canonicalize_accesses(
|
||||
&mut self,
|
||||
start: Expression,
|
||||
accesses: &[AssigneeAccess],
|
||||
span: &Span,
|
||||
) -> Result<Box<Expression>, ReducerError> {
|
||||
let mut left = Box::new(start);
|
||||
|
||||
for access in accesses.iter() {
|
||||
match self.canonicalize_assignee_access(&access) {
|
||||
AssigneeAccess::ArrayIndex(index) => {
|
||||
left = Box::new(Expression::ArrayAccess(ArrayAccessExpression {
|
||||
array: left,
|
||||
index: Box::new(index),
|
||||
span: span.clone(),
|
||||
}));
|
||||
}
|
||||
AssigneeAccess::Tuple(positive_number, _) => {
|
||||
left = Box::new(Expression::TupleAccess(TupleAccessExpression {
|
||||
tuple: left,
|
||||
index: positive_number,
|
||||
span: span.clone(),
|
||||
}));
|
||||
}
|
||||
AssigneeAccess::Member(identifier) => {
|
||||
left = Box::new(Expression::CircuitMemberAccess(CircuitMemberAccessExpression {
|
||||
circuit: left,
|
||||
name: identifier,
|
||||
span: span.clone(),
|
||||
}));
|
||||
}
|
||||
_ => return Err(ReducerError::from(CombinerError::illegal_compound_array_range(&span))),
|
||||
}
|
||||
}
|
||||
|
||||
Ok(left)
|
||||
}
|
||||
|
||||
pub fn compound_operation_converstion(
|
||||
&mut self,
|
||||
operation: &AssignOperation,
|
||||
) -> Result<BinaryOperation, ReducerError> {
|
||||
match operation {
|
||||
AssignOperation::Assign => unreachable!(),
|
||||
AssignOperation::Add => Ok(BinaryOperation::Add),
|
||||
AssignOperation::Sub => Ok(BinaryOperation::Sub),
|
||||
AssignOperation::Mul => Ok(BinaryOperation::Mul),
|
||||
AssignOperation::Div => Ok(BinaryOperation::Div),
|
||||
AssignOperation::Pow => Ok(BinaryOperation::Pow),
|
||||
AssignOperation::Or => Ok(BinaryOperation::Or),
|
||||
AssignOperation::And => Ok(BinaryOperation::And),
|
||||
AssignOperation::BitOr => Ok(BinaryOperation::BitOr),
|
||||
AssignOperation::BitAnd => Ok(BinaryOperation::BitAnd),
|
||||
AssignOperation::BitXor => Ok(BinaryOperation::BitXor),
|
||||
AssignOperation::Shr => Ok(BinaryOperation::Shr),
|
||||
AssignOperation::ShrSigned => Ok(BinaryOperation::ShrSigned),
|
||||
AssignOperation::Shl => Ok(BinaryOperation::Shl),
|
||||
AssignOperation::Mod => Ok(BinaryOperation::Mod),
|
||||
}
|
||||
}
|
||||
|
||||
fn is_self_type(&mut self, type_option: Option<&Type>) -> bool {
|
||||
@ -324,7 +391,7 @@ impl Canonicalizer {
|
||||
.map(|parameter| self.canonicalize_expression(parameter))
|
||||
.collect();
|
||||
|
||||
let formatted = FormattedString {
|
||||
let formatted = FormatString {
|
||||
parts: format.parts.clone(),
|
||||
parameters,
|
||||
span: format.span.clone(),
|
||||
@ -380,17 +447,21 @@ impl Canonicalizer {
|
||||
}
|
||||
|
||||
impl ReconstructingReducer for Canonicalizer {
|
||||
fn reduce_type(
|
||||
&mut self,
|
||||
_type_: &Type,
|
||||
new: Type,
|
||||
in_circuit: bool,
|
||||
span: &Span,
|
||||
) -> Result<Type, CanonicalizeError> {
|
||||
fn in_circuit(&self) -> bool {
|
||||
self.in_circuit
|
||||
}
|
||||
|
||||
fn swap_in_circuit(&mut self) {
|
||||
self.in_circuit = !self.in_circuit;
|
||||
}
|
||||
|
||||
fn reduce_type(&mut self, _type_: &Type, new: Type, span: &Span) -> Result<Type, ReducerError> {
|
||||
match new {
|
||||
Type::Array(type_, mut dimensions) => {
|
||||
if dimensions.is_zero() {
|
||||
return Err(CanonicalizeError::invalid_array_dimension_size(span));
|
||||
return Err(ReducerError::from(CanonicalizeError::invalid_array_dimension_size(
|
||||
span,
|
||||
)));
|
||||
}
|
||||
|
||||
let mut next = Type::Array(type_, ArrayDimensions(vec![dimensions.remove_last().unwrap()]));
|
||||
@ -407,7 +478,9 @@ impl ReconstructingReducer for Canonicalizer {
|
||||
|
||||
Ok(array)
|
||||
}
|
||||
Type::SelfType if !in_circuit => Err(CanonicalizeError::big_self_outside_of_circuit(span)),
|
||||
Type::SelfType if !self.in_circuit => {
|
||||
Err(ReducerError::from(CanonicalizeError::big_self_outside_of_circuit(span)))
|
||||
}
|
||||
_ => Ok(new.clone()),
|
||||
}
|
||||
}
|
||||
@ -416,10 +489,11 @@ impl ReconstructingReducer for Canonicalizer {
|
||||
&mut self,
|
||||
array_init: &ArrayInitExpression,
|
||||
element: Expression,
|
||||
_in_circuit: bool,
|
||||
) -> Result<ArrayInitExpression, CanonicalizeError> {
|
||||
) -> Result<ArrayInitExpression, ReducerError> {
|
||||
if array_init.dimensions.is_zero() {
|
||||
return Err(CanonicalizeError::invalid_array_dimension_size(&array_init.span));
|
||||
return Err(ReducerError::from(CanonicalizeError::invalid_array_dimension_size(
|
||||
&array_init.span,
|
||||
)));
|
||||
}
|
||||
|
||||
let element = Box::new(element);
|
||||
@ -466,30 +540,39 @@ impl ReconstructingReducer for Canonicalizer {
|
||||
assign: &AssignStatement,
|
||||
assignee: Assignee,
|
||||
value: Expression,
|
||||
_in_circuit: bool,
|
||||
) -> Result<AssignStatement, CanonicalizeError> {
|
||||
) -> Result<AssignStatement, ReducerError> {
|
||||
match value {
|
||||
Expression::Value(value_expr) if assign.operation != AssignOperation::Assign => {
|
||||
let left = Box::new(Expression::Identifier(assignee.identifier.clone()));
|
||||
let right = Box::new(Expression::Value(value_expr));
|
||||
Expression::Binary(binary_expr) if assign.operation != AssignOperation::Assign => {
|
||||
let left = self.canonicalize_accesses(
|
||||
Expression::Identifier(assignee.identifier.clone()),
|
||||
&assignee.accesses,
|
||||
&assign.span,
|
||||
)?;
|
||||
let right = Box::new(Expression::Binary(binary_expr));
|
||||
let op = self.compound_operation_converstion(&assign.operation)?;
|
||||
|
||||
let op = match assign.operation {
|
||||
AssignOperation::Assign => unimplemented!(), // Imposible
|
||||
AssignOperation::Add => BinaryOperation::Add,
|
||||
AssignOperation::Sub => BinaryOperation::Sub,
|
||||
AssignOperation::Mul => BinaryOperation::Mul,
|
||||
AssignOperation::Div => BinaryOperation::Div,
|
||||
AssignOperation::Pow => BinaryOperation::Pow,
|
||||
AssignOperation::Or => BinaryOperation::Or,
|
||||
AssignOperation::And => BinaryOperation::And,
|
||||
AssignOperation::BitOr => BinaryOperation::BitOr,
|
||||
AssignOperation::BitAnd => BinaryOperation::BitAnd,
|
||||
AssignOperation::BitXor => BinaryOperation::BitXor,
|
||||
AssignOperation::Shr => BinaryOperation::Shr,
|
||||
AssignOperation::ShrSigned => BinaryOperation::ShrSigned,
|
||||
AssignOperation::Shl => BinaryOperation::Shl,
|
||||
AssignOperation::Mod => BinaryOperation::Mod,
|
||||
};
|
||||
let new_value = Expression::Binary(BinaryExpression {
|
||||
left,
|
||||
right,
|
||||
op,
|
||||
span: assign.span.clone(),
|
||||
});
|
||||
|
||||
Ok(AssignStatement {
|
||||
operation: AssignOperation::Assign,
|
||||
assignee,
|
||||
value: new_value,
|
||||
span: assign.span.clone(),
|
||||
})
|
||||
}
|
||||
Expression::Value(value_expr) if assign.operation != AssignOperation::Assign => {
|
||||
let left = self.canonicalize_accesses(
|
||||
Expression::Identifier(assignee.identifier.clone()),
|
||||
&assignee.accesses,
|
||||
&assign.span,
|
||||
)?;
|
||||
let right = Box::new(Expression::Value(value_expr));
|
||||
let op = self.compound_operation_converstion(&assign.operation)?;
|
||||
|
||||
let new_value = Expression::Binary(BinaryExpression {
|
||||
left,
|
||||
@ -517,8 +600,7 @@ impl ReconstructingReducer for Canonicalizer {
|
||||
input: Vec<FunctionInput>,
|
||||
output: Option<Type>,
|
||||
block: Block,
|
||||
_in_circuit: bool,
|
||||
) -> Result<Function, CanonicalizeError> {
|
||||
) -> Result<Function, ReducerError> {
|
||||
let new_output = match output {
|
||||
None => Some(Type::Tuple(vec![])),
|
||||
_ => output,
|
||||
@ -539,7 +621,7 @@ impl ReconstructingReducer for Canonicalizer {
|
||||
_circuit: &Circuit,
|
||||
circuit_name: Identifier,
|
||||
members: Vec<CircuitMember>,
|
||||
) -> Result<Circuit, CanonicalizeError> {
|
||||
) -> Result<Circuit, ReducerError> {
|
||||
self.circuit_name = Some(circuit_name.clone());
|
||||
let circ = Circuit {
|
||||
circuit_name,
|
||||
|
@ -17,9 +17,6 @@
|
||||
mod canonicalization;
|
||||
pub use canonicalization::*;
|
||||
|
||||
mod errors;
|
||||
pub use errors::*;
|
||||
|
||||
mod reconstructing_reducer;
|
||||
pub use reconstructing_reducer::*;
|
||||
|
||||
|
@ -22,18 +22,14 @@ use indexmap::IndexMap;
|
||||
|
||||
pub struct ReconstructingDirector<R: ReconstructingReducer> {
|
||||
reducer: R,
|
||||
in_circuit: bool,
|
||||
}
|
||||
|
||||
impl<R: ReconstructingReducer> ReconstructingDirector<R> {
|
||||
pub fn new(reducer: R) -> Self {
|
||||
Self {
|
||||
reducer,
|
||||
in_circuit: false,
|
||||
}
|
||||
Self { reducer }
|
||||
}
|
||||
|
||||
pub fn reduce_type(&mut self, type_: &Type, span: &Span) -> Result<Type, CanonicalizeError> {
|
||||
pub fn reduce_type(&mut self, type_: &Type, span: &Span) -> Result<Type, ReducerError> {
|
||||
let new = match type_ {
|
||||
Type::Array(type_, dimensions) => Type::Array(Box::new(self.reduce_type(type_, span)?), dimensions.clone()),
|
||||
Type::Tuple(types) => {
|
||||
@ -48,11 +44,11 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
|
||||
_ => type_.clone(),
|
||||
};
|
||||
|
||||
self.reducer.reduce_type(type_, new, self.in_circuit, span)
|
||||
self.reducer.reduce_type(type_, new, span)
|
||||
}
|
||||
|
||||
// Expressions
|
||||
pub fn reduce_expression(&mut self, expression: &Expression) -> Result<Expression, CanonicalizeError> {
|
||||
pub fn reduce_expression(&mut self, expression: &Expression) -> Result<Expression, ReducerError> {
|
||||
let new = match expression {
|
||||
Expression::Identifier(identifier) => Expression::Identifier(self.reduce_identifier(&identifier)?),
|
||||
Expression::Value(value) => Expression::Value(self.reduce_value(&value)?),
|
||||
@ -84,18 +80,18 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
|
||||
Expression::Call(call) => Expression::Call(self.reduce_call(&call)?),
|
||||
};
|
||||
|
||||
self.reducer.reduce_expression(expression, new, self.in_circuit)
|
||||
self.reducer.reduce_expression(expression, new)
|
||||
}
|
||||
|
||||
pub fn reduce_identifier(&mut self, identifier: &Identifier) -> Result<Identifier, CanonicalizeError> {
|
||||
pub fn reduce_identifier(&mut self, identifier: &Identifier) -> Result<Identifier, ReducerError> {
|
||||
self.reducer.reduce_identifier(identifier)
|
||||
}
|
||||
|
||||
pub fn reduce_group_tuple(&mut self, group_tuple: &GroupTuple) -> Result<GroupTuple, CanonicalizeError> {
|
||||
pub fn reduce_group_tuple(&mut self, group_tuple: &GroupTuple) -> Result<GroupTuple, ReducerError> {
|
||||
self.reducer.reduce_group_tuple(group_tuple)
|
||||
}
|
||||
|
||||
pub fn reduce_group_value(&mut self, group_value: &GroupValue) -> Result<GroupValue, CanonicalizeError> {
|
||||
pub fn reduce_group_value(&mut self, group_value: &GroupValue) -> Result<GroupValue, ReducerError> {
|
||||
let new = match group_value {
|
||||
GroupValue::Tuple(group_tuple) => GroupValue::Tuple(self.reduce_group_tuple(&group_tuple)?),
|
||||
_ => group_value.clone(),
|
||||
@ -104,7 +100,7 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
|
||||
self.reducer.reduce_group_value(group_value, new)
|
||||
}
|
||||
|
||||
pub fn reduce_value(&mut self, value: &ValueExpression) -> Result<ValueExpression, CanonicalizeError> {
|
||||
pub fn reduce_value(&mut self, value: &ValueExpression) -> Result<ValueExpression, ReducerError> {
|
||||
let new = match value {
|
||||
ValueExpression::Group(group_value) => {
|
||||
ValueExpression::Group(Box::new(self.reduce_group_value(&group_value)?))
|
||||
@ -115,41 +111,38 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
|
||||
self.reducer.reduce_value(value, new)
|
||||
}
|
||||
|
||||
pub fn reduce_binary(&mut self, binary: &BinaryExpression) -> Result<BinaryExpression, CanonicalizeError> {
|
||||
pub fn reduce_binary(&mut self, binary: &BinaryExpression) -> Result<BinaryExpression, ReducerError> {
|
||||
let left = self.reduce_expression(&binary.left)?;
|
||||
let right = self.reduce_expression(&binary.right)?;
|
||||
|
||||
self.reducer
|
||||
.reduce_binary(binary, left, right, binary.op.clone(), self.in_circuit)
|
||||
self.reducer.reduce_binary(binary, left, right, binary.op.clone())
|
||||
}
|
||||
|
||||
pub fn reduce_unary(&mut self, unary: &UnaryExpression) -> Result<UnaryExpression, CanonicalizeError> {
|
||||
pub fn reduce_unary(&mut self, unary: &UnaryExpression) -> Result<UnaryExpression, ReducerError> {
|
||||
let inner = self.reduce_expression(&unary.inner)?;
|
||||
|
||||
self.reducer
|
||||
.reduce_unary(unary, inner, unary.op.clone(), self.in_circuit)
|
||||
self.reducer.reduce_unary(unary, inner, unary.op.clone())
|
||||
}
|
||||
|
||||
pub fn reduce_ternary(&mut self, ternary: &TernaryExpression) -> Result<TernaryExpression, CanonicalizeError> {
|
||||
pub fn reduce_ternary(&mut self, ternary: &TernaryExpression) -> Result<TernaryExpression, ReducerError> {
|
||||
let condition = self.reduce_expression(&ternary.condition)?;
|
||||
let if_true = self.reduce_expression(&ternary.if_true)?;
|
||||
let if_false = self.reduce_expression(&ternary.if_false)?;
|
||||
|
||||
self.reducer
|
||||
.reduce_ternary(ternary, condition, if_true, if_false, self.in_circuit)
|
||||
self.reducer.reduce_ternary(ternary, condition, if_true, if_false)
|
||||
}
|
||||
|
||||
pub fn reduce_cast(&mut self, cast: &CastExpression) -> Result<CastExpression, CanonicalizeError> {
|
||||
pub fn reduce_cast(&mut self, cast: &CastExpression) -> Result<CastExpression, ReducerError> {
|
||||
let inner = self.reduce_expression(&cast.inner)?;
|
||||
let target_type = self.reduce_type(&cast.target_type, &cast.span)?;
|
||||
|
||||
self.reducer.reduce_cast(cast, inner, target_type, self.in_circuit)
|
||||
self.reducer.reduce_cast(cast, inner, target_type)
|
||||
}
|
||||
|
||||
pub fn reduce_array_inline(
|
||||
&mut self,
|
||||
array_inline: &ArrayInlineExpression,
|
||||
) -> Result<ArrayInlineExpression, CanonicalizeError> {
|
||||
) -> Result<ArrayInlineExpression, ReducerError> {
|
||||
let mut elements = vec![];
|
||||
for element in array_inline.elements.iter() {
|
||||
let reduced_element = match element {
|
||||
@ -164,34 +157,29 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
|
||||
elements.push(reduced_element);
|
||||
}
|
||||
|
||||
self.reducer
|
||||
.reduce_array_inline(array_inline, elements, self.in_circuit)
|
||||
self.reducer.reduce_array_inline(array_inline, elements)
|
||||
}
|
||||
|
||||
pub fn reduce_array_init(
|
||||
&mut self,
|
||||
array_init: &ArrayInitExpression,
|
||||
) -> Result<ArrayInitExpression, CanonicalizeError> {
|
||||
pub fn reduce_array_init(&mut self, array_init: &ArrayInitExpression) -> Result<ArrayInitExpression, ReducerError> {
|
||||
let element = self.reduce_expression(&array_init.element)?;
|
||||
|
||||
self.reducer.reduce_array_init(array_init, element, self.in_circuit)
|
||||
self.reducer.reduce_array_init(array_init, element)
|
||||
}
|
||||
|
||||
pub fn reduce_array_access(
|
||||
&mut self,
|
||||
array_access: &ArrayAccessExpression,
|
||||
) -> Result<ArrayAccessExpression, CanonicalizeError> {
|
||||
) -> Result<ArrayAccessExpression, ReducerError> {
|
||||
let array = self.reduce_expression(&array_access.array)?;
|
||||
let index = self.reduce_expression(&array_access.index)?;
|
||||
|
||||
self.reducer
|
||||
.reduce_array_access(array_access, array, index, self.in_circuit)
|
||||
self.reducer.reduce_array_access(array_access, array, index)
|
||||
}
|
||||
|
||||
pub fn reduce_array_range_access(
|
||||
&mut self,
|
||||
array_range_access: &ArrayRangeAccessExpression,
|
||||
) -> Result<ArrayRangeAccessExpression, CanonicalizeError> {
|
||||
) -> Result<ArrayRangeAccessExpression, ReducerError> {
|
||||
let array = self.reduce_expression(&array_range_access.array)?;
|
||||
let left = array_range_access
|
||||
.left
|
||||
@ -205,34 +193,31 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
|
||||
.transpose()?;
|
||||
|
||||
self.reducer
|
||||
.reduce_array_range_access(array_range_access, array, left, right, self.in_circuit)
|
||||
.reduce_array_range_access(array_range_access, array, left, right)
|
||||
}
|
||||
|
||||
pub fn reduce_tuple_init(
|
||||
&mut self,
|
||||
tuple_init: &TupleInitExpression,
|
||||
) -> Result<TupleInitExpression, CanonicalizeError> {
|
||||
pub fn reduce_tuple_init(&mut self, tuple_init: &TupleInitExpression) -> Result<TupleInitExpression, ReducerError> {
|
||||
let mut elements = vec![];
|
||||
for element in tuple_init.elements.iter() {
|
||||
elements.push(self.reduce_expression(element)?);
|
||||
}
|
||||
|
||||
self.reducer.reduce_tuple_init(tuple_init, elements, self.in_circuit)
|
||||
self.reducer.reduce_tuple_init(tuple_init, elements)
|
||||
}
|
||||
|
||||
pub fn reduce_tuple_access(
|
||||
&mut self,
|
||||
tuple_access: &TupleAccessExpression,
|
||||
) -> Result<TupleAccessExpression, CanonicalizeError> {
|
||||
) -> Result<TupleAccessExpression, ReducerError> {
|
||||
let tuple = self.reduce_expression(&tuple_access.tuple)?;
|
||||
|
||||
self.reducer.reduce_tuple_access(tuple_access, tuple, self.in_circuit)
|
||||
self.reducer.reduce_tuple_access(tuple_access, tuple)
|
||||
}
|
||||
|
||||
pub fn reduce_circuit_implied_variable_definition(
|
||||
&mut self,
|
||||
variable: &CircuitImpliedVariableDefinition,
|
||||
) -> Result<CircuitImpliedVariableDefinition, CanonicalizeError> {
|
||||
) -> Result<CircuitImpliedVariableDefinition, ReducerError> {
|
||||
let identifier = self.reduce_identifier(&variable.identifier)?;
|
||||
let expression = variable
|
||||
.expression
|
||||
@ -241,13 +226,13 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
|
||||
.transpose()?;
|
||||
|
||||
self.reducer
|
||||
.reduce_circuit_implied_variable_definition(variable, identifier, expression, self.in_circuit)
|
||||
.reduce_circuit_implied_variable_definition(variable, identifier, expression)
|
||||
}
|
||||
|
||||
pub fn reduce_circuit_init(
|
||||
&mut self,
|
||||
circuit_init: &CircuitInitExpression,
|
||||
) -> Result<CircuitInitExpression, CanonicalizeError> {
|
||||
) -> Result<CircuitInitExpression, ReducerError> {
|
||||
let name = self.reduce_identifier(&circuit_init.name)?;
|
||||
|
||||
let mut members = vec![];
|
||||
@ -255,33 +240,32 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
|
||||
members.push(self.reduce_circuit_implied_variable_definition(member)?);
|
||||
}
|
||||
|
||||
self.reducer
|
||||
.reduce_circuit_init(circuit_init, name, members, self.in_circuit)
|
||||
self.reducer.reduce_circuit_init(circuit_init, name, members)
|
||||
}
|
||||
|
||||
pub fn reduce_circuit_member_access(
|
||||
&mut self,
|
||||
circuit_member_access: &CircuitMemberAccessExpression,
|
||||
) -> Result<CircuitMemberAccessExpression, CanonicalizeError> {
|
||||
) -> Result<CircuitMemberAccessExpression, ReducerError> {
|
||||
let circuit = self.reduce_expression(&circuit_member_access.circuit)?;
|
||||
let name = self.reduce_identifier(&circuit_member_access.name)?;
|
||||
|
||||
self.reducer
|
||||
.reduce_circuit_member_access(circuit_member_access, circuit, name, self.in_circuit)
|
||||
.reduce_circuit_member_access(circuit_member_access, circuit, name)
|
||||
}
|
||||
|
||||
pub fn reduce_circuit_static_fn_access(
|
||||
&mut self,
|
||||
circuit_static_fn_access: &CircuitStaticFunctionAccessExpression,
|
||||
) -> Result<CircuitStaticFunctionAccessExpression, CanonicalizeError> {
|
||||
) -> Result<CircuitStaticFunctionAccessExpression, ReducerError> {
|
||||
let circuit = self.reduce_expression(&circuit_static_fn_access.circuit)?;
|
||||
let name = self.reduce_identifier(&circuit_static_fn_access.name)?;
|
||||
|
||||
self.reducer
|
||||
.reduce_circuit_static_fn_access(circuit_static_fn_access, circuit, name, self.in_circuit)
|
||||
.reduce_circuit_static_fn_access(circuit_static_fn_access, circuit, name)
|
||||
}
|
||||
|
||||
pub fn reduce_call(&mut self, call: &CallExpression) -> Result<CallExpression, CanonicalizeError> {
|
||||
pub fn reduce_call(&mut self, call: &CallExpression) -> Result<CallExpression, ReducerError> {
|
||||
let function = self.reduce_expression(&call.function)?;
|
||||
|
||||
let mut arguments = vec![];
|
||||
@ -289,11 +273,11 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
|
||||
arguments.push(self.reduce_expression(argument)?);
|
||||
}
|
||||
|
||||
self.reducer.reduce_call(call, function, arguments, self.in_circuit)
|
||||
self.reducer.reduce_call(call, function, arguments)
|
||||
}
|
||||
|
||||
// Statements
|
||||
pub fn reduce_statement(&mut self, statement: &Statement) -> Result<Statement, CanonicalizeError> {
|
||||
pub fn reduce_statement(&mut self, statement: &Statement) -> Result<Statement, ReducerError> {
|
||||
let new = match statement {
|
||||
Statement::Return(return_statement) => Statement::Return(self.reduce_return(&return_statement)?),
|
||||
Statement::Definition(definition) => Statement::Definition(self.reduce_definition(&definition)?),
|
||||
@ -305,26 +289,22 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
|
||||
Statement::Block(block) => Statement::Block(self.reduce_block(&block)?),
|
||||
};
|
||||
|
||||
self.reducer.reduce_statement(statement, new, self.in_circuit)
|
||||
self.reducer.reduce_statement(statement, new)
|
||||
}
|
||||
|
||||
pub fn reduce_return(&mut self, return_statement: &ReturnStatement) -> Result<ReturnStatement, CanonicalizeError> {
|
||||
pub fn reduce_return(&mut self, return_statement: &ReturnStatement) -> Result<ReturnStatement, ReducerError> {
|
||||
let expression = self.reduce_expression(&return_statement.expression)?;
|
||||
|
||||
self.reducer
|
||||
.reduce_return(return_statement, expression, self.in_circuit)
|
||||
self.reducer.reduce_return(return_statement, expression)
|
||||
}
|
||||
|
||||
pub fn reduce_variable_name(&mut self, variable_name: &VariableName) -> Result<VariableName, CanonicalizeError> {
|
||||
pub fn reduce_variable_name(&mut self, variable_name: &VariableName) -> Result<VariableName, ReducerError> {
|
||||
let identifier = self.reduce_identifier(&variable_name.identifier)?;
|
||||
|
||||
self.reducer.reduce_variable_name(variable_name, identifier)
|
||||
}
|
||||
|
||||
pub fn reduce_definition(
|
||||
&mut self,
|
||||
definition: &DefinitionStatement,
|
||||
) -> Result<DefinitionStatement, CanonicalizeError> {
|
||||
pub fn reduce_definition(&mut self, definition: &DefinitionStatement) -> Result<DefinitionStatement, ReducerError> {
|
||||
let mut variable_names = vec![];
|
||||
for variable_name in definition.variable_names.iter() {
|
||||
variable_names.push(self.reduce_variable_name(variable_name)?);
|
||||
@ -338,11 +318,10 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
|
||||
|
||||
let value = self.reduce_expression(&definition.value)?;
|
||||
|
||||
self.reducer
|
||||
.reduce_definition(definition, variable_names, type_, value, self.in_circuit)
|
||||
self.reducer.reduce_definition(definition, variable_names, type_, value)
|
||||
}
|
||||
|
||||
pub fn reduce_assignee_access(&mut self, access: &AssigneeAccess) -> Result<AssigneeAccess, CanonicalizeError> {
|
||||
pub fn reduce_assignee_access(&mut self, access: &AssigneeAccess) -> Result<AssigneeAccess, ReducerError> {
|
||||
let new = match access {
|
||||
AssigneeAccess::ArrayRange(left, right) => {
|
||||
let left = left.as_ref().map(|left| self.reduce_expression(left)).transpose()?;
|
||||
@ -355,10 +334,10 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
|
||||
_ => access.clone(),
|
||||
};
|
||||
|
||||
self.reducer.reduce_assignee_access(access, new, self.in_circuit)
|
||||
self.reducer.reduce_assignee_access(access, new)
|
||||
}
|
||||
|
||||
pub fn reduce_assignee(&mut self, assignee: &Assignee) -> Result<Assignee, CanonicalizeError> {
|
||||
pub fn reduce_assignee(&mut self, assignee: &Assignee) -> Result<Assignee, ReducerError> {
|
||||
let identifier = self.reduce_identifier(&assignee.identifier)?;
|
||||
|
||||
let mut accesses = vec![];
|
||||
@ -366,21 +345,20 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
|
||||
accesses.push(self.reduce_assignee_access(access)?);
|
||||
}
|
||||
|
||||
self.reducer
|
||||
.reduce_assignee(assignee, identifier, accesses, self.in_circuit)
|
||||
self.reducer.reduce_assignee(assignee, identifier, accesses)
|
||||
}
|
||||
|
||||
pub fn reduce_assign(&mut self, assign: &AssignStatement) -> Result<AssignStatement, CanonicalizeError> {
|
||||
pub fn reduce_assign(&mut self, assign: &AssignStatement) -> Result<AssignStatement, ReducerError> {
|
||||
let assignee = self.reduce_assignee(&assign.assignee)?;
|
||||
let value = self.reduce_expression(&assign.value)?;
|
||||
|
||||
self.reducer.reduce_assign(assign, assignee, value, self.in_circuit)
|
||||
self.reducer.reduce_assign(assign, assignee, value)
|
||||
}
|
||||
|
||||
pub fn reduce_conditional(
|
||||
&mut self,
|
||||
conditional: &ConditionalStatement,
|
||||
) -> Result<ConditionalStatement, CanonicalizeError> {
|
||||
) -> Result<ConditionalStatement, ReducerError> {
|
||||
let condition = self.reduce_expression(&conditional.condition)?;
|
||||
let block = self.reduce_block(&conditional.block)?;
|
||||
let next = conditional
|
||||
@ -389,27 +367,22 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
|
||||
.map(|condition| self.reduce_statement(condition))
|
||||
.transpose()?;
|
||||
|
||||
self.reducer
|
||||
.reduce_conditional(conditional, condition, block, next, self.in_circuit)
|
||||
self.reducer.reduce_conditional(conditional, condition, block, next)
|
||||
}
|
||||
|
||||
pub fn reduce_iteration(
|
||||
&mut self,
|
||||
iteration: &IterationStatement,
|
||||
) -> Result<IterationStatement, CanonicalizeError> {
|
||||
pub fn reduce_iteration(&mut self, iteration: &IterationStatement) -> Result<IterationStatement, ReducerError> {
|
||||
let variable = self.reduce_identifier(&iteration.variable)?;
|
||||
let start = self.reduce_expression(&iteration.start)?;
|
||||
let stop = self.reduce_expression(&iteration.stop)?;
|
||||
let block = self.reduce_block(&iteration.block)?;
|
||||
|
||||
self.reducer
|
||||
.reduce_iteration(iteration, variable, start, stop, block, self.in_circuit)
|
||||
self.reducer.reduce_iteration(iteration, variable, start, stop, block)
|
||||
}
|
||||
|
||||
pub fn reduce_console(
|
||||
&mut self,
|
||||
console_function_call: &ConsoleStatement,
|
||||
) -> Result<ConsoleStatement, CanonicalizeError> {
|
||||
) -> Result<ConsoleStatement, ReducerError> {
|
||||
let function = match &console_function_call.function {
|
||||
ConsoleFunction::Assert(expression) => ConsoleFunction::Assert(self.reduce_expression(expression)?),
|
||||
ConsoleFunction::Debug(format) | ConsoleFunction::Error(format) | ConsoleFunction::Log(format) => {
|
||||
@ -418,7 +391,7 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
|
||||
parameters.push(self.reduce_expression(parameter)?);
|
||||
}
|
||||
|
||||
let formatted = FormattedString {
|
||||
let formatted = FormatString {
|
||||
parts: format.parts.clone(),
|
||||
parameters,
|
||||
span: format.span.clone(),
|
||||
@ -428,35 +401,33 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
|
||||
ConsoleFunction::Debug(_) => ConsoleFunction::Debug(formatted),
|
||||
ConsoleFunction::Error(_) => ConsoleFunction::Error(formatted),
|
||||
ConsoleFunction::Log(_) => ConsoleFunction::Log(formatted),
|
||||
_ => unimplemented!(), // impossible
|
||||
_ => return Err(ReducerError::impossible_console_assert_call(&format.span)),
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
self.reducer
|
||||
.reduce_console(console_function_call, function, self.in_circuit)
|
||||
self.reducer.reduce_console(console_function_call, function)
|
||||
}
|
||||
|
||||
pub fn reduce_expression_statement(
|
||||
&mut self,
|
||||
expression: &ExpressionStatement,
|
||||
) -> Result<ExpressionStatement, CanonicalizeError> {
|
||||
) -> Result<ExpressionStatement, ReducerError> {
|
||||
let inner_expression = self.reduce_expression(&expression.expression)?;
|
||||
self.reducer
|
||||
.reduce_expression_statement(expression, inner_expression, self.in_circuit)
|
||||
self.reducer.reduce_expression_statement(expression, inner_expression)
|
||||
}
|
||||
|
||||
pub fn reduce_block(&mut self, block: &Block) -> Result<Block, CanonicalizeError> {
|
||||
pub fn reduce_block(&mut self, block: &Block) -> Result<Block, ReducerError> {
|
||||
let mut statements = vec![];
|
||||
for statement in block.statements.iter() {
|
||||
statements.push(self.reduce_statement(statement)?);
|
||||
}
|
||||
|
||||
self.reducer.reduce_block(block, statements, self.in_circuit)
|
||||
self.reducer.reduce_block(block, statements)
|
||||
}
|
||||
|
||||
// Program
|
||||
pub fn reduce_program(&mut self, program: &Program) -> Result<Program, CanonicalizeError> {
|
||||
pub fn reduce_program(&mut self, program: &Program) -> Result<Program, ReducerError> {
|
||||
let mut inputs = vec![];
|
||||
for input in program.expected_input.iter() {
|
||||
inputs.push(self.reduce_function_input(input)?);
|
||||
@ -468,9 +439,11 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
|
||||
}
|
||||
|
||||
let mut circuits = IndexMap::new();
|
||||
self.reducer.swap_in_circuit();
|
||||
for (identifier, circuit) in program.circuits.iter() {
|
||||
circuits.insert(self.reduce_identifier(identifier)?, self.reduce_circuit(circuit)?);
|
||||
}
|
||||
self.reducer.swap_in_circuit();
|
||||
|
||||
let mut functions = IndexMap::new();
|
||||
for (identifier, function) in program.functions.iter() {
|
||||
@ -489,15 +462,14 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
|
||||
pub fn reduce_function_input_variable(
|
||||
&mut self,
|
||||
variable: &FunctionInputVariable,
|
||||
) -> Result<FunctionInputVariable, CanonicalizeError> {
|
||||
) -> Result<FunctionInputVariable, ReducerError> {
|
||||
let identifier = self.reduce_identifier(&variable.identifier)?;
|
||||
let type_ = self.reduce_type(&variable.type_, &variable.span)?;
|
||||
|
||||
self.reducer
|
||||
.reduce_function_input_variable(variable, identifier, type_, self.in_circuit)
|
||||
self.reducer.reduce_function_input_variable(variable, identifier, type_)
|
||||
}
|
||||
|
||||
pub fn reduce_function_input(&mut self, input: &FunctionInput) -> Result<FunctionInput, CanonicalizeError> {
|
||||
pub fn reduce_function_input(&mut self, input: &FunctionInput) -> Result<FunctionInput, ReducerError> {
|
||||
let new = match input {
|
||||
FunctionInput::Variable(function_input_variable) => {
|
||||
FunctionInput::Variable(self.reduce_function_input_variable(function_input_variable)?)
|
||||
@ -505,13 +477,13 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
|
||||
_ => input.clone(),
|
||||
};
|
||||
|
||||
self.reducer.reduce_function_input(input, new, self.in_circuit)
|
||||
self.reducer.reduce_function_input(input, new)
|
||||
}
|
||||
|
||||
pub fn reduce_package_or_packages(
|
||||
&mut self,
|
||||
package_or_packages: &PackageOrPackages,
|
||||
) -> Result<PackageOrPackages, CanonicalizeError> {
|
||||
) -> Result<PackageOrPackages, ReducerError> {
|
||||
let new = match package_or_packages {
|
||||
PackageOrPackages::Package(package) => PackageOrPackages::Package(Package {
|
||||
name: self.reduce_identifier(&package.name)?,
|
||||
@ -528,17 +500,13 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
|
||||
self.reducer.reduce_package_or_packages(package_or_packages, new)
|
||||
}
|
||||
|
||||
pub fn reduce_import(&mut self, import: &ImportStatement) -> Result<ImportStatement, CanonicalizeError> {
|
||||
pub fn reduce_import(&mut self, import: &ImportStatement) -> Result<ImportStatement, ReducerError> {
|
||||
let package_or_packages = self.reduce_package_or_packages(&import.package_or_packages)?;
|
||||
|
||||
self.reducer.reduce_import(import, package_or_packages)
|
||||
}
|
||||
|
||||
pub fn reduce_circuit_member(
|
||||
&mut self,
|
||||
circuit_member: &CircuitMember,
|
||||
) -> Result<CircuitMember, CanonicalizeError> {
|
||||
self.in_circuit = !self.in_circuit;
|
||||
pub fn reduce_circuit_member(&mut self, circuit_member: &CircuitMember) -> Result<CircuitMember, ReducerError> {
|
||||
let new = match circuit_member {
|
||||
CircuitMember::CircuitVariable(identifier, type_) => CircuitMember::CircuitVariable(
|
||||
self.reduce_identifier(&identifier)?,
|
||||
@ -548,12 +516,11 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
|
||||
CircuitMember::CircuitFunction(self.reduce_function(&function)?)
|
||||
}
|
||||
};
|
||||
self.in_circuit = !self.in_circuit;
|
||||
|
||||
self.reducer.reduce_circuit_member(circuit_member, new)
|
||||
}
|
||||
|
||||
pub fn reduce_circuit(&mut self, circuit: &Circuit) -> Result<Circuit, CanonicalizeError> {
|
||||
pub fn reduce_circuit(&mut self, circuit: &Circuit) -> Result<Circuit, ReducerError> {
|
||||
let circuit_name = self.reduce_identifier(&circuit.circuit_name)?;
|
||||
|
||||
let mut members = vec![];
|
||||
@ -564,13 +531,13 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
|
||||
self.reducer.reduce_circuit(circuit, circuit_name, members)
|
||||
}
|
||||
|
||||
fn reduce_annotation(&mut self, annotation: &Annotation) -> Result<Annotation, CanonicalizeError> {
|
||||
fn reduce_annotation(&mut self, annotation: &Annotation) -> Result<Annotation, ReducerError> {
|
||||
let name = self.reduce_identifier(&annotation.name)?;
|
||||
|
||||
self.reducer.reduce_annotation(annotation, name)
|
||||
}
|
||||
|
||||
pub fn reduce_function(&mut self, function: &Function) -> Result<Function, CanonicalizeError> {
|
||||
pub fn reduce_function(&mut self, function: &Function) -> Result<Function, ReducerError> {
|
||||
let identifier = self.reduce_identifier(&function.identifier)?;
|
||||
|
||||
let mut annotations = vec![];
|
||||
@ -591,14 +558,7 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
|
||||
|
||||
let block = self.reduce_block(&function.block)?;
|
||||
|
||||
self.reducer.reduce_function(
|
||||
function,
|
||||
identifier,
|
||||
annotations,
|
||||
inputs,
|
||||
output,
|
||||
block,
|
||||
self.in_circuit,
|
||||
)
|
||||
self.reducer
|
||||
.reduce_function(function, identifier, annotations, inputs, output, block)
|
||||
}
|
||||
}
|
||||
|
@ -20,34 +20,26 @@ use indexmap::IndexMap;
|
||||
// Needed to fix clippy bug.
|
||||
#[allow(clippy::redundant_closure)]
|
||||
pub trait ReconstructingReducer {
|
||||
fn reduce_type(
|
||||
&mut self,
|
||||
_type_: &Type,
|
||||
new: Type,
|
||||
_in_circuit: bool,
|
||||
_span: &Span,
|
||||
) -> Result<Type, CanonicalizeError> {
|
||||
fn in_circuit(&self) -> bool;
|
||||
fn swap_in_circuit(&mut self);
|
||||
|
||||
fn reduce_type(&mut self, _type_: &Type, new: Type, _span: &Span) -> Result<Type, ReducerError> {
|
||||
Ok(new)
|
||||
}
|
||||
|
||||
// Expressions
|
||||
fn reduce_expression(
|
||||
&mut self,
|
||||
_expression: &Expression,
|
||||
new: Expression,
|
||||
_in_circuit: bool,
|
||||
) -> Result<Expression, CanonicalizeError> {
|
||||
fn reduce_expression(&mut self, _expression: &Expression, new: Expression) -> Result<Expression, ReducerError> {
|
||||
Ok(new)
|
||||
}
|
||||
|
||||
fn reduce_identifier(&mut self, identifier: &Identifier) -> Result<Identifier, CanonicalizeError> {
|
||||
fn reduce_identifier(&mut self, identifier: &Identifier) -> Result<Identifier, ReducerError> {
|
||||
Ok(Identifier {
|
||||
name: identifier.name.clone(),
|
||||
span: identifier.span.clone(),
|
||||
})
|
||||
}
|
||||
|
||||
fn reduce_group_tuple(&mut self, group_tuple: &GroupTuple) -> Result<GroupTuple, CanonicalizeError> {
|
||||
fn reduce_group_tuple(&mut self, group_tuple: &GroupTuple) -> Result<GroupTuple, ReducerError> {
|
||||
Ok(GroupTuple {
|
||||
x: group_tuple.x.clone(),
|
||||
y: group_tuple.y.clone(),
|
||||
@ -55,11 +47,7 @@ pub trait ReconstructingReducer {
|
||||
})
|
||||
}
|
||||
|
||||
fn reduce_group_value(
|
||||
&mut self,
|
||||
_group_value: &GroupValue,
|
||||
new: GroupValue,
|
||||
) -> Result<GroupValue, CanonicalizeError> {
|
||||
fn reduce_group_value(&mut self, _group_value: &GroupValue, new: GroupValue) -> Result<GroupValue, ReducerError> {
|
||||
Ok(new)
|
||||
}
|
||||
|
||||
@ -67,7 +55,7 @@ pub trait ReconstructingReducer {
|
||||
&mut self,
|
||||
_value: &ValueExpression,
|
||||
new: ValueExpression,
|
||||
) -> Result<ValueExpression, CanonicalizeError> {
|
||||
) -> Result<ValueExpression, ReducerError> {
|
||||
Ok(new)
|
||||
}
|
||||
|
||||
@ -77,8 +65,7 @@ pub trait ReconstructingReducer {
|
||||
left: Expression,
|
||||
right: Expression,
|
||||
op: BinaryOperation,
|
||||
_in_circuit: bool,
|
||||
) -> Result<BinaryExpression, CanonicalizeError> {
|
||||
) -> Result<BinaryExpression, ReducerError> {
|
||||
Ok(BinaryExpression {
|
||||
left: Box::new(left),
|
||||
right: Box::new(right),
|
||||
@ -92,8 +79,7 @@ pub trait ReconstructingReducer {
|
||||
unary: &UnaryExpression,
|
||||
inner: Expression,
|
||||
op: UnaryOperation,
|
||||
_in_circuit: bool,
|
||||
) -> Result<UnaryExpression, CanonicalizeError> {
|
||||
) -> Result<UnaryExpression, ReducerError> {
|
||||
Ok(UnaryExpression {
|
||||
inner: Box::new(inner),
|
||||
op,
|
||||
@ -107,8 +93,7 @@ pub trait ReconstructingReducer {
|
||||
condition: Expression,
|
||||
if_true: Expression,
|
||||
if_false: Expression,
|
||||
_in_circuit: bool,
|
||||
) -> Result<TernaryExpression, CanonicalizeError> {
|
||||
) -> Result<TernaryExpression, ReducerError> {
|
||||
Ok(TernaryExpression {
|
||||
condition: Box::new(condition),
|
||||
if_true: Box::new(if_true),
|
||||
@ -122,8 +107,7 @@ pub trait ReconstructingReducer {
|
||||
cast: &CastExpression,
|
||||
inner: Expression,
|
||||
target_type: Type,
|
||||
_in_circuit: bool,
|
||||
) -> Result<CastExpression, CanonicalizeError> {
|
||||
) -> Result<CastExpression, ReducerError> {
|
||||
Ok(CastExpression {
|
||||
inner: Box::new(inner),
|
||||
target_type,
|
||||
@ -135,8 +119,7 @@ pub trait ReconstructingReducer {
|
||||
&mut self,
|
||||
array_inline: &ArrayInlineExpression,
|
||||
elements: Vec<SpreadOrExpression>,
|
||||
_in_circuit: bool,
|
||||
) -> Result<ArrayInlineExpression, CanonicalizeError> {
|
||||
) -> Result<ArrayInlineExpression, ReducerError> {
|
||||
Ok(ArrayInlineExpression {
|
||||
elements,
|
||||
span: array_inline.span.clone(),
|
||||
@ -147,8 +130,7 @@ pub trait ReconstructingReducer {
|
||||
&mut self,
|
||||
array_init: &ArrayInitExpression,
|
||||
element: Expression,
|
||||
_in_circuit: bool,
|
||||
) -> Result<ArrayInitExpression, CanonicalizeError> {
|
||||
) -> Result<ArrayInitExpression, ReducerError> {
|
||||
Ok(ArrayInitExpression {
|
||||
element: Box::new(element),
|
||||
dimensions: array_init.dimensions.clone(),
|
||||
@ -161,8 +143,7 @@ pub trait ReconstructingReducer {
|
||||
array_access: &ArrayAccessExpression,
|
||||
array: Expression,
|
||||
index: Expression,
|
||||
_in_circuit: bool,
|
||||
) -> Result<ArrayAccessExpression, CanonicalizeError> {
|
||||
) -> Result<ArrayAccessExpression, ReducerError> {
|
||||
Ok(ArrayAccessExpression {
|
||||
array: Box::new(array),
|
||||
index: Box::new(index),
|
||||
@ -176,8 +157,7 @@ pub trait ReconstructingReducer {
|
||||
array: Expression,
|
||||
left: Option<Expression>,
|
||||
right: Option<Expression>,
|
||||
_in_circuit: bool,
|
||||
) -> Result<ArrayRangeAccessExpression, CanonicalizeError> {
|
||||
) -> Result<ArrayRangeAccessExpression, ReducerError> {
|
||||
Ok(ArrayRangeAccessExpression {
|
||||
array: Box::new(array),
|
||||
left: left.map(|expr| Box::new(expr)),
|
||||
@ -190,8 +170,7 @@ pub trait ReconstructingReducer {
|
||||
&mut self,
|
||||
tuple_init: &TupleInitExpression,
|
||||
elements: Vec<Expression>,
|
||||
_in_circuit: bool,
|
||||
) -> Result<TupleInitExpression, CanonicalizeError> {
|
||||
) -> Result<TupleInitExpression, ReducerError> {
|
||||
Ok(TupleInitExpression {
|
||||
elements,
|
||||
span: tuple_init.span.clone(),
|
||||
@ -202,8 +181,7 @@ pub trait ReconstructingReducer {
|
||||
&mut self,
|
||||
tuple_access: &TupleAccessExpression,
|
||||
tuple: Expression,
|
||||
_in_circuit: bool,
|
||||
) -> Result<TupleAccessExpression, CanonicalizeError> {
|
||||
) -> Result<TupleAccessExpression, ReducerError> {
|
||||
Ok(TupleAccessExpression {
|
||||
tuple: Box::new(tuple),
|
||||
index: tuple_access.index.clone(),
|
||||
@ -216,8 +194,7 @@ pub trait ReconstructingReducer {
|
||||
_variable: &CircuitImpliedVariableDefinition,
|
||||
identifier: Identifier,
|
||||
expression: Option<Expression>,
|
||||
_in_circuit: bool,
|
||||
) -> Result<CircuitImpliedVariableDefinition, CanonicalizeError> {
|
||||
) -> Result<CircuitImpliedVariableDefinition, ReducerError> {
|
||||
Ok(CircuitImpliedVariableDefinition { identifier, expression })
|
||||
}
|
||||
|
||||
@ -226,8 +203,7 @@ pub trait ReconstructingReducer {
|
||||
circuit_init: &CircuitInitExpression,
|
||||
name: Identifier,
|
||||
members: Vec<CircuitImpliedVariableDefinition>,
|
||||
_in_circuit: bool,
|
||||
) -> Result<CircuitInitExpression, CanonicalizeError> {
|
||||
) -> Result<CircuitInitExpression, ReducerError> {
|
||||
Ok(CircuitInitExpression {
|
||||
name,
|
||||
members,
|
||||
@ -240,8 +216,7 @@ pub trait ReconstructingReducer {
|
||||
circuit_member_access: &CircuitMemberAccessExpression,
|
||||
circuit: Expression,
|
||||
name: Identifier,
|
||||
_in_circuit: bool,
|
||||
) -> Result<CircuitMemberAccessExpression, CanonicalizeError> {
|
||||
) -> Result<CircuitMemberAccessExpression, ReducerError> {
|
||||
Ok(CircuitMemberAccessExpression {
|
||||
circuit: Box::new(circuit),
|
||||
name,
|
||||
@ -254,8 +229,7 @@ pub trait ReconstructingReducer {
|
||||
circuit_static_fn_access: &CircuitStaticFunctionAccessExpression,
|
||||
circuit: Expression,
|
||||
name: Identifier,
|
||||
_in_circuit: bool,
|
||||
) -> Result<CircuitStaticFunctionAccessExpression, CanonicalizeError> {
|
||||
) -> Result<CircuitStaticFunctionAccessExpression, ReducerError> {
|
||||
Ok(CircuitStaticFunctionAccessExpression {
|
||||
circuit: Box::new(circuit),
|
||||
name,
|
||||
@ -268,8 +242,7 @@ pub trait ReconstructingReducer {
|
||||
call: &CallExpression,
|
||||
function: Expression,
|
||||
arguments: Vec<Expression>,
|
||||
_in_circuit: bool,
|
||||
) -> Result<CallExpression, CanonicalizeError> {
|
||||
) -> Result<CallExpression, ReducerError> {
|
||||
Ok(CallExpression {
|
||||
function: Box::new(function),
|
||||
arguments,
|
||||
@ -278,12 +251,7 @@ pub trait ReconstructingReducer {
|
||||
}
|
||||
|
||||
// Statements
|
||||
fn reduce_statement(
|
||||
&mut self,
|
||||
_statement: &Statement,
|
||||
new: Statement,
|
||||
_in_circuit: bool,
|
||||
) -> Result<Statement, CanonicalizeError> {
|
||||
fn reduce_statement(&mut self, _statement: &Statement, new: Statement) -> Result<Statement, ReducerError> {
|
||||
Ok(new)
|
||||
}
|
||||
|
||||
@ -291,8 +259,7 @@ pub trait ReconstructingReducer {
|
||||
&mut self,
|
||||
return_statement: &ReturnStatement,
|
||||
expression: Expression,
|
||||
_in_circuit: bool,
|
||||
) -> Result<ReturnStatement, CanonicalizeError> {
|
||||
) -> Result<ReturnStatement, ReducerError> {
|
||||
Ok(ReturnStatement {
|
||||
expression,
|
||||
span: return_statement.span.clone(),
|
||||
@ -303,7 +270,7 @@ pub trait ReconstructingReducer {
|
||||
&mut self,
|
||||
variable_name: &VariableName,
|
||||
identifier: Identifier,
|
||||
) -> Result<VariableName, CanonicalizeError> {
|
||||
) -> Result<VariableName, ReducerError> {
|
||||
Ok(VariableName {
|
||||
mutable: variable_name.mutable,
|
||||
identifier,
|
||||
@ -317,8 +284,7 @@ pub trait ReconstructingReducer {
|
||||
variable_names: Vec<VariableName>,
|
||||
type_: Option<Type>,
|
||||
value: Expression,
|
||||
_in_circuit: bool,
|
||||
) -> Result<DefinitionStatement, CanonicalizeError> {
|
||||
) -> Result<DefinitionStatement, ReducerError> {
|
||||
Ok(DefinitionStatement {
|
||||
declaration_type: definition.declaration_type.clone(),
|
||||
variable_names,
|
||||
@ -332,8 +298,7 @@ pub trait ReconstructingReducer {
|
||||
&mut self,
|
||||
_access: &AssigneeAccess,
|
||||
new: AssigneeAccess,
|
||||
_in_circuit: bool,
|
||||
) -> Result<AssigneeAccess, CanonicalizeError> {
|
||||
) -> Result<AssigneeAccess, ReducerError> {
|
||||
Ok(new)
|
||||
}
|
||||
|
||||
@ -342,8 +307,7 @@ pub trait ReconstructingReducer {
|
||||
assignee: &Assignee,
|
||||
identifier: Identifier,
|
||||
accesses: Vec<AssigneeAccess>,
|
||||
_in_circuit: bool,
|
||||
) -> Result<Assignee, CanonicalizeError> {
|
||||
) -> Result<Assignee, ReducerError> {
|
||||
Ok(Assignee {
|
||||
identifier,
|
||||
accesses,
|
||||
@ -356,8 +320,7 @@ pub trait ReconstructingReducer {
|
||||
assign: &AssignStatement,
|
||||
assignee: Assignee,
|
||||
value: Expression,
|
||||
_in_circuit: bool,
|
||||
) -> Result<AssignStatement, CanonicalizeError> {
|
||||
) -> Result<AssignStatement, ReducerError> {
|
||||
Ok(AssignStatement {
|
||||
operation: assign.operation.clone(),
|
||||
assignee,
|
||||
@ -372,8 +335,7 @@ pub trait ReconstructingReducer {
|
||||
condition: Expression,
|
||||
block: Block,
|
||||
statement: Option<Statement>,
|
||||
_in_circuit: bool,
|
||||
) -> Result<ConditionalStatement, CanonicalizeError> {
|
||||
) -> Result<ConditionalStatement, ReducerError> {
|
||||
Ok(ConditionalStatement {
|
||||
condition,
|
||||
block,
|
||||
@ -389,8 +351,7 @@ pub trait ReconstructingReducer {
|
||||
start: Expression,
|
||||
stop: Expression,
|
||||
block: Block,
|
||||
_in_circuit: bool,
|
||||
) -> Result<IterationStatement, CanonicalizeError> {
|
||||
) -> Result<IterationStatement, ReducerError> {
|
||||
Ok(IterationStatement {
|
||||
variable,
|
||||
start,
|
||||
@ -404,8 +365,7 @@ pub trait ReconstructingReducer {
|
||||
&mut self,
|
||||
console: &ConsoleStatement,
|
||||
function: ConsoleFunction,
|
||||
_in_circuit: bool,
|
||||
) -> Result<ConsoleStatement, CanonicalizeError> {
|
||||
) -> Result<ConsoleStatement, ReducerError> {
|
||||
Ok(ConsoleStatement {
|
||||
function,
|
||||
span: console.span.clone(),
|
||||
@ -416,20 +376,14 @@ pub trait ReconstructingReducer {
|
||||
&mut self,
|
||||
expression_statement: &ExpressionStatement,
|
||||
expression: Expression,
|
||||
_in_circuit: bool,
|
||||
) -> Result<ExpressionStatement, CanonicalizeError> {
|
||||
) -> Result<ExpressionStatement, ReducerError> {
|
||||
Ok(ExpressionStatement {
|
||||
expression,
|
||||
span: expression_statement.span.clone(),
|
||||
})
|
||||
}
|
||||
|
||||
fn reduce_block(
|
||||
&mut self,
|
||||
block: &Block,
|
||||
statements: Vec<Statement>,
|
||||
_in_circuit: bool,
|
||||
) -> Result<Block, CanonicalizeError> {
|
||||
fn reduce_block(&mut self, block: &Block, statements: Vec<Statement>) -> Result<Block, ReducerError> {
|
||||
Ok(Block {
|
||||
statements,
|
||||
span: block.span.clone(),
|
||||
@ -445,7 +399,7 @@ pub trait ReconstructingReducer {
|
||||
circuits: IndexMap<Identifier, Circuit>,
|
||||
functions: IndexMap<Identifier, Function>,
|
||||
global_consts: IndexMap<String, DefinitionStatement>,
|
||||
) -> Result<Program, CanonicalizeError> {
|
||||
) -> Result<Program, ReducerError> {
|
||||
Ok(Program {
|
||||
name: program.name.clone(),
|
||||
expected_input,
|
||||
@ -461,8 +415,7 @@ pub trait ReconstructingReducer {
|
||||
variable: &FunctionInputVariable,
|
||||
identifier: Identifier,
|
||||
type_: Type,
|
||||
_in_circuit: bool,
|
||||
) -> Result<FunctionInputVariable, CanonicalizeError> {
|
||||
) -> Result<FunctionInputVariable, ReducerError> {
|
||||
Ok(FunctionInputVariable {
|
||||
identifier,
|
||||
const_: variable.const_,
|
||||
@ -476,8 +429,7 @@ pub trait ReconstructingReducer {
|
||||
&mut self,
|
||||
_input: &FunctionInput,
|
||||
new: FunctionInput,
|
||||
_in_circuit: bool,
|
||||
) -> Result<FunctionInput, CanonicalizeError> {
|
||||
) -> Result<FunctionInput, ReducerError> {
|
||||
Ok(new)
|
||||
}
|
||||
|
||||
@ -485,7 +437,7 @@ pub trait ReconstructingReducer {
|
||||
&mut self,
|
||||
_package_or_packages: &PackageOrPackages,
|
||||
new: PackageOrPackages,
|
||||
) -> Result<PackageOrPackages, CanonicalizeError> {
|
||||
) -> Result<PackageOrPackages, ReducerError> {
|
||||
Ok(new)
|
||||
}
|
||||
|
||||
@ -493,7 +445,7 @@ pub trait ReconstructingReducer {
|
||||
&mut self,
|
||||
import: &ImportStatement,
|
||||
package_or_packages: PackageOrPackages,
|
||||
) -> Result<ImportStatement, CanonicalizeError> {
|
||||
) -> Result<ImportStatement, ReducerError> {
|
||||
Ok(ImportStatement {
|
||||
package_or_packages,
|
||||
span: import.span.clone(),
|
||||
@ -504,7 +456,7 @@ pub trait ReconstructingReducer {
|
||||
&mut self,
|
||||
_circuit_member: &CircuitMember,
|
||||
new: CircuitMember,
|
||||
) -> Result<CircuitMember, CanonicalizeError> {
|
||||
) -> Result<CircuitMember, ReducerError> {
|
||||
Ok(new)
|
||||
}
|
||||
|
||||
@ -513,15 +465,11 @@ pub trait ReconstructingReducer {
|
||||
_circuit: &Circuit,
|
||||
circuit_name: Identifier,
|
||||
members: Vec<CircuitMember>,
|
||||
) -> Result<Circuit, CanonicalizeError> {
|
||||
) -> Result<Circuit, ReducerError> {
|
||||
Ok(Circuit { circuit_name, members })
|
||||
}
|
||||
|
||||
fn reduce_annotation(
|
||||
&mut self,
|
||||
annotation: &Annotation,
|
||||
name: Identifier,
|
||||
) -> Result<Annotation, CanonicalizeError> {
|
||||
fn reduce_annotation(&mut self, annotation: &Annotation, name: Identifier) -> Result<Annotation, ReducerError> {
|
||||
Ok(Annotation {
|
||||
span: annotation.span.clone(),
|
||||
name,
|
||||
@ -538,8 +486,7 @@ pub trait ReconstructingReducer {
|
||||
input: Vec<FunctionInput>,
|
||||
output: Option<Type>,
|
||||
block: Block,
|
||||
_in_circuit: bool,
|
||||
) -> Result<Function, CanonicalizeError> {
|
||||
) -> Result<Function, ReducerError> {
|
||||
Ok(Function {
|
||||
identifier,
|
||||
annotations,
|
||||
|
@ -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, FormattedString, Node, Span};
|
||||
use crate::{Expression, FormatString, Node, Span};
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
@ -22,9 +22,9 @@ use std::fmt;
|
||||
#[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
|
||||
pub enum ConsoleFunction {
|
||||
Assert(Expression),
|
||||
Debug(FormattedString),
|
||||
Error(FormattedString),
|
||||
Log(FormattedString),
|
||||
Debug(FormatString),
|
||||
Error(FormatString),
|
||||
Log(FormatString),
|
||||
}
|
||||
|
||||
impl fmt::Display for ConsoleFunction {
|
||||
|
@ -21,19 +21,19 @@ use std::fmt;
|
||||
use tendril::StrTendril;
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
|
||||
pub enum FormattedStringPart {
|
||||
pub enum FormatStringPart {
|
||||
Const(#[serde(with = "crate::common::tendril_json")] StrTendril),
|
||||
Container,
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
|
||||
pub struct FormattedString {
|
||||
pub parts: Vec<FormattedStringPart>,
|
||||
pub struct FormatString {
|
||||
pub parts: Vec<FormatStringPart>,
|
||||
pub parameters: Vec<Expression>,
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
impl fmt::Display for FormattedString {
|
||||
impl fmt::Display for FormatString {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
@ -41,8 +41,8 @@ impl fmt::Display for FormattedString {
|
||||
self.parts
|
||||
.iter()
|
||||
.map(|x| match x {
|
||||
FormattedStringPart::Const(x) => x,
|
||||
FormattedStringPart::Container => "{}",
|
||||
FormatStringPart::Const(x) => x,
|
||||
FormatStringPart::Container => "{}",
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
.join("")
|
||||
@ -50,7 +50,7 @@ impl fmt::Display for FormattedString {
|
||||
}
|
||||
}
|
||||
|
||||
impl Node for FormattedString {
|
||||
impl Node for FormatString {
|
||||
fn span(&self) -> &Span {
|
||||
&self.span
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "leo-compiler"
|
||||
version = "1.2.3"
|
||||
version = "1.4.0"
|
||||
authors = [ "The Aleo Team <hello@aleo.org>" ]
|
||||
description = "Compiler of the Leo programming language"
|
||||
homepage = "https://aleo.org"
|
||||
@ -19,58 +19,61 @@ edition = "2018"
|
||||
|
||||
[dependencies.leo-ast]
|
||||
path = "../ast"
|
||||
version = "1.2.3"
|
||||
version = "1.4.0"
|
||||
|
||||
[dependencies.leo-imports]
|
||||
path = "../imports"
|
||||
version = "1.2.3"
|
||||
version = "1.4.0"
|
||||
|
||||
[dependencies.leo-input]
|
||||
path = "../input"
|
||||
version = "1.2.3"
|
||||
version = "1.4.0"
|
||||
|
||||
[dependencies.leo-package]
|
||||
path = "../package"
|
||||
version = "1.2.3"
|
||||
version = "1.4.0"
|
||||
|
||||
[dependencies.leo-state]
|
||||
path = "../state"
|
||||
version = "1.2.3"
|
||||
version = "1.4.0"
|
||||
|
||||
[dependencies.leo-asg]
|
||||
path = "../asg"
|
||||
version = "1.2.3"
|
||||
version = "1.4.0"
|
||||
|
||||
[dependencies.leo-parser]
|
||||
path = "../parser"
|
||||
version = "1.2.3"
|
||||
version = "1.4.0"
|
||||
|
||||
[dependencies.leo-asg-passes]
|
||||
path = "../asg-passes"
|
||||
version = "1.2.3"
|
||||
version = "1.4.0"
|
||||
|
||||
[dependencies.tendril]
|
||||
version = "0.4"
|
||||
|
||||
[dependencies.snarkvm-curves]
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
default-features = false
|
||||
|
||||
[dependencies.snarkvm-fields]
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
default-features = false
|
||||
|
||||
[dependencies.snarkvm-dpc]
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
default-features = false
|
||||
|
||||
[dependencies.snarkvm-gadgets]
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
default-features = false
|
||||
|
||||
[dependencies.snarkvm-r1cs]
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
default-features = false
|
||||
|
||||
[dependencies.snarkvm-utilities]
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
|
||||
[dependencies.bincode]
|
||||
version = "1.3"
|
||||
@ -111,9 +114,12 @@ version = "0.3"
|
||||
default-features = false
|
||||
|
||||
[dev-dependencies.snarkvm-algorithms]
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
default-features = false
|
||||
|
||||
[dev-dependencies.tempfile]
|
||||
version = "3.0.4"
|
||||
|
||||
[features]
|
||||
default = [ ]
|
||||
ci_skip = [ "leo-ast/ci_skip" ]
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user