From 93867c580cf6377d324476039ce6944bd33bda22 Mon Sep 17 00:00:00 2001 From: shruti2522 Date: Sat, 1 Jun 2024 02:35:22 +0530 Subject: [PATCH] fmt check Signed-off-by: shruti2522 --- kclvm/sema/src/core/symbol.rs | 57 ++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 27 deletions(-) diff --git a/kclvm/sema/src/core/symbol.rs b/kclvm/sema/src/core/symbol.rs index 91f284541..3a9dd1f08 100644 --- a/kclvm/sema/src/core/symbol.rs +++ b/kclvm/sema/src/core/symbol.rs @@ -713,28 +713,28 @@ impl SymbolData { } pub fn alloc_function_symbol( - &mut self, - func: FunctionSymbol, - node_key: NodeKey, -) -> Option { - if self.symbols_info.symbol_pos_set.contains(&func.end) { - return None; - } - self.symbols_info.symbol_pos_set.insert(func.end.clone()); - let symbol_id = self.functions.insert(func); - let symbol_ref = SymbolRef { - id: symbol_id, - kind: SymbolKind::Function, - }; - self.symbols_info - .node_symbol_map - .insert(node_key.clone(), symbol_ref); - self.symbols_info - .symbol_node_map - .insert(symbol_ref, node_key); - self.functions.get_mut(symbol_id).unwrap().id = Some(symbol_ref); - Some(symbol_ref) -} + &mut self, + func: FunctionSymbol, + node_key: NodeKey, + ) -> Option { + if self.symbols_info.symbol_pos_set.contains(&func.end) { + return None; + } + self.symbols_info.symbol_pos_set.insert(func.end.clone()); + let symbol_id = self.functions.insert(func); + let symbol_ref = SymbolRef { + id: symbol_id, + kind: SymbolKind::Function, + }; + self.symbols_info + .node_symbol_map + .insert(node_key.clone(), symbol_ref); + self.symbols_info + .symbol_node_map + .insert(symbol_ref, node_key); + self.functions.get_mut(symbol_id).unwrap().id = Some(symbol_ref); + Some(symbol_ref) + } #[inline] pub fn get_node_symbol_map(&self) -> &IndexMap { @@ -2126,11 +2126,11 @@ pub struct FunctionSymbol { pub(crate) end: Position, pub(crate) owner: Option, pub(crate) sema_info: KCLSymbolSemanticInfo, - pub(crate) parameters: Vec<(String, String)>, + pub(crate) parameters: Vec<(String, String)>, } impl Symbol for FunctionSymbol { - type SymbolData = SymbolData; + type SymbolData = SymbolData; type SemanticInfo = KCLSymbolSemanticInfo; fn is_global(&self) -> bool { @@ -2163,7 +2163,7 @@ impl Symbol for FunctionSymbol { _data: &Self::SymbolData, _module_info: Option<&ModuleInfo>, ) -> Option { - None + None } fn has_attribute( @@ -2180,7 +2180,7 @@ impl Symbol for FunctionSymbol { _data: &Self::SymbolData, _module_info: Option<&ModuleInfo>, ) -> Vec { - vec![] + vec![] } fn simple_dump(&self) -> String { @@ -2206,7 +2206,10 @@ impl Symbol for FunctionSymbol { if i > 0 { output.push_str(", "); } - output.push_str(&format!("{{\"name\": \"{}\", \"type\": \"{}\"}}", param_name, param_type)); + output.push_str(&format!( + "{{\"name\": \"{}\", \"type\": \"{}\"}}", + param_name, param_type + )); } output.push_str("]\n}");