mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-12-25 11:12:48 +03:00
Add Mapping to AST
This commit is contained in:
parent
5c706f2888
commit
0e00c5dac3
@ -14,6 +14,9 @@
|
||||
// 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 circuit_member;
|
||||
pub use circuit_member::*;
|
||||
|
||||
use crate::{CircuitMember, Identifier, Node};
|
||||
use leo_span::{Span, Symbol};
|
||||
|
@ -25,8 +25,8 @@
|
||||
pub mod access;
|
||||
pub use self::access::*;
|
||||
|
||||
pub mod circuits;
|
||||
pub use self::circuits::*;
|
||||
pub mod circuit;
|
||||
pub use self::circuit::*;
|
||||
|
||||
pub mod common;
|
||||
pub use self::common::*;
|
||||
@ -43,6 +43,9 @@ pub use self::groups::*;
|
||||
pub mod input;
|
||||
pub use self::input::*;
|
||||
|
||||
pub mod mapping;
|
||||
pub use self::mapping::*;
|
||||
|
||||
pub mod passes;
|
||||
pub use self::passes::*;
|
||||
|
||||
|
@ -14,8 +14,26 @@
|
||||
// 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 circuit;
|
||||
pub use circuit::*;
|
||||
use std::fmt;
|
||||
use leo_span::Span;
|
||||
use crate::{Identifier, Type};
|
||||
|
||||
pub mod circuit_member;
|
||||
pub use circuit_member::*;
|
||||
/// A mapping declaration, e.g `mapping balances: address => u128`.
|
||||
pub struct Mapping {
|
||||
/// The name of the mapping.
|
||||
pub identifier: Identifier,
|
||||
/// The type of the key.
|
||||
pub key_type: Type,
|
||||
/// The type of the value.
|
||||
pub value_type: Type,
|
||||
/// The entire span of the mapping declaration.
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
impl fmt::Display for Mapping {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "mapping {}: {} => {}", self.identifier, self.key_type, self.value_type)
|
||||
}
|
||||
}
|
||||
|
||||
crate::simple_node_impl!(Mapping);
|
Loading…
Reference in New Issue
Block a user