Remove unused code

This commit is contained in:
Pranav Gaddamadugu 2023-08-09 17:38:13 -04:00
parent 9125c84cd1
commit cbe79c0e98
3 changed files with 0 additions and 61 deletions

View File

@ -1,58 +0,0 @@
// Copyright (C) 2019-2023 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::{DefinitionStatement, Identifier, NodeID};
use leo_span::Symbol;
use indexmap::IndexMap;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
#[allow(clippy::ptr_arg)]
pub fn serialize<S: Serializer>(
global_consts: &IndexMap<Vec<Identifier>, DefinitionStatement>,
serializer: S,
) -> Result<S::Ok, S::Error> {
let joined: IndexMap<String, DefinitionStatement> = global_consts
.into_iter()
.map(|(idents, program)| {
(idents.iter().map(|i| i.name.to_string()).collect::<Vec<_>>().join(","), program.clone())
})
.collect();
joined.serialize(serializer)
}
// TODO (@d0cd) Fix serialization to be compatible with NodeID.
pub fn deserialize<'de, D: Deserializer<'de>>(
deserializer: D,
) -> Result<IndexMap<Vec<Identifier>, DefinitionStatement>, D::Error> {
Ok(IndexMap::<String, DefinitionStatement>::deserialize(deserializer)?
.into_iter()
.map(|(name, program)| {
(
name.split(',')
.map(|ident_name| Identifier {
name: Symbol::intern(ident_name),
span: Default::default(),
id: NodeID::default(),
})
.collect::<Vec<Identifier>>(),
program,
)
})
.collect())
}

View File

@ -14,8 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
pub mod global_consts_json;
pub mod identifier;
pub use identifier::*;

View File

@ -17,7 +17,6 @@
use super::*;
use leo_span::sym;
// TODO (@d0cd): Make this a node in the AST.
/// An initializer for a single field / variable of a struct initializer expression.
/// That is, in `Foo { bar: 42, baz }`, this is either `bar: 42`, or `baz`.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]