From cbe79c0e9879824abb6ae5edd07ba03b38543917 Mon Sep 17 00:00:00 2001 From: Pranav Gaddamadugu Date: Wed, 9 Aug 2023 17:38:13 -0400 Subject: [PATCH] Remove unused code --- compiler/ast/src/common/global_consts_json.rs | 58 ------------------- compiler/ast/src/common/mod.rs | 2 - compiler/ast/src/expressions/struct_init.rs | 1 - 3 files changed, 61 deletions(-) delete mode 100644 compiler/ast/src/common/global_consts_json.rs diff --git a/compiler/ast/src/common/global_consts_json.rs b/compiler/ast/src/common/global_consts_json.rs deleted file mode 100644 index 5515eaf7ad..0000000000 --- a/compiler/ast/src/common/global_consts_json.rs +++ /dev/null @@ -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 . - -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( - global_consts: &IndexMap, DefinitionStatement>, - serializer: S, -) -> Result { - let joined: IndexMap = global_consts - .into_iter() - .map(|(idents, program)| { - (idents.iter().map(|i| i.name.to_string()).collect::>().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, DefinitionStatement>, D::Error> { - Ok(IndexMap::::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::>(), - program, - ) - }) - .collect()) -} diff --git a/compiler/ast/src/common/mod.rs b/compiler/ast/src/common/mod.rs index 4a81823d2b..0154871dc0 100644 --- a/compiler/ast/src/common/mod.rs +++ b/compiler/ast/src/common/mod.rs @@ -14,8 +14,6 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -pub mod global_consts_json; - pub mod identifier; pub use identifier::*; diff --git a/compiler/ast/src/expressions/struct_init.rs b/compiler/ast/src/expressions/struct_init.rs index 916c4fb02f..59bceb654e 100644 --- a/compiler/ast/src/expressions/struct_init.rs +++ b/compiler/ast/src/expressions/struct_init.rs @@ -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)]