From c77928cd2e02d19d62f143658f7345184dad7874 Mon Sep 17 00:00:00 2001 From: mitchmindtree Date: Wed, 23 Feb 2022 07:55:59 +1100 Subject: [PATCH] Remove the unused `&mut dependency_graph` throughout `sway-core` (#826) * Remove the unused `&mut dependency_graph` throughout `sway-core` While working on #825 I noticed that that the `dependency_graph` is unused throughout `sway-core`. I think the reason why cargo doesn't emit any warnings about this is that at one point, it's stored in the public `TypeCheckArgument` struct, so cargo believes that it is intentionally being re-exported, however in reality we don't use it anywhere else in the fuel/sway/forc ecosystem. * Remove trailing commas uncaught by rustfmt * Remove unused `dependency_graph` from sway-core selector_debug feature --- forc/src/ops/forc_build.rs | 16 +----- sway-core/src/lib.rs | 12 +--- sway-core/src/optimize.rs | 1 - .../semantic_analysis/ast_node/code_block.rs | 2 - .../ast_node/declaration/function.rs | 2 - .../ast_node/expression/enum_instantiation.rs | 2 - .../ast_node/expression/typed_expression.rs | 55 ------------------- .../typed_expression/method_application.rs | 8 +-- .../semantic_analysis/ast_node/impl_trait.rs | 8 --- .../src/semantic_analysis/ast_node/mod.rs | 42 +------------- .../src/semantic_analysis/syntax_tree.rs | 6 -- .../semantic_analysis/type_check_arguments.rs | 2 - sway-core/src/source_map.rs | 0 sway-core/utils/selector_debug.rs | 1 - 14 files changed, 10 insertions(+), 147 deletions(-) mode change 100755 => 100644 sway-core/src/source_map.rs diff --git a/forc/src/ops/forc_build.rs b/forc/src/ops/forc_build.rs index 307e381e571..d4542c41108 100644 --- a/forc/src/ops/forc_build.rs +++ b/forc/src/ops/forc_build.rs @@ -21,7 +21,6 @@ use sway_core::{ use sway_types::JsonABI; use anyhow::Result; -use std::collections::{HashMap, HashSet}; use std::path::{Path, PathBuf}; pub fn build(command: BuildCommand) -> Result<(Vec, JsonABI), String> { @@ -70,7 +69,6 @@ pub fn build(command: BuildCommand) -> Result<(Vec, JsonABI), String> { .print_intermediate_asm(print_intermediate_asm) .print_ir(print_ir); - let mut dependency_graph = HashMap::new(); let namespace = create_module(); let mut source_map = SourceMap::new(); @@ -83,7 +81,6 @@ pub fn build(command: BuildCommand) -> Result<(Vec, JsonABI), String> { dependency_name, dependency_details, namespace, - &mut dependency_graph, silent_mode, offline_mode, )?; @@ -109,7 +106,6 @@ pub fn build(command: BuildCommand) -> Result<(Vec, JsonABI), String> { &manifest.project.name, namespace, build_config, - &mut dependency_graph, &mut source_map, silent_mode, )?; @@ -172,7 +168,6 @@ fn compile_dependency_lib<'manifest>( dependency_name: &'manifest str, dependency_lib: &mut Dependency, namespace: NamespaceRef, - dependency_graph: &mut HashMap>, silent_mode: bool, offline_mode: bool, ) -> Result { @@ -261,7 +256,6 @@ fn compile_dependency_lib<'manifest>( dependency_name, dependency_lib, dep_namespace, - dependency_graph, silent_mode, offline_mode, )?; @@ -275,7 +269,6 @@ fn compile_dependency_lib<'manifest>( &manifest_of_dep.project.name, dep_namespace, build_config, - dependency_graph, silent_mode, )?; @@ -289,10 +282,9 @@ fn compile_library( proj_name: &str, namespace: NamespaceRef, build_config: BuildConfig, - dependency_graph: &mut HashMap>, silent_mode: bool, ) -> Result<(NamespaceRef, JsonABI), String> { - let res = sway_core::compile_to_ast(source, namespace, &build_config, dependency_graph); + let res = sway_core::compile_to_ast(source, namespace, &build_config); match res { CompileAstResult::Success { parse_tree, @@ -325,11 +317,10 @@ fn compile( proj_name: &str, namespace: NamespaceRef, build_config: BuildConfig, - dependency_graph: &mut HashMap>, source_map: &mut SourceMap, silent_mode: bool, ) -> Result<(Vec, JsonABI), String> { - let ast_res = sway_core::compile_to_ast(source, namespace, &build_config, dependency_graph); + let ast_res = sway_core::compile_to_ast(source, namespace, &build_config); let (json_abi, tree_type, warnings) = match &ast_res { CompileAstResult::Success { parse_tree, @@ -372,10 +363,9 @@ fn compile_to_asm( proj_name: &str, namespace: NamespaceRef, build_config: BuildConfig, - dependency_graph: &mut HashMap>, silent_mode: bool, ) -> Result { - let res = sway_core::compile_to_asm(source, namespace, build_config, dependency_graph); + let res = sway_core::compile_to_asm(source, namespace, build_config); match res { CompilationResult::Success { asm, warnings } => { print_on_success(silent_mode, proj_name, &warnings, TreeType::Script {}); diff --git a/sway-core/src/lib.rs b/sway-core/src/lib.rs index a34461db784..cddea3edae0 100644 --- a/sway-core/src/lib.rs +++ b/sway-core/src/lib.rs @@ -28,7 +28,7 @@ pub use build_config::BuildConfig; use control_flow_analysis::{ControlFlowGraph, Graph}; use pest::iterators::Pair; use pest::Parser; -use std::collections::{HashMap, HashSet}; +use std::collections::HashMap; use std::sync::Arc; pub use semantic_analysis::{ @@ -244,7 +244,6 @@ pub(crate) fn compile_inner_dependency( initial_namespace: NamespaceRef, build_config: BuildConfig, dead_code_graph: &mut ControlFlowGraph, - dependency_graph: &mut HashMap>, ) -> CompileResult { let mut warnings = Vec::new(); let mut errors = Vec::new(); @@ -274,7 +273,6 @@ pub(crate) fn compile_inner_dependency( &parse_tree.tree_type, &build_config, dead_code_graph, - dependency_graph, ), return err(warnings, errors), warnings, @@ -309,7 +307,6 @@ pub fn compile_to_ast( input: Arc, initial_namespace: crate::semantic_analysis::NamespaceRef, build_config: &BuildConfig, - dependency_graph: &mut HashMap>, ) -> CompileAstResult { let mut warnings = Vec::new(); let mut errors = Vec::new(); @@ -333,7 +330,6 @@ pub fn compile_to_ast( &parse_tree.tree_type, &build_config.clone(), &mut dead_code_graph, - dependency_graph, ), return CompileAstResult::Failure { errors, warnings }, warnings, @@ -367,9 +363,8 @@ pub fn compile_to_asm( input: Arc, initial_namespace: crate::semantic_analysis::NamespaceRef, build_config: BuildConfig, - dependency_graph: &mut HashMap>, ) -> CompilationResult { - let ast_res = compile_to_ast(input, initial_namespace, &build_config, dependency_graph); + let ast_res = compile_to_ast(input, initial_namespace, &build_config); ast_to_asm(ast_res, &build_config) } @@ -514,10 +509,9 @@ pub fn compile_to_bytecode( input: Arc, initial_namespace: crate::semantic_analysis::NamespaceRef, build_config: BuildConfig, - dependency_graph: &mut HashMap>, source_map: &mut SourceMap, ) -> BytecodeCompilationResult { - let asm_res = compile_to_asm(input, initial_namespace, build_config, dependency_graph); + let asm_res = compile_to_asm(input, initial_namespace, build_config); asm_to_bytecode(asm_res, source_map) } diff --git a/sway-core/src/optimize.rs b/sway-core/src/optimize.rs index 46f6bbfe50b..76ac49f4b95 100644 --- a/sway-core/src/optimize.rs +++ b/sway-core/src/optimize.rs @@ -1615,7 +1615,6 @@ mod tests { &TreeType::Script, &build_config, &mut dead_code_graph, - &mut std::collections::HashMap::new(), ) .unwrap(&mut warnings, &mut errors) } diff --git a/sway-core/src/semantic_analysis/ast_node/code_block.rs b/sway-core/src/semantic_analysis/ast_node/code_block.rs index 81fdce965ce..dd87a3d9dd2 100644 --- a/sway-core/src/semantic_analysis/ast_node/code_block.rs +++ b/sway-core/src/semantic_analysis/ast_node/code_block.rs @@ -25,7 +25,6 @@ impl TypedCodeBlock { self_type, build_config, dead_code_graph, - dependency_graph, opts, .. } = arguments; @@ -46,7 +45,6 @@ impl TypedCodeBlock { self_type, build_config, dead_code_graph, - dependency_graph, mode: Mode::NonAbi, opts, }) diff --git a/sway-core/src/semantic_analysis/ast_node/declaration/function.rs b/sway-core/src/semantic_analysis/ast_node/declaration/function.rs index ff1e4ff2bb1..3c15f15f706 100644 --- a/sway-core/src/semantic_analysis/ast_node/declaration/function.rs +++ b/sway-core/src/semantic_analysis/ast_node/declaration/function.rs @@ -49,7 +49,6 @@ impl TypedFunctionDeclaration { build_config, dead_code_graph, mode, - dependency_graph, mut opts, .. } = arguments; @@ -137,7 +136,6 @@ impl TypedFunctionDeclaration { self_type, build_config, dead_code_graph, - dependency_graph, mode: Mode::NonAbi, opts, }), diff --git a/sway-core/src/semantic_analysis/ast_node/expression/enum_instantiation.rs b/sway-core/src/semantic_analysis/ast_node/expression/enum_instantiation.rs index 0863faa886a..0099d9f9f24 100644 --- a/sway-core/src/semantic_analysis/ast_node/expression/enum_instantiation.rs +++ b/sway-core/src/semantic_analysis/ast_node/expression/enum_instantiation.rs @@ -16,7 +16,6 @@ pub(crate) fn instantiate_enum( self_type: TypeId, build_config: &BuildConfig, dead_code_graph: &mut ControlFlowGraph, - dependency_graph: &mut HashMap>, opts: TCOpts, ) -> CompileResult { let mut warnings = vec![]; @@ -75,7 +74,6 @@ pub(crate) fn instantiate_enum( self_type, build_config, dead_code_graph, - dependency_graph, mode: Mode::NonAbi, opts, }), diff --git a/sway-core/src/semantic_analysis/ast_node/expression/typed_expression.rs b/sway-core/src/semantic_analysis/ast_node/expression/typed_expression.rs index 64d56f08970..9e7a12bd746 100644 --- a/sway-core/src/semantic_analysis/ast_node/expression/typed_expression.rs +++ b/sway-core/src/semantic_analysis/ast_node/expression/typed_expression.rs @@ -10,7 +10,6 @@ use sway_types::join_spans; use either::Either; use std::cmp::Ordering; -use std::collections::{HashMap, HashSet}; mod method_application; use crate::type_engine::TypeId; @@ -47,7 +46,6 @@ impl TypedExpression { self_type, build_config, dead_code_graph, - dependency_graph, opts, .. } = arguments; @@ -73,7 +71,6 @@ impl TypedExpression { self_type, build_config, dead_code_graph, - dependency_graph, mode: Mode::NonAbi, opts, }, @@ -89,7 +86,6 @@ impl TypedExpression { self_type, build_config, dead_code_graph, - dependency_graph, mode: Mode::NonAbi, opts, }, @@ -105,7 +101,6 @@ impl TypedExpression { self_type, build_config, dead_code_graph, - dependency_graph, opts, ), // TODO if _condition_ is constant, evaluate it and compile this to an @@ -124,7 +119,6 @@ impl TypedExpression { self_type, build_config, dead_code_graph, - dependency_graph, mode: Mode::NonAbi, help_text: Default::default(), opts, @@ -139,7 +133,6 @@ impl TypedExpression { self_type, build_config, dead_code_graph, - dependency_graph, opts, ), Expression::StructExpression { @@ -155,7 +148,6 @@ impl TypedExpression { self_type, build_config, dead_code_graph, - dependency_graph, opts, ), Expression::SubfieldExpression { @@ -171,7 +163,6 @@ impl TypedExpression { self_type, build_config, dead_code_graph, - dependency_graph, opts, ), Expression::MethodApplication { @@ -187,7 +178,6 @@ impl TypedExpression { self_type, build_config, dead_code_graph, - dependency_graph, opts, ), Expression::Tuple { fields, span } => Self::type_check_tuple( @@ -199,7 +189,6 @@ impl TypedExpression { self_type, build_config, dead_code_graph, - dependency_graph, opts, ), Expression::TupleIndex { @@ -217,7 +206,6 @@ impl TypedExpression { self_type, build_config, dead_code_graph, - dependency_graph, opts, ), Expression::DelineatedPath { @@ -235,7 +223,6 @@ impl TypedExpression { self_type, build_config, dead_code_graph, - dependency_graph, opts, ), Expression::AbiCast { @@ -251,7 +238,6 @@ impl TypedExpression { self_type, build_config, dead_code_graph, - dependency_graph, opts, ), Expression::Array { contents, span } => Self::type_check_array( @@ -262,7 +248,6 @@ impl TypedExpression { self_type, build_config, dead_code_graph, - dependency_graph, opts, ), Expression::ArrayIndex { @@ -277,7 +262,6 @@ impl TypedExpression { self_type, build_config, dead_code_graph, - dependency_graph, opts, return_type_annotation: insert_type(TypeInfo::Unknown), mode: Default::default(), @@ -294,7 +278,6 @@ impl TypedExpression { self_type, build_config, dead_code_graph, - dependency_graph, opts, ) } @@ -456,7 +439,6 @@ impl TypedExpression { self_type, build_config, dead_code_graph, - dependency_graph, opts, .. } = arguments; @@ -556,7 +538,6 @@ impl TypedExpression { self_type, build_config, dead_code_graph, - dependency_graph, mode: Mode::NonAbi, opts, }) @@ -600,7 +581,6 @@ impl TypedExpression { self_type, build_config, dead_code_graph, - dependency_graph, return_type_annotation, opts, .. @@ -620,7 +600,6 @@ impl TypedExpression { return_type_annotation, build_config, dead_code_graph, - dependency_graph, }), error_recovery_expr(lhs.span()), warnings, @@ -637,7 +616,6 @@ impl TypedExpression { self_type, build_config, dead_code_graph, - dependency_graph, mode: Mode::NonAbi, opts, }), @@ -672,7 +650,6 @@ impl TypedExpression { self_type: TypeId, build_config: &BuildConfig, dead_code_graph: &mut ControlFlowGraph, - dependency_graph: &mut HashMap>, opts: TCOpts, ) -> CompileResult { let mut warnings = vec![]; @@ -687,7 +664,6 @@ impl TypedExpression { self_type, build_config, dead_code_graph, - dependency_graph, mode: Mode::NonAbi, opts, }), @@ -740,7 +716,6 @@ impl TypedExpression { self_type, build_config, dead_code_graph, - dependency_graph, opts, .. } = arguments; @@ -756,7 +731,6 @@ impl TypedExpression { self_type, build_config, dead_code_graph, - dependency_graph, mode: Mode::NonAbi, opts, }), @@ -774,7 +748,6 @@ impl TypedExpression { self_type, build_config, dead_code_graph, - dependency_graph, mode: Mode::NonAbi, opts, }), @@ -793,7 +766,6 @@ impl TypedExpression { self_type, build_config, dead_code_graph, - dependency_graph, mode: Mode::NonAbi, opts, }), @@ -845,7 +817,6 @@ impl TypedExpression { self_type: TypeId, build_config: &BuildConfig, dead_code_graph: &mut ControlFlowGraph, - dependency_graph: &mut HashMap>, opts: TCOpts, ) -> CompileResult { let mut warnings = vec![]; @@ -880,7 +851,6 @@ impl TypedExpression { self_type, build_config, dead_code_graph, - dependency_graph, mode: Mode::NonAbi, opts, }), @@ -916,7 +886,6 @@ impl TypedExpression { self_type: TypeId, build_config: &BuildConfig, dead_code_graph: &mut ControlFlowGraph, - dependency_graph: &mut HashMap>, opts: TCOpts, ) -> CompileResult { let mut warnings = vec![]; @@ -985,7 +954,6 @@ impl TypedExpression { self_type, build_config, dead_code_graph, - dependency_graph, mode: Mode::NonAbi, opts, }), @@ -1040,7 +1008,6 @@ impl TypedExpression { self_type: TypeId, build_config: &BuildConfig, dead_code_graph: &mut ControlFlowGraph, - dependency_graph: &mut HashMap>, opts: TCOpts, ) -> CompileResult { let mut warnings = vec![]; @@ -1055,7 +1022,6 @@ impl TypedExpression { self_type, build_config, dead_code_graph, - dependency_graph, mode: Mode::NonAbi, opts, }), @@ -1115,7 +1081,6 @@ impl TypedExpression { self_type: TypeId, build_config: &BuildConfig, dead_code_graph: &mut ControlFlowGraph, - dependency_graph: &mut HashMap>, opts: TCOpts, ) -> CompileResult { let mut warnings = vec![]; @@ -1145,7 +1110,6 @@ impl TypedExpression { self_type, build_config, dead_code_graph, - dependency_graph, mode: Mode::NonAbi, opts, }), @@ -1180,7 +1144,6 @@ impl TypedExpression { self_type: TypeId, build_config: &BuildConfig, dead_code_graph: &mut ControlFlowGraph, - dependency_graph: &mut HashMap>, opts: TCOpts, ) -> CompileResult { let mut warnings = vec![]; @@ -1195,7 +1158,6 @@ impl TypedExpression { self_type, build_config, dead_code_graph, - dependency_graph, mode: Mode::NonAbi, opts, }), @@ -1252,7 +1214,6 @@ impl TypedExpression { self_type: TypeId, build_config: &BuildConfig, dead_code_graph: &mut ControlFlowGraph, - dependency_graph: &mut HashMap>, opts: TCOpts, ) -> CompileResult { let mut warnings = vec![]; @@ -1306,7 +1267,6 @@ impl TypedExpression { self_type, build_config, dead_code_graph, - dependency_graph, opts, ), return err(warnings, errors), @@ -1346,7 +1306,6 @@ impl TypedExpression { self_type: TypeId, build_config: &BuildConfig, dead_code_graph: &mut ControlFlowGraph, - dependency_graph: &mut HashMap>, opts: TCOpts, ) -> CompileResult { let mut warnings = vec![]; @@ -1367,7 +1326,6 @@ impl TypedExpression { self_type, build_config, dead_code_graph, - dependency_graph, mode: Mode::NonAbi, opts, }), @@ -1417,7 +1375,6 @@ impl TypedExpression { build_config, dead_code_graph, mode: Mode::ImplAbiFn, - dependency_graph, opts, }), return err(warnings, errors), @@ -1454,7 +1411,6 @@ impl TypedExpression { self_type: TypeId, build_config: &BuildConfig, dead_code_graph: &mut ControlFlowGraph, - dependency_graph: &mut HashMap>, opts: TCOpts, ) -> CompileResult { if contents.is_empty() { @@ -1488,7 +1444,6 @@ impl TypedExpression { self_type, build_config, dead_code_graph, - dependency_graph, mode: Mode::NonAbi, opts, }), @@ -1549,7 +1504,6 @@ impl TypedExpression { self_type, build_config, dead_code_graph, - dependency_graph, opts, .. } = arguments; @@ -1566,7 +1520,6 @@ impl TypedExpression { self_type, build_config, dead_code_graph, - dependency_graph, mode: Mode::NonAbi, opts, }), @@ -1589,7 +1542,6 @@ impl TypedExpression { self_type, build_config, dead_code_graph, - dependency_graph, mode: Mode::NonAbi, opts, }), @@ -1633,7 +1585,6 @@ impl TypedExpression { self_type, build_config, dead_code_graph, - dependency_graph, opts, ) } @@ -1656,7 +1607,6 @@ impl TypedExpression { self_type: TypeId, build_config: &BuildConfig, dead_code_graph: &mut ControlFlowGraph, - dependency_graph: &mut HashMap>, opts: TCOpts, ) -> CompileResult { let mut warnings = vec![]; @@ -1675,7 +1625,6 @@ impl TypedExpression { self_type, build_config, dead_code_graph, - dependency_graph, mode: Mode::NonAbi, opts, }; @@ -1739,7 +1688,6 @@ impl TypedExpression { self_type, build_config, dead_code_graph, - dependency_graph, mode: Mode::NonAbi, opts, }; @@ -1832,7 +1780,6 @@ impl TypedExpression { self_type, build_config, dead_code_graph, - dependency_graph, mode: Mode::NonAbi, opts, }; @@ -2014,7 +1961,6 @@ mod tests { generated_names: Arc::new(Mutex::new(vec![])), }; let mut dead_code_graph: ControlFlowGraph = Default::default(); - let mut dependency_graph = HashMap::new(); TypedExpression::type_check(TypeCheckArguments { checkee: expr, @@ -2025,7 +1971,6 @@ mod tests { self_type, build_config: &build_config, dead_code_graph: &mut dead_code_graph, - dependency_graph: &mut dependency_graph, mode: Mode::NonAbi, opts: Default::default(), }) diff --git a/sway-core/src/semantic_analysis/ast_node/expression/typed_expression/method_application.rs b/sway-core/src/semantic_analysis/ast_node/expression/typed_expression/method_application.rs index ff024a7a2f0..3ec281ad837 100644 --- a/sway-core/src/semantic_analysis/ast_node/expression/typed_expression/method_application.rs +++ b/sway-core/src/semantic_analysis/ast_node/expression/typed_expression/method_application.rs @@ -5,7 +5,7 @@ use crate::parse_tree::MethodName; use crate::parser::{Rule, SwayParser}; use crate::semantic_analysis::TCOpts; use pest::Parser; -use std::collections::{HashMap, VecDeque}; +use std::collections::VecDeque; #[allow(clippy::too_many_arguments)] pub(crate) fn type_check_method_application( @@ -17,7 +17,6 @@ pub(crate) fn type_check_method_application( self_type: TypeId, build_config: &BuildConfig, dead_code_graph: &mut ControlFlowGraph, - dependency_graph: &mut HashMap>, opts: TCOpts, ) -> CompileResult { let mut warnings = vec![]; @@ -34,7 +33,6 @@ pub(crate) fn type_check_method_application( self_type, build_config, dead_code_graph, - dependency_graph, mode: Mode::NonAbi, opts, }), @@ -182,7 +180,6 @@ pub(crate) fn type_check_method_application( crate_namespace, self_type, dead_code_graph, - dependency_graph, opts, ), return err(warnings, errors), @@ -257,7 +254,6 @@ pub(crate) fn type_check_method_application( crate_namespace, self_type, dead_code_graph, - dependency_graph, opts, ), return err(warnings, errors), @@ -293,7 +289,6 @@ fn re_parse_expression( crate_namespace: NamespaceRef, self_type: TypeId, dead_code_graph: &mut ControlFlowGraph, - dependency_graph: &mut HashMap>, opts: TCOpts, ) -> CompileResult { let mut warnings = vec![]; @@ -345,7 +340,6 @@ fn re_parse_expression( self_type, build_config, dead_code_graph, - dependency_graph, mode: Mode::NonAbi, opts, }), diff --git a/sway-core/src/semantic_analysis/ast_node/impl_trait.rs b/sway-core/src/semantic_analysis/ast_node/impl_trait.rs index a10dfacfa5a..e83ff4737aa 100644 --- a/sway-core/src/semantic_analysis/ast_node/impl_trait.rs +++ b/sway-core/src/semantic_analysis/ast_node/impl_trait.rs @@ -14,15 +14,12 @@ use crate::{ use sway_types::span::Span; -use std::collections::{HashMap, HashSet}; - pub(crate) fn implementation_of_trait( impl_trait: ImplTrait, namespace: crate::semantic_analysis::NamespaceRef, crate_namespace: NamespaceRef, build_config: &BuildConfig, dead_code_graph: &mut ControlFlowGraph, - dependency_graph: &mut HashMap>, opts: TCOpts, ) -> CompileResult { let mut errors = vec![]; @@ -74,7 +71,6 @@ pub(crate) fn implementation_of_trait( type_implementing_for_id, &type_implementing_for_span, Mode::NonAbi, - dependency_graph, opts, ), return err(warnings, errors), @@ -135,7 +131,6 @@ pub(crate) fn implementation_of_trait( type_implementing_for_id, &type_implementing_for_span, Mode::ImplAbiFn, - dependency_graph, opts, ), return err(warnings, errors), @@ -199,7 +194,6 @@ fn type_check_trait_implementation( type_implementing_for: TypeId, type_implementing_for_span: &Span, mode: Mode, - dependency_graph: &mut HashMap>, opts: TCOpts, ) -> CompileResult> { let mut functions_buf: Vec = vec![]; @@ -229,7 +223,6 @@ fn type_check_trait_implementation( build_config, dead_code_graph, mode, - dependency_graph, opts, }), continue, @@ -385,7 +378,6 @@ fn type_check_trait_implementation( build_config, dead_code_graph, mode, - dependency_graph, opts, }), continue, diff --git a/sway-core/src/semantic_analysis/ast_node/mod.rs b/sway-core/src/semantic_analysis/ast_node/mod.rs index d8c8fb109e8..30a6e962d21 100644 --- a/sway-core/src/semantic_analysis/ast_node/mod.rs +++ b/sway-core/src/semantic_analysis/ast_node/mod.rs @@ -12,10 +12,7 @@ use crate::{ use sway_types::span::{join_spans, Span}; -use std::{ - collections::{HashMap, HashSet}, - sync::Arc, -}; +use std::{collections::HashSet, sync::Arc}; pub(crate) use crate::semantic_analysis::ast_node::declaration::ReassignmentLhs; @@ -136,7 +133,6 @@ impl TypedAstNode { self_type, build_config, dead_code_graph, - dependency_graph, opts, .. } = arguments; @@ -165,7 +161,6 @@ impl TypedAstNode { self_type, build_config, dead_code_graph, - dependency_graph, mode: Mode::NonAbi, opts, }) @@ -196,13 +191,7 @@ impl TypedAstNode { // Import the file, parse it, put it in the namespace under the module name (alias or // last part of the import by default) let _ = check!( - import_new_file( - a, - namespace, - build_config, - dead_code_graph, - dependency_graph - ), + import_new_file(a, namespace, build_config, dead_code_graph), return err(warnings, errors), warnings, errors @@ -238,7 +227,6 @@ impl TypedAstNode { self_type, build_config, dead_code_graph, - dependency_graph, mode: Mode::NonAbi, opts, }) @@ -318,7 +306,6 @@ impl TypedAstNode { build_config, dead_code_graph, mode: Mode::NonAbi, - dependency_graph, opts }), error_recovery_function_declaration(fn_decl), @@ -444,7 +431,6 @@ impl TypedAstNode { insert_type(TypeInfo::SelfType), build_config, dead_code_graph, - dependency_graph ), vec![], warnings, @@ -471,7 +457,6 @@ impl TypedAstNode { self_type, build_config, dead_code_graph, - dependency_graph, // this is unused by `reassignment` return_type_annotation: insert_type(TypeInfo::Unknown), help_text: Default::default(), @@ -492,7 +477,6 @@ impl TypedAstNode { crate_namespace, build_config, dead_code_graph, - dependency_graph, opts, ), return err(warnings, errors), @@ -549,7 +533,6 @@ impl TypedAstNode { build_config, dead_code_graph, mode: Mode::NonAbi, - dependency_graph, opts }), continue, @@ -653,7 +636,6 @@ impl TypedAstNode { self_type, build_config, dead_code_graph, - dependency_graph ), vec![], warnings, @@ -689,7 +671,6 @@ impl TypedAstNode { self_type, build_config, dead_code_graph, - dependency_graph, mode: Mode::NonAbi, opts }), @@ -713,7 +694,6 @@ impl TypedAstNode { self_type, build_config, dead_code_graph, - dependency_graph, mode: Mode::NonAbi, opts }), @@ -734,7 +714,6 @@ impl TypedAstNode { self_type, build_config, dead_code_graph, - dependency_graph, mode: Mode::NonAbi, opts, }), @@ -756,7 +735,6 @@ impl TypedAstNode { self_type, build_config, dead_code_graph, - dependency_graph, mode: Mode::NonAbi, opts }), @@ -777,7 +755,6 @@ impl TypedAstNode { self_type, build_config, dead_code_graph, - dependency_graph, mode: Mode::NonAbi, opts, }), @@ -827,7 +804,6 @@ fn import_new_file( namespace: NamespaceRef, build_config: &BuildConfig, dead_code_graph: &mut ControlFlowGraph, - dependency_graph: &mut HashMap>, ) -> CompileResult<()> { let mut warnings = vec![]; let mut errors = vec![]; @@ -877,13 +853,7 @@ fn import_new_file( namespace: module, .. } = check!( - crate::compile_inner_dependency( - file_as_string, - dep_namespace, - dep_config, - dead_code_graph, - dependency_graph - ), + crate::compile_inner_dependency(file_as_string, dep_namespace, dep_config, dead_code_graph), return err(warnings, errors), warnings, errors @@ -909,7 +879,6 @@ fn reassignment( self_type, build_config, dead_code_graph, - dependency_graph, opts, .. } = arguments; @@ -964,7 +933,6 @@ fn reassignment( self_type, build_config, dead_code_graph, - dependency_graph, mode: Mode::NonAbi, opts }), @@ -1003,7 +971,6 @@ fn reassignment( self_type, build_config, dead_code_graph, - dependency_graph, mode: Mode::NonAbi, opts }), @@ -1067,7 +1034,6 @@ fn reassignment( self_type, build_config, dead_code_graph, - dependency_graph, mode: Mode::NonAbi, opts, }), @@ -1159,7 +1125,6 @@ fn type_check_trait_methods( self_type: TypeId, build_config: &BuildConfig, dead_code_graph: &mut ControlFlowGraph, - dependency_graph: &mut HashMap>, ) -> CompileResult> { let mut warnings = vec![]; let mut errors = vec![]; @@ -1297,7 +1262,6 @@ fn type_check_trait_methods( self_type, build_config, dead_code_graph, - dependency_graph, mode: Mode::NonAbi, opts: TCOpts { purity } }), diff --git a/sway-core/src/semantic_analysis/syntax_tree.rs b/sway-core/src/semantic_analysis/syntax_tree.rs index a64cd821946..3c3767cfbb3 100644 --- a/sway-core/src/semantic_analysis/syntax_tree.rs +++ b/sway-core/src/semantic_analysis/syntax_tree.rs @@ -17,8 +17,6 @@ use crate::{ use sway_types::{ident::Ident, span::Span}; -use std::collections::{HashMap, HashSet}; - /// Represents the different variants of the AST. #[derive(Clone, Debug, PartialEq, Eq)] pub enum TreeType { @@ -95,7 +93,6 @@ impl TypedParseTree { tree_type: &TreeType, build_config: &BuildConfig, dead_code_graph: &mut ControlFlowGraph, - dependency_graph: &mut HashMap>, ) -> CompileResult { let mut warnings = Vec::new(); let mut errors = Vec::new(); @@ -113,7 +110,6 @@ impl TypedParseTree { crate_namespace, build_config, dead_code_graph, - dependency_graph, ), return err(warnings, errors), warnings, @@ -136,7 +132,6 @@ impl TypedParseTree { crate_namespace: NamespaceRef, build_config: &BuildConfig, dead_code_graph: &mut ControlFlowGraph, - dependency_graph: &mut HashMap>, ) -> CompileResult> { let mut warnings = Vec::new(); let mut errors = Vec::new(); @@ -152,7 +147,6 @@ impl TypedParseTree { self_type: insert_type(TypeInfo::Contract), build_config, dead_code_graph, - dependency_graph, mode: Mode::NonAbi, opts: Default::default(), }) diff --git a/sway-core/src/semantic_analysis/type_check_arguments.rs b/sway-core/src/semantic_analysis/type_check_arguments.rs index a6f90461fb4..f9054daf3b7 100644 --- a/sway-core/src/semantic_analysis/type_check_arguments.rs +++ b/sway-core/src/semantic_analysis/type_check_arguments.rs @@ -4,7 +4,6 @@ use crate::parse_tree::declaration::Purity; use crate::semantic_analysis::{ast_node::Mode, *}; use crate::type_engine::*; -use std::collections::{HashMap, HashSet}; pub struct TypeCheckArguments<'a, T> { pub checkee: T, pub namespace: NamespaceRef, @@ -15,7 +14,6 @@ pub struct TypeCheckArguments<'a, T> { pub build_config: &'a BuildConfig, pub dead_code_graph: &'a mut ControlFlowGraph, pub mode: Mode, - pub dependency_graph: &'a mut HashMap>, pub opts: TCOpts, } diff --git a/sway-core/src/source_map.rs b/sway-core/src/source_map.rs old mode 100755 new mode 100644 diff --git a/sway-core/utils/selector_debug.rs b/sway-core/utils/selector_debug.rs index d88cbcb0d75..36b766d297d 100644 --- a/sway-core/utils/selector_debug.rs +++ b/sway-core/utils/selector_debug.rs @@ -49,7 +49,6 @@ fn main() { ), dead_code_graph: &mut Default::default(), mode: Mode::ImplAbiFn, - dependency_graph: &mut Default::default(), opts: Default::default(), }) .unwrap(&mut warnings, &mut errors);