Skip to content

Commit

Permalink
fmt check
Browse files Browse the repository at this point in the history
Signed-off-by: shruti2522 <[email protected]>
  • Loading branch information
shruti2522 committed May 31, 2024
1 parent 6554e9b commit 93867c5
Showing 1 changed file with 30 additions and 27 deletions.
57 changes: 30 additions & 27 deletions kclvm/sema/src/core/symbol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -713,28 +713,28 @@ impl SymbolData {
}

pub fn alloc_function_symbol(
&mut self,
func: FunctionSymbol,
node_key: NodeKey,
) -> Option<SymbolRef> {
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<SymbolRef> {
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<NodeKey, SymbolRef> {
Expand Down Expand Up @@ -2126,11 +2126,11 @@ pub struct FunctionSymbol {
pub(crate) end: Position,
pub(crate) owner: Option<SymbolRef>,
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 {
Expand Down Expand Up @@ -2163,7 +2163,7 @@ impl Symbol for FunctionSymbol {
_data: &Self::SymbolData,
_module_info: Option<&ModuleInfo>,
) -> Option<SymbolRef> {
None
None
}

fn has_attribute(
Expand All @@ -2180,7 +2180,7 @@ impl Symbol for FunctionSymbol {
_data: &Self::SymbolData,
_module_info: Option<&ModuleInfo>,
) -> Vec<SymbolRef> {
vec![]
vec![]
}

fn simple_dump(&self) -> String {
Expand All @@ -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}");

Expand Down

0 comments on commit 93867c5

Please sign in to comment.