mirror of
https://github.com/AleoHQ/leo.git
synced 2024-09-21 12:07:56 +03:00
Support for doubly nested external records in function signature
This commit is contained in:
parent
e478a95897
commit
fb8620d635
@ -20,7 +20,6 @@
|
||||
|
||||
use crate::*;
|
||||
|
||||
|
||||
/// A Visitor trait for expressions in the AST.
|
||||
pub trait ExpressionVisitor<'a> {
|
||||
type AdditionalInput: Default;
|
||||
|
@ -35,7 +35,7 @@ use crate::{
|
||||
};
|
||||
use leo_span::{sym, Span, Symbol};
|
||||
|
||||
use crate::Type::{Struct};
|
||||
use crate::Type::Struct;
|
||||
use itertools::Itertools;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use snarkvm::{
|
||||
@ -137,14 +137,15 @@ impl FunctionStub {
|
||||
span: Default::default(),
|
||||
id: Default::default(),
|
||||
})],
|
||||
ValueType::ExternalRecord(loc) => vec![Output::External(External {
|
||||
// TODO
|
||||
identifier: Identifier::new(Symbol::intern("dummy"), Default::default()),
|
||||
program_name: ProgramId::from(loc.program_id()).name,
|
||||
record: Identifier::from(loc.resource()),
|
||||
span: Default::default(),
|
||||
id: Default::default(),
|
||||
})],
|
||||
ValueType::ExternalRecord(loc) => {
|
||||
vec![Output::External(External {
|
||||
identifier: Identifier::new(Symbol::intern("dummy"), Default::default()),
|
||||
program_name: ProgramId::from(loc.program_id()).name,
|
||||
record: Identifier::from(loc.resource()),
|
||||
span: Default::default(),
|
||||
id: Default::default(),
|
||||
})]
|
||||
}
|
||||
ValueType::Future(_) => Vec::new(), // Don't include futures in the output signature
|
||||
})
|
||||
.collect_vec()
|
||||
@ -153,7 +154,9 @@ impl FunctionStub {
|
||||
.iter()
|
||||
.map(|output| match output {
|
||||
Output::Internal(output) => output.type_.clone(),
|
||||
Output::External(output) => Type::Identifier(output.record),
|
||||
Output::External(output) => {
|
||||
Type::Struct(StructType { id: output.record, external: Some(output.program_name.name) })
|
||||
}
|
||||
})
|
||||
.collect_vec();
|
||||
let output_type = match output_vec.len() {
|
||||
|
@ -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::{Identifier};
|
||||
use crate::Identifier;
|
||||
|
||||
use leo_span::Symbol;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
Loading…
Reference in New Issue
Block a user