Merge pull request #27953 from AleoHQ/fix/finalize-flattening

[Fix] Flattening finalize.
This commit is contained in:
d0cd 2024-05-21 11:37:06 -07:00 committed by GitHub
commit 5b4d66b4fb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
25 changed files with 175 additions and 113 deletions

View File

@ -16,7 +16,7 @@
use crate::Flattener;
use leo_ast::{Function, ProgramReconstructor, ProgramScope, Statement, StatementReconstructor};
use leo_ast::{Finalize, Function, ProgramReconstructor, ProgramScope, Statement, StatementReconstructor};
impl ProgramReconstructor for Flattener<'_> {
/// Flattens a program scope.
@ -59,7 +59,23 @@ impl ProgramReconstructor for Flattener<'_> {
output: function.output,
output_type: function.output_type,
block,
finalize: function.finalize,
finalize: function.finalize.map(|finalize| {
// Set the `is_finalize` flag before reconstructing the finalize block.
self.is_finalize = true;
// Reconstruct the finalize block.
let finalize = Finalize {
identifier: finalize.identifier,
input: finalize.input,
output: finalize.output,
output_type: finalize.output_type,
block: self.reconstruct_block(finalize.block).0,
span: finalize.span,
id: finalize.id,
};
// Reset the `is_finalize` flag.
self.is_finalize = false;
finalize
}),
span: function.span,
id: function.id,
}

View File

@ -61,6 +61,11 @@ impl StatementReconstructor for Flattener<'_> {
fn reconstruct_assert(&mut self, input: AssertStatement) -> (Statement, Self::AdditionalOutput) {
let mut statements = Vec::new();
// If traversing a `finalize` block, return the assert as is.
if self.is_finalize {
return (Statement::Assert(input), statements);
}
// Flatten the arguments of the assert statement.
let assert = AssertStatement {
span: input.span,
@ -222,6 +227,26 @@ impl StatementReconstructor for Flattener<'_> {
fn reconstruct_conditional(&mut self, conditional: ConditionalStatement) -> (Statement, Self::AdditionalOutput) {
let mut statements = Vec::with_capacity(conditional.then.statements.len());
// If traversing a `finalize` block, only reconstruct the if and else blocks of the conditional statement.
if self.is_finalize {
let then_block = self.reconstruct_block(conditional.then).0;
let otherwise_block = conditional.otherwise.map(|statement| match *statement {
Statement::Block(block) => Box::new(Statement::Block(self.reconstruct_block(block).0)),
_ => unreachable!("Parsing guarantees that the `otherwise` is always a `Block`"),
});
return (
Statement::Conditional(ConditionalStatement {
condition: conditional.condition,
then: then_block,
otherwise: otherwise_block,
span: conditional.span,
id: conditional.id,
}),
statements,
);
}
// Add condition to the condition stack.
self.condition_stack.push(conditional.condition.clone());
@ -269,6 +294,10 @@ impl StatementReconstructor for Flattener<'_> {
/// Transforms a return statement into an empty block statement.
/// Stores the arguments to the return statement, which are later folded into a single return statement at the end of the function.
fn reconstruct_return(&mut self, input: ReturnStatement) -> (Statement, Self::AdditionalOutput) {
// If traversing a `finalize` block, return as is.
if self.is_finalize {
return (Statement::Return(input), Default::default());
}
// Construct the associated guard.
let guard = self.construct_guard();

View File

@ -67,6 +67,8 @@ pub struct Flattener<'a> {
pub(crate) returns: Vec<(Option<Expression>, ReturnStatement)>,
/// The program name.
pub(crate) program: Option<Symbol>,
/// Whether we are currently traversing a `finalize` block.
pub(crate) is_finalize: bool,
}
impl<'a> Flattener<'a> {
@ -84,6 +86,7 @@ impl<'a> Flattener<'a> {
condition_stack: Vec::new(),
returns: Vec::new(),
program: None,
is_finalize: false,
}
}

View File

@ -9,10 +9,10 @@ outputs:
initial_ast: 46b97966bd59f7f2ef2a8e9db3276ecccfb56cae533e223e8664aa40b7cd976f
unrolled_ast: 46b97966bd59f7f2ef2a8e9db3276ecccfb56cae533e223e8664aa40b7cd976f
ssa_ast: dc2456142b747ad537b8c8f4f454d902a63be4fd33ea0e3995b32d3e27696b6f
flattened_ast: 97e88581628c88cb5041806210a506045c89e331d65f9565b31c7bf78fd28505
destructured_ast: 71dda6bb1090bef21d053bd16480c533355595bf7a4361d706ce576236c3e561
inlined_ast: 71dda6bb1090bef21d053bd16480c533355595bf7a4361d706ce576236c3e561
dce_ast: 71dda6bb1090bef21d053bd16480c533355595bf7a4361d706ce576236c3e561
flattened_ast: 095a0ebb0a930b30166018e731f93f65c4128679ada974b881fd3fb80edf121c
destructured_ast: 29b85d96f313c94b2d2864511b7317c04095dccc1d9c481d28093368c72096e2
inlined_ast: 29b85d96f313c94b2d2864511b7317c04095dccc1d9c481d28093368c72096e2
dce_ast: 29b85d96f313c94b2d2864511b7317c04095dccc1d9c481d28093368c72096e2
bytecode: 66a857f6a5e79328d146c55f5e42c6eb249b7c6c9cc1c6e0c534328b85e649eb
errors: ""
warnings: ""

View File

@ -9,10 +9,10 @@ outputs:
initial_ast: d22023292a932c574e079af02a3fe01dbef4d23182af231295a5ac416624f327
unrolled_ast: d22023292a932c574e079af02a3fe01dbef4d23182af231295a5ac416624f327
ssa_ast: d22023292a932c574e079af02a3fe01dbef4d23182af231295a5ac416624f327
flattened_ast: 7849fd84194fbc2e18cf12f92a9bee03f9e8cc88345df61dec47f060d6f3d463
destructured_ast: e2470df3c2ccb69bf2f164ea073e332d5a67c11436833f0503169b0339f92ab5
inlined_ast: e2470df3c2ccb69bf2f164ea073e332d5a67c11436833f0503169b0339f92ab5
dce_ast: e2470df3c2ccb69bf2f164ea073e332d5a67c11436833f0503169b0339f92ab5
flattened_ast: cadf6d4969374f8f9d7d2d6df84f1527f3006a50c7ffc4a24ec462c20c91f919
destructured_ast: f20ab6f576c360e3014bbdb74522b858cfe1c502418c1c740897fea39d536371
inlined_ast: f20ab6f576c360e3014bbdb74522b858cfe1c502418c1c740897fea39d536371
dce_ast: f20ab6f576c360e3014bbdb74522b858cfe1c502418c1c740897fea39d536371
bytecode: bbabb76319d2c69ed28a19090796ad7f974be74a1ef138d0cc58507cc4787632
errors: ""
warnings: ""

View File

@ -9,10 +9,10 @@ outputs:
initial_ast: 3c93df9e002456e3280997e691a26070059d00b3360aedfa21eadbf6ac874d55
unrolled_ast: c7e2d16c2f3925ca9c070c3c5e732afa2da488bec9913c2c1d60253fb3864e58
ssa_ast: 86d0e28c9fb58f62f297380f63bb1d82dbd31dea4b3bacaf2b78def816cc40f7
flattened_ast: f4dacdcab926d687a4f80ac491f9d8be747f18f067db603f35ccbd9800804fde
destructured_ast: 3324379561b920162a9510e6608a5f4f4f4f7be8df7507897292d26261a4f48f
inlined_ast: 3324379561b920162a9510e6608a5f4f4f4f7be8df7507897292d26261a4f48f
dce_ast: 3324379561b920162a9510e6608a5f4f4f4f7be8df7507897292d26261a4f48f
flattened_ast: b0641041e7a396617bef2977459d151e2d6a300128ee8ddd369fcd6625839e2f
destructured_ast: 461f5b8b8a43846985ed0d7222683bcd65a9edaf22514c52153cd993c54b2fc5
inlined_ast: 461f5b8b8a43846985ed0d7222683bcd65a9edaf22514c52153cd993c54b2fc5
dce_ast: 461f5b8b8a43846985ed0d7222683bcd65a9edaf22514c52153cd993c54b2fc5
bytecode: 34335e40c3ca26e00044d055cc0cb8d262fce1ac49a4940b36b1136e0772d305
errors: ""
warnings: ""

View File

@ -9,10 +9,10 @@ outputs:
initial_ast: 579697d492aea0987211cee47e9c9f2071010c3231a95a51d7f74c553fee7f10
unrolled_ast: b6dd96e88085733fd3ac7edee137e379c158c987570e453f68acbb71465ca781
ssa_ast: 69fe5fe4fa856413a0e16e9c28dd3f280d90a0ed936324f4ebeea49f4acc90ee
flattened_ast: a71aa3203192639eb05b7a2074230211002d5cda95c2e05383b2b187491c7ac0
destructured_ast: ae1b58fb26a8532993ab2eb9f3baae3f5ad718aa99bfdb794690883f4ecf719a
inlined_ast: ebcb03ac587c9b1c75dac698ba51b92a17c864b1b414c81c227154735d0d986b
dce_ast: ebcb03ac587c9b1c75dac698ba51b92a17c864b1b414c81c227154735d0d986b
flattened_ast: b8373a67cec47aaa29dcae943ccd792ecad4d44685a0014974d0d693b8cc292a
destructured_ast: 866a655f2e4ee44c5b59fb0992a180ffb58c915f69bd38bc3e85de53e92a43d4
inlined_ast: 1ac1f8e17906032a4bc475919c5cfe874ba71ee3c6f40587406f7ad03e1f87f3
dce_ast: 1ac1f8e17906032a4bc475919c5cfe874ba71ee3c6f40587406f7ad03e1f87f3
bytecode: 799c84f9a28bcdd1cb72269b56baae0905a136fc2d041745fb7ae52c9958b24e
errors: ""
warnings: ""

View File

@ -9,10 +9,10 @@ outputs:
initial_ast: 21db026676b02baa0d131a215daa74249bb578f1768855ffce41b09458340033
unrolled_ast: 21db026676b02baa0d131a215daa74249bb578f1768855ffce41b09458340033
ssa_ast: 7b3a647dfdd6ef643d5710df4ead3b98d93025b1f0264382bfff2c24e55d1cb8
flattened_ast: e552d82aad18b816cfdb8711f5b6f80c967775112b3ef2cf4d5ee712e0339106
destructured_ast: be725f4ba9212e153a2ddf8a6f770c58d7a2b1b29a5e826f21435f68fba82578
inlined_ast: be725f4ba9212e153a2ddf8a6f770c58d7a2b1b29a5e826f21435f68fba82578
dce_ast: be725f4ba9212e153a2ddf8a6f770c58d7a2b1b29a5e826f21435f68fba82578
flattened_ast: 193844518c7bfd7e01d698a52bdbcf70c82a1937ee507adf4d00f390f84df91d
destructured_ast: 9be589c8b8617ea2c31b32e8250e14faaae9009aa0361f54b0d3a96891fffe35
inlined_ast: 9be589c8b8617ea2c31b32e8250e14faaae9009aa0361f54b0d3a96891fffe35
dce_ast: 9be589c8b8617ea2c31b32e8250e14faaae9009aa0361f54b0d3a96891fffe35
bytecode: ec9d10d78356538cf9f94bc46c20c33001a05100906259e217eeea2cfd0c4a66
errors: ""
warnings: ""

View File

@ -9,10 +9,10 @@ outputs:
initial_ast: 2b4311f224203d0a83a9e7821524e46bef0eaacd87717329fe86696cad6f2a61
unrolled_ast: 2b4311f224203d0a83a9e7821524e46bef0eaacd87717329fe86696cad6f2a61
ssa_ast: b46417bdbf9c7dfd30150e16923bb7e5f1e5699489867c606be254917abbc90d
flattened_ast: a00704d16fc88fb9485a4e0420b68ca30eac03b9f52923df06c058593c6da195
destructured_ast: 614e4825a4c9ed7f5b0bdbc86506e91b5386eb2c7e6201c931d05cd69fb36043
inlined_ast: 614e4825a4c9ed7f5b0bdbc86506e91b5386eb2c7e6201c931d05cd69fb36043
dce_ast: 614e4825a4c9ed7f5b0bdbc86506e91b5386eb2c7e6201c931d05cd69fb36043
flattened_ast: f0b5e38b1d67cacf61841efb72898b80adc6539916f6ac422ce081ef68c982a3
destructured_ast: a889ad3b5a7b176755be2efe3b31fe968185bc67326725731912c3b3b29f44e5
inlined_ast: a889ad3b5a7b176755be2efe3b31fe968185bc67326725731912c3b3b29f44e5
dce_ast: a889ad3b5a7b176755be2efe3b31fe968185bc67326725731912c3b3b29f44e5
bytecode: 379643d6f93f6040c0bb64ea96345269a23d6fb23fa3eae46ceb8e9ea9c73f9a
errors: ""
warnings: ""

View File

@ -9,10 +9,10 @@ outputs:
initial_ast: 4fd9a923fcf8c5a2f2d02c9b831bd039180254769e92a3ae03da2216775f7e63
unrolled_ast: 9329eff974f22dc5fbea357bc1336d823ad12d87851e61d509f9a22b3941ddd6
ssa_ast: 217effef6281efd10a94925fbe5237172eac4d96433885e491588f2f1a46e55a
flattened_ast: 9b2ff8a6bdb6756fb02559df1b6793570aeeac5d8c45186f573528e8556d07c0
destructured_ast: bdddbe221634c8e1dcf817fa4b336264abd26e7b156d90f03ae2f1f0076acdf6
inlined_ast: bdddbe221634c8e1dcf817fa4b336264abd26e7b156d90f03ae2f1f0076acdf6
dce_ast: bdddbe221634c8e1dcf817fa4b336264abd26e7b156d90f03ae2f1f0076acdf6
flattened_ast: 39efd06c99e424ad701195c858045a8d5f2053704f8c1f6d1b2bf063dd5a8b6e
destructured_ast: 4bdfb095faa307bb502cbc6cf7e73be0b3a7c57dd646818e37b9e2287fdc5619
inlined_ast: 4bdfb095faa307bb502cbc6cf7e73be0b3a7c57dd646818e37b9e2287fdc5619
dce_ast: 4bdfb095faa307bb502cbc6cf7e73be0b3a7c57dd646818e37b9e2287fdc5619
bytecode: 0c73fbf3a08f7b89b82fc3189771704f58740f37c41f9c5aa7aef2a808badf9b
errors: ""
warnings: ""

View File

@ -9,10 +9,10 @@ outputs:
initial_ast: 42f2b37c4ed365be1f60aed2ef9830376dcb2edfab050789b7b63b7e5e75dbbc
unrolled_ast: 42f2b37c4ed365be1f60aed2ef9830376dcb2edfab050789b7b63b7e5e75dbbc
ssa_ast: bdfdc3e00a555dc9e5fbaa42bbfd195e59ce08919324835b0b3922f9f20f7f12
flattened_ast: f0eb10f3368c93edddd730646118d23bcb52b80d8f68719a244d51c649f820ac
destructured_ast: 8e6f5c329820ec4e92fbd99b4cc3280ac2477630302003365fe9f644417ca804
inlined_ast: 8e6f5c329820ec4e92fbd99b4cc3280ac2477630302003365fe9f644417ca804
dce_ast: 8e6f5c329820ec4e92fbd99b4cc3280ac2477630302003365fe9f644417ca804
flattened_ast: 89b58e39475ffe0eea08e113dd18f64c7a7393466b552a3f8c13ff0b056e1f9e
destructured_ast: 223777746d28dc732ec1c439f189723a16e1e8b154e7ccb813f386d4f981533e
inlined_ast: 223777746d28dc732ec1c439f189723a16e1e8b154e7ccb813f386d4f981533e
dce_ast: 223777746d28dc732ec1c439f189723a16e1e8b154e7ccb813f386d4f981533e
bytecode: 6e4a8aeaf3eabc361bf427126c0a7f35c64030fb9c8f66e178c7c05bbede1c48
errors: ""
warnings: ""

View File

@ -9,10 +9,10 @@ outputs:
initial_ast: 00ae8cc302ee7025d063eee1c9ea9b9589cb9e4b94028b931f085c44041032cb
unrolled_ast: 00ae8cc302ee7025d063eee1c9ea9b9589cb9e4b94028b931f085c44041032cb
ssa_ast: ca540994be2e1cb0cdf6b3473d90ed778c7c1a2070ad82183f74625d586f8eb3
flattened_ast: af70353b9c96a1cfe61605303f6363ee8ab283b59ac0a18ea5006b20b222c199
destructured_ast: 4980be46ab5007df59342e1f8802efade3cc04e77ed0b6dfa97004e492edfb78
inlined_ast: 4980be46ab5007df59342e1f8802efade3cc04e77ed0b6dfa97004e492edfb78
dce_ast: 4980be46ab5007df59342e1f8802efade3cc04e77ed0b6dfa97004e492edfb78
flattened_ast: 11838c4a3782a59a2e77c3306aa3475e54c1410cde6285362b271fdf4cf5fa5d
destructured_ast: a67f729fc54ce1e2977bbe1587525830f4241a14686f4e0feda909837e8b52cb
inlined_ast: a67f729fc54ce1e2977bbe1587525830f4241a14686f4e0feda909837e8b52cb
dce_ast: a67f729fc54ce1e2977bbe1587525830f4241a14686f4e0feda909837e8b52cb
bytecode: 2560848929684abb429a7de8a2ff0368fa2ea939f25ae84851be67374b652e8e
errors: ""
warnings: ""

View File

@ -9,10 +9,10 @@ outputs:
initial_ast: 726a9bcb5c98d56a65e14cd1362d48835ffcafadacdb98a5ad0bf38eb5b92aec
unrolled_ast: 726a9bcb5c98d56a65e14cd1362d48835ffcafadacdb98a5ad0bf38eb5b92aec
ssa_ast: 6bc87e36f16e5f3353309d2c7280f0eda43c8cecc2f28d96a29f79afa28bbe5f
flattened_ast: 102791ff2b41f6e0620ec61874abe4b49e9977b1161a08fd342f208cb8e14486
destructured_ast: c73fed24711eaf8f1465cbb59c7df6639f51bda5ebb21da0d39d9eb71fafd723
inlined_ast: c73fed24711eaf8f1465cbb59c7df6639f51bda5ebb21da0d39d9eb71fafd723
dce_ast: c73fed24711eaf8f1465cbb59c7df6639f51bda5ebb21da0d39d9eb71fafd723
flattened_ast: b01c3a3665fd88014a5101ef271a05683ce5ab89e41b65e114063e7e1aaafbd0
destructured_ast: 37efc9d90f347320c70a6809241651d3de45b38636db25f9b5340da850773867
inlined_ast: 37efc9d90f347320c70a6809241651d3de45b38636db25f9b5340da850773867
dce_ast: 37efc9d90f347320c70a6809241651d3de45b38636db25f9b5340da850773867
bytecode: bbef5ec539b8616fe91e41c03c8ea6a71dfd3cb9731e634919bc8356e6664594
errors: ""
warnings: ""

View File

@ -9,10 +9,10 @@ outputs:
initial_ast: 6cf15b0de9fdcf8d9de46628aeeeacbaaddc8e1452ec1aeb447e94da0a336fb1
unrolled_ast: 6cf15b0de9fdcf8d9de46628aeeeacbaaddc8e1452ec1aeb447e94da0a336fb1
ssa_ast: 900b75b5aa816680c3cc9133ee530df22f3d8e9a555b77e7b66f32d7243fe542
flattened_ast: 91dd5cecad4aa325475573c3ac8fc34c82d81ae4114c9f02cf9f5f60bafc9aef
destructured_ast: 86c18064b28556713063dd40006db5c2ddbc814c0624401a9af4e1014f68d216
inlined_ast: 86c18064b28556713063dd40006db5c2ddbc814c0624401a9af4e1014f68d216
dce_ast: 86c18064b28556713063dd40006db5c2ddbc814c0624401a9af4e1014f68d216
flattened_ast: 4c56f909392df5a8ac9cb24ceae20165ecd1d30fdb1dc88aa3e4660315a6da4f
destructured_ast: 696f4451f27a13ab77ca168643feac9cd463bf1bd047f2537251d5bb4668dc15
inlined_ast: 696f4451f27a13ab77ca168643feac9cd463bf1bd047f2537251d5bb4668dc15
dce_ast: 696f4451f27a13ab77ca168643feac9cd463bf1bd047f2537251d5bb4668dc15
bytecode: 33d8ca1b78918f26980919a4a8b332fb9b375ac476b64636a387fdab715d4ed9
errors: ""
warnings: ""

View File

@ -9,10 +9,10 @@ outputs:
initial_ast: 50d96bc477a8528b09993639f92c505b7b91eed0f634f8a982741113bd0912d1
unrolled_ast: 50d96bc477a8528b09993639f92c505b7b91eed0f634f8a982741113bd0912d1
ssa_ast: ab8bfadeab820ffabb413af8450b081200ecc0074e335dc9d2ce0194153ed826
flattened_ast: 3151a26a35fc39acb1bd78005a6c00299c72c1bb168a73196cf10b7a3f31512f
destructured_ast: f648e6e0170a73ac78c50a2ca22d08e035e21f70895dbd350471c3e498423143
inlined_ast: f648e6e0170a73ac78c50a2ca22d08e035e21f70895dbd350471c3e498423143
dce_ast: f648e6e0170a73ac78c50a2ca22d08e035e21f70895dbd350471c3e498423143
flattened_ast: 25598ac625d5475e543b524f26874bdb4c3255ceb2a12ffe96772ef1ddb077eb
destructured_ast: 738d3b0e9066c9efab62de7008b06472f4018606bc21f1637878f886dc1fbfe0
inlined_ast: 738d3b0e9066c9efab62de7008b06472f4018606bc21f1637878f886dc1fbfe0
dce_ast: 738d3b0e9066c9efab62de7008b06472f4018606bc21f1637878f886dc1fbfe0
bytecode: e9bcea998f0ff492fb57deabfcf08c4ed3f854880b595f17c9aa89181feb3764
errors: ""
warnings: ""

View File

@ -9,10 +9,10 @@ outputs:
initial_ast: 329d475959c785e4434b657951d60a67b5623a3994873f0530230155ffa35d80
unrolled_ast: 329d475959c785e4434b657951d60a67b5623a3994873f0530230155ffa35d80
ssa_ast: a1b7f65d63f9d63f50b4d769b48b87abcc6d20d0b69347c3b8f0cb84a7dc3ff8
flattened_ast: badcea479106d411e219a6d3aca622de1d9e3e2c129b60efbad59eb73b336529
destructured_ast: e44205fe03136f850d4c1f66203ad6c42f1c7b4122fcb113af4071ebbbe426f6
inlined_ast: e44205fe03136f850d4c1f66203ad6c42f1c7b4122fcb113af4071ebbbe426f6
dce_ast: e44205fe03136f850d4c1f66203ad6c42f1c7b4122fcb113af4071ebbbe426f6
flattened_ast: b5b0350ac623337c8e950bf82816b918b5cac1584217aa99b721053fe720ba81
destructured_ast: a55b2d9f9fa6663974244752982b20c05595b69af772527c71af30eb2aabf0c3
inlined_ast: a55b2d9f9fa6663974244752982b20c05595b69af772527c71af30eb2aabf0c3
dce_ast: a55b2d9f9fa6663974244752982b20c05595b69af772527c71af30eb2aabf0c3
bytecode: 10e754c190939dcffa342c5eef2be0dcb73ef1a9b4391a99e963db6dc61bd38a
errors: ""
warnings: ""

View File

@ -9,10 +9,10 @@ outputs:
initial_ast: 439dc6e864f8346a6d8d8d0d663b622523a4f4073e7f618f8a3b48af57751117
unrolled_ast: 439dc6e864f8346a6d8d8d0d663b622523a4f4073e7f618f8a3b48af57751117
ssa_ast: 1691648d977f1ed92edd89210e0e32beac43e921e61f097c9e2d48cdcb7a1c79
flattened_ast: 161e05f17750487cfcbe37b099a9ca694c90fd6d4de62b652dc0a3a28f906fd3
destructured_ast: fc770d497d05cf52fa18d8cae7a160d92f42b6e530412e943be032b57fde0333
inlined_ast: 1a8009ee940ed404ee0ec79951f2f6578c890d997c6f2bdbd6be07bf6cb83632
dce_ast: 1a8009ee940ed404ee0ec79951f2f6578c890d997c6f2bdbd6be07bf6cb83632
flattened_ast: dd7f9e0af0170d189f5fbf9851309261fc50e588df70bd84b2891908cb1498dc
destructured_ast: 84d63fc5bdc9cdbb44ad8464493b4cb41620e6f600662a71bed01814c1b05e72
inlined_ast: 4b94a98b94b15a327d9355602fc0506dea40f05ddc49198b29e34799df1c05ba
dce_ast: 4b94a98b94b15a327d9355602fc0506dea40f05ddc49198b29e34799df1c05ba
bytecode: 643990908e94b8c16515df0d5dcd64918c17b356ad82d652cd9d6504089c49f0
errors: ""
warnings: ""

View File

@ -3,16 +3,16 @@ namespace: Compile
expectation: Pass
outputs:
- - compile:
- initial_symbol_table: a7c2abe734962ef0ce05e807ab7f1fa657be9eef9cb80fbe856d2a135ea6680f
type_checked_symbol_table: 5cd23f35c9f9a5e0f29f8c1772cec1a1f6c5a621b4414a71ce0fae224767d9db
unrolled_symbol_table: 5cd23f35c9f9a5e0f29f8c1772cec1a1f6c5a621b4414a71ce0fae224767d9db
initial_ast: 991d132fe9975a7cb259af42d8942a7efd4a57ece5c7d3239bacaabae17fb9d6
unrolled_ast: 991d132fe9975a7cb259af42d8942a7efd4a57ece5c7d3239bacaabae17fb9d6
ssa_ast: 13d77a08556b597e35c8af0391a83aac325e6b2ebd6d74f3e7b5c0629c64f3e9
flattened_ast: 57c3f6864b8d9e18eb05902e2f0170682f19fe0c7025f608bab60cd81b064a1f
destructured_ast: 4d8b69be245b6a2e60293c7ddb538830edbe75ed3b6c28eea0891b6122e15ed1
inlined_ast: 4d8b69be245b6a2e60293c7ddb538830edbe75ed3b6c28eea0891b6122e15ed1
dce_ast: 4d8b69be245b6a2e60293c7ddb538830edbe75ed3b6c28eea0891b6122e15ed1
bytecode: 458db8252b38f698e38938e87f24157a1843de705c8bb55537902a6ea32934c9
- initial_symbol_table: 0ba4f6d4fc84bea9c4c28815cc004b6cbc69b8927c51780733f9224c632367c3
type_checked_symbol_table: f06bf2fa31d4614a5c6dfb05da892545ed187bd8f68e620e34695703d4a10142
unrolled_symbol_table: f06bf2fa31d4614a5c6dfb05da892545ed187bd8f68e620e34695703d4a10142
initial_ast: 74cfbe339b893e71b91f9b14ef869efc1b8f5b1a515f22f610a2788858888c1a
unrolled_ast: 74cfbe339b893e71b91f9b14ef869efc1b8f5b1a515f22f610a2788858888c1a
ssa_ast: 1dcb86c86d2d46d2eea3d44e0df05c6bca82481fd5fd8c92549f9cf937cd199e
flattened_ast: feabd2de10b5429de46c41e53feb9037e663cf68f06dda01e27274172508ad7e
destructured_ast: 8dbd23d2b19d132ccf60c008ef423c4b1961114446f8f6dc822cc0dfc768d6ed
inlined_ast: 8dbd23d2b19d132ccf60c008ef423c4b1961114446f8f6dc822cc0dfc768d6ed
dce_ast: 8dbd23d2b19d132ccf60c008ef423c4b1961114446f8f6dc822cc0dfc768d6ed
bytecode: b5158edfc4de30dd5ae4281ce5c6b2562ea1817bf56a6618a9382669476eb17b
errors: ""
warnings: ""

View File

@ -9,10 +9,10 @@ outputs:
initial_ast: 2ecdc46c95dfd4317447595490716949274d6acbd6b952886a36473c1a92ddd6
unrolled_ast: 2ecdc46c95dfd4317447595490716949274d6acbd6b952886a36473c1a92ddd6
ssa_ast: 752d946f7bfce55c490605e43814a6effaba2584b93dd250dfd01bb72e568720
flattened_ast: 348eda5d636d5f1e981d2babfb83e87ac7cb06d089dd26d886d868575238836f
destructured_ast: 01c11db1153404dbac5d28e931cea5a5c384993f1746d08ec282972311e25afe
inlined_ast: 01c11db1153404dbac5d28e931cea5a5c384993f1746d08ec282972311e25afe
dce_ast: 5ae5d831fa36b7d03fe64b1093bf5af9aa5d8e04c9c6586100bc99a56184b46b
flattened_ast: 85066e0295243875bb6346bbd0c6d42aaef380f81efc1e02f89987ae105b2d9c
destructured_ast: 3743f3e2779db54da6cf170e812efd14125550464d91f1c8754926056a1f341b
inlined_ast: 3743f3e2779db54da6cf170e812efd14125550464d91f1c8754926056a1f341b
dce_ast: e905e67ad1213dc0da5ee4f6be5ee8afaf417ad0594d43a0afdeb397e6df5898
bytecode: c5e80399ab1edccfae4591f3c38695e9a4129b35ad2cc75238859a2e109a245f
errors: ""
warnings: ""

View File

@ -9,10 +9,10 @@ outputs:
initial_ast: c31953108735c45451da79bdc610fbb48d0d804b585e6a85d468f6759505b5dd
unrolled_ast: c31953108735c45451da79bdc610fbb48d0d804b585e6a85d468f6759505b5dd
ssa_ast: 2a3a93dd928e94638aca5302b278dfa2a64dcf1975d4fa7216959c5ae7c65798
flattened_ast: 65d92f820e775e7aaa315aed8b50b6406f77bbb6a988733e2c477509219fe923
destructured_ast: eeb8c5e3accdfdb6efd03d5f8b344320e073cb0b25421b872ff8473c112fb4fe
inlined_ast: eeb8c5e3accdfdb6efd03d5f8b344320e073cb0b25421b872ff8473c112fb4fe
dce_ast: eeb8c5e3accdfdb6efd03d5f8b344320e073cb0b25421b872ff8473c112fb4fe
flattened_ast: 0cb4f487ee50ea0a54725e50b7b499166692f7bf69484644eb9ff5d57ddcec35
destructured_ast: aa51dc5ca4367281d6f07bfef3c65fa60b4dfbfe9ec0faf20b7866965107ad6d
inlined_ast: aa51dc5ca4367281d6f07bfef3c65fa60b4dfbfe9ec0faf20b7866965107ad6d
dce_ast: aa51dc5ca4367281d6f07bfef3c65fa60b4dfbfe9ec0faf20b7866965107ad6d
bytecode: 7598ca95ba8e589482a0d951cae6f2f8571e7ae33ec8f56dbe83077dac5100d4
errors: ""
warnings: ""

View File

@ -9,10 +9,10 @@ outputs:
initial_ast: b6e69083825f6830b9bb8a584ea96a715bfce9591ab466b224c48b138ebfc2f1
unrolled_ast: b6e69083825f6830b9bb8a584ea96a715bfce9591ab466b224c48b138ebfc2f1
ssa_ast: 191493c157b000f1d2fe4325ed902f14a83ef08168e131929ff6efabb98c5d38
flattened_ast: 824b49236899cda5fe627c854e9571dd5166c3750b22dcecc7e83c9c6a253386
destructured_ast: dbd525e3d53d5b4b248f71d05fbd25d1ec41767a0493d73a7bfaeb5a22160137
inlined_ast: dbd525e3d53d5b4b248f71d05fbd25d1ec41767a0493d73a7bfaeb5a22160137
dce_ast: dbd525e3d53d5b4b248f71d05fbd25d1ec41767a0493d73a7bfaeb5a22160137
flattened_ast: b46399669061566ddeee7a36d2ce842d7a6fb9ecd51d57a34f8e2c29cc22623b
destructured_ast: 4f4ebc8a60b32eb23f13ed7e78679f94480bca8c8ace0c56f487e66f9bf0fe03
inlined_ast: 4f4ebc8a60b32eb23f13ed7e78679f94480bca8c8ace0c56f487e66f9bf0fe03
dce_ast: 4f4ebc8a60b32eb23f13ed7e78679f94480bca8c8ace0c56f487e66f9bf0fe03
bytecode: c44dd5a8d2158e3729310c6e423739cde6f4f8261609820886f26aa09afe707b
errors: ""
warnings: ""
@ -22,10 +22,10 @@ outputs:
initial_ast: 08b601b7a0688a2d20a8811a61e8667cb7b3ef2f2da9f8b7c1337de5399b82b7
unrolled_ast: bbdd48c020c95460f993557345841e67402b73d0e26417ed41ff911c9030ee64
ssa_ast: b2fc01fbec80689a201f92f620ae397994e63005573b1482126cc027bc8d8453
flattened_ast: 98bd93276a08927862d873a3d1e0a52b46d5cec3b5622b53518b930d4bc19644
destructured_ast: 49218a199ad96f32c613962d40adccdf7b851e5306b0d89ba071da7b3e4bb2f1
inlined_ast: 49218a199ad96f32c613962d40adccdf7b851e5306b0d89ba071da7b3e4bb2f1
dce_ast: 49218a199ad96f32c613962d40adccdf7b851e5306b0d89ba071da7b3e4bb2f1
flattened_ast: 582a07b919452259f6041c4f263e1dc0a62ed8614b255b0e6550d832c843ead0
destructured_ast: 51fadd96451c7991ea2799405a4e4bdaf3677087d297dd85b2da7261d283a455
inlined_ast: 51fadd96451c7991ea2799405a4e4bdaf3677087d297dd85b2da7261d283a455
dce_ast: 51fadd96451c7991ea2799405a4e4bdaf3677087d297dd85b2da7261d283a455
bytecode: 1260b31fff8f93549822bd3a3bba846b38ca6dd13eacaf908842384748b4ea4c
errors: ""
warnings: ""

View File

@ -9,10 +9,10 @@ outputs:
initial_ast: 1d2d0a6b451ada7091b7179f0326bcfcc805ac80d8396be54a97d5b1b3ae99bc
unrolled_ast: 1d2d0a6b451ada7091b7179f0326bcfcc805ac80d8396be54a97d5b1b3ae99bc
ssa_ast: 41bec5b5a892842f78160a1e6944a7ae58182987bd630895b1848a7d6b811219
flattened_ast: 507abcda8923d756f84977f8d86956087a941b24c0e22762f6d11dc943b8035b
destructured_ast: 045857303558423467b3544cc9896948f0bf34cdf3f64d4412bc667a1d8c54a4
inlined_ast: 045857303558423467b3544cc9896948f0bf34cdf3f64d4412bc667a1d8c54a4
dce_ast: 045857303558423467b3544cc9896948f0bf34cdf3f64d4412bc667a1d8c54a4
flattened_ast: a1e7873af91962d4e702e896043817142d2a030ad4e9a072c31b5503ecd557b6
destructured_ast: 2c145c6ac9114062b225d1949442cbd147c6f264b61bc4454b46359840baa4c5
inlined_ast: 2c145c6ac9114062b225d1949442cbd147c6f264b61bc4454b46359840baa4c5
dce_ast: 2c145c6ac9114062b225d1949442cbd147c6f264b61bc4454b46359840baa4c5
bytecode: 56b9658985c66ccadb9f1193ce728164bf8a64605f1ebf23bca2489366856408
errors: ""
warnings: ""
@ -22,10 +22,10 @@ outputs:
initial_ast: 6b344a6590d2ca4f06753a518b547ba428865c07dc32133d71421dac708c760e
unrolled_ast: 6b344a6590d2ca4f06753a518b547ba428865c07dc32133d71421dac708c760e
ssa_ast: 9da15e57a114500c297bc1bc32ee3bb2b4c14b47faa4ddc1c88e20d1894a63e5
flattened_ast: 53876bb6f0e53d36fb78d8d708bc2ffca3fcbcc096201df180f8e4796b0cbf9c
destructured_ast: b0f5d553a83dcfb6b99722cbce50f5adb58af9626b8ad95b629547bc5f6d42b0
inlined_ast: b0f5d553a83dcfb6b99722cbce50f5adb58af9626b8ad95b629547bc5f6d42b0
dce_ast: b0f5d553a83dcfb6b99722cbce50f5adb58af9626b8ad95b629547bc5f6d42b0
flattened_ast: 4d6011c2b7f137f6dedf4d35203446b6564748c27db705e9e472233645748ac8
destructured_ast: f3168c9e823a3b61f92d37be4ede55747c6b9042730403a3348c8f6f51dcabca
inlined_ast: f3168c9e823a3b61f92d37be4ede55747c6b9042730403a3348c8f6f51dcabca
dce_ast: f3168c9e823a3b61f92d37be4ede55747c6b9042730403a3348c8f6f51dcabca
bytecode: 2a3a8d08d08cb50221d366a70bb52bc132b8e46552dacf23efa66b85e306affc
errors: ""
warnings: ""
@ -35,10 +35,10 @@ outputs:
initial_ast: f149292694c9429ece1d09db5bcb836eb421d70aaab7bcdb98e4bac6c68ef508
unrolled_ast: 2529425cc78afd160751160b99090545a0cd56273088698217045793a554b146
ssa_ast: f7ab9967658759127bc1f9456327c6163c41243f344bc2b307135a40fbb8e856
flattened_ast: f8c136572519aa426bb394b62ef1b1d5591b369337a8424f5f66281d2d21947c
destructured_ast: ae7dd87b1116a519181d64c5e4e761454b20e7c318ae3f2c621f61e0436e0852
inlined_ast: ae7dd87b1116a519181d64c5e4e761454b20e7c318ae3f2c621f61e0436e0852
dce_ast: ae7dd87b1116a519181d64c5e4e761454b20e7c318ae3f2c621f61e0436e0852
flattened_ast: bb34b4858f7886132b8e9b230f342af728c38679279fe36f6f629b32dc5f3a14
destructured_ast: 5e02ade7b0a42d479d64368066768b34c853876279805c2ad51bb9a64c2f37e9
inlined_ast: 5e02ade7b0a42d479d64368066768b34c853876279805c2ad51bb9a64c2f37e9
dce_ast: 5e02ade7b0a42d479d64368066768b34c853876279805c2ad51bb9a64c2f37e9
bytecode: 115508df86f6c7e48dae71a5a27aed36bade699723aef76ac71e64316e995c03
errors: ""
warnings: ""
@ -48,10 +48,10 @@ outputs:
initial_ast: cdfbec7a117dd626b930b66db6ddc0e0e90064c86601084e76c401514d7c3885
unrolled_ast: 01376813f128de7dcd29f2bf10ff0e9ee773bab891dc135b0396544487a6243e
ssa_ast: 63927909d1e737cf05b4d60402d91e7de869ceb442ee6be261fab76704382853
flattened_ast: 22d7950ed83dc1da363590773067f0446e06cc2f170c53739449179d98d3ae8f
destructured_ast: 39e5b6f7f0489cee6b3ba3b84eae5147bf36b65cadcc642de0de7ebe1e79a35e
inlined_ast: 39e5b6f7f0489cee6b3ba3b84eae5147bf36b65cadcc642de0de7ebe1e79a35e
dce_ast: 39e5b6f7f0489cee6b3ba3b84eae5147bf36b65cadcc642de0de7ebe1e79a35e
flattened_ast: 5c4d567f38067834a9acc7343b06dd362c74ce9d261822e55d20fb3df1693a7a
destructured_ast: 1c5e02f8641505b6cccc271c7516837c25ef41cf9a46fd91a49a5ce23deb384d
inlined_ast: 1c5e02f8641505b6cccc271c7516837c25ef41cf9a46fd91a49a5ce23deb384d
dce_ast: 1c5e02f8641505b6cccc271c7516837c25ef41cf9a46fd91a49a5ce23deb384d
bytecode: 52f79fd1e434cc22a2984e367922be363de60fb3bcdc7f2792c2ff44beaa3025
errors: ""
warnings: ""
@ -61,10 +61,10 @@ outputs:
initial_ast: f4362a002f5c31e52b226cd9a32f714e1a6b57253dcc330baeb6daceb8fd61a7
unrolled_ast: 932721c4c08e822f7cecd9170bdc0392ea04bbc208345d7fe68613175ffe3142
ssa_ast: 76e03b3cac35e3d10e3a73e99ffac3daaa1971e2241101e91d8ac3f6a22eba90
flattened_ast: 509d3881b0ceac122449711653d70cac226e1f675a8a695d16bb2ce25521d420
destructured_ast: f7420f7d27f71f524ea7d5a648356a134179fa4081228e2dc9b19b0a3d13a2aa
inlined_ast: f7420f7d27f71f524ea7d5a648356a134179fa4081228e2dc9b19b0a3d13a2aa
dce_ast: f7420f7d27f71f524ea7d5a648356a134179fa4081228e2dc9b19b0a3d13a2aa
flattened_ast: d0308a3a9c715bf3dee75f764bf998573e42660756e009639e08b91804cdad87
destructured_ast: 437be27186a559bb96f78e6b2d5e3c380cd0bcddbdfa2cf6ffe30b56e65e2614
inlined_ast: 437be27186a559bb96f78e6b2d5e3c380cd0bcddbdfa2cf6ffe30b56e65e2614
dce_ast: 437be27186a559bb96f78e6b2d5e3c380cd0bcddbdfa2cf6ffe30b56e65e2614
bytecode: a4f1358380ab021bfa21fc627b0dac45b4065098f6b688fca09daa3906e7c768
errors: ""
warnings: ""

View File

@ -9,10 +9,10 @@ outputs:
initial_ast: 21104527f729cd9523b74f7902131e756ac4615405c3ca225635573abcf92fb3
unrolled_ast: 21104527f729cd9523b74f7902131e756ac4615405c3ca225635573abcf92fb3
ssa_ast: f7b1644dfb4b99b5960906ee80bf88ca6b7d6a6dfeb0b50195a2cd94c0e788f5
flattened_ast: ce2048db3cf0d124c10c6a418e38bed03c9b5ac251fe342b5f79e8b2d3c7a8cd
destructured_ast: 17bb3b101a6fd5936f1eb879e3cbb2938f93f53ae3291ac02a1f5ce66f5532be
inlined_ast: 17bb3b101a6fd5936f1eb879e3cbb2938f93f53ae3291ac02a1f5ce66f5532be
dce_ast: 17bb3b101a6fd5936f1eb879e3cbb2938f93f53ae3291ac02a1f5ce66f5532be
flattened_ast: 90cff7eb77be00a75960f7abe098ae66b66b710a06d67e90eb295c3fc8e3412f
destructured_ast: 85d535d72ece859c3ff79076ade1f30b48efaedf5e8a9c13d87ab6195997e98d
inlined_ast: 85d535d72ece859c3ff79076ade1f30b48efaedf5e8a9c13d87ab6195997e98d
dce_ast: 85d535d72ece859c3ff79076ade1f30b48efaedf5e8a9c13d87ab6195997e98d
bytecode: 1714432c88873553dfc5e23b3097d205011de6a60cae026ff319b139e8b12d7b
errors: ""
warnings: ""

View File

@ -9,10 +9,10 @@ outputs:
initial_ast: c69d09a2934a19ac8d699564f07369508dd0cdbdc4a5c08ea9b8a736e1a5db3c
unrolled_ast: e290dac1247a03cad86c90a6f11312c5c9972dffbade372853165407cbb12f59
ssa_ast: 0c6f458c7cc9ad347c76ebf4898795072b6f5020f4ad09a1e8598439a0a9c572
flattened_ast: a4b92d64c082476b1143262768d09a7cc8cf86d8847ff780c03692541d4eeeda
destructured_ast: 90bce95bc581cab4336f446e673962dde6e8092e02e04f14e3bd76eb68005f03
inlined_ast: 90bce95bc581cab4336f446e673962dde6e8092e02e04f14e3bd76eb68005f03
dce_ast: 90bce95bc581cab4336f446e673962dde6e8092e02e04f14e3bd76eb68005f03
flattened_ast: e17c9fe3a7ce4ac97fecacff2a32f08ac841985055868c7655c06608412b27e3
destructured_ast: 0e1927eeefca27da4713f6ae5180bd822b9d1b159525f2a6e70c07d099aef6ed
inlined_ast: 0e1927eeefca27da4713f6ae5180bd822b9d1b159525f2a6e70c07d099aef6ed
dce_ast: 0e1927eeefca27da4713f6ae5180bd822b9d1b159525f2a6e70c07d099aef6ed
bytecode: 75252a5477a2943c07eaf114bef3dd214acbd7184b3118f14786beb8215bfb94
errors: ""
warnings: ""

View File

@ -32,6 +32,20 @@ program test.aleo {
return;
}
}
transition add_new_liquidity_token2 () {
return then finalize();
}
finalize add_new_liquidity_token2() {
let try_get_token: TokenInfo = Mapping::get_or_use(
token_name_to_info,
0field,
TokenInfo { id: 0u64 }
);
try_get_token = (try_get_token.id == 0u64) ? TokenInfo { id: 10u64 } : try_get_token;
return;
}
}