Skip to content

Commit fcfa142

Browse files
committed
update
1 parent 87de856 commit fcfa142

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

crates/emmylua_code_analysis/src/semantic/infer/infer_name/narrow/get_type_at_flow.rs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,23 @@ pub fn get_type_at_flow(
4646
}
4747
FlowNodeKind::Assignment(assign_ptr) => {
4848
let assign_stat = assign_ptr.to_node(root).ok_or(InferFailReason::None)?;
49+
let opt_type = get_type_at_assign_stat(
50+
db,
51+
tree,
52+
cache,
53+
root,
54+
decl_id,
55+
antecedent_flow_id,
56+
assign_stat,
57+
)?;
4958

50-
},
59+
if let Some(assign_type) = opt_type {
60+
result_type = assign_type;
61+
break;
62+
} else {
63+
antecedent_flow_id = get_single_antecedent(tree, flow_node)?;
64+
}
65+
}
5166
FlowNodeKind::TrueCondition(lua_ast_ptr) => todo!(),
5267
FlowNodeKind::FalseCondition(lua_ast_ptr) => todo!(),
5368
FlowNodeKind::ForIStat(lua_ast_ptr) => todo!(),
@@ -92,6 +107,6 @@ fn get_type_at_assign_stat(
92107
decl_id: LuaDeclId,
93108
flow_id: FlowId,
94109
assign_stat: LuaAssignStat,
95-
) -> Result<LuaType, InferFailReason> {
110+
) -> Result<Option<LuaType>, InferFailReason> {
96111
todo!()
97-
}
112+
}

0 commit comments

Comments
 (0)