mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 21:41:27 +01:00
Sorting out how bindings are added to name lookup. (#2869)
This shifts logic so that bindings are added to name lookup only after the scope is complete, removing logic around adding/removing/re-adding names in certain scopes. This does mean that things like a function's forward declaration will need to go through an extra hoop for name conflict checks, because under this approach a function definition does conflict checking when it adds names for the body's use. But, that seems easy to address, and better than the current hoops.
This commit is contained in:
@@ -23,8 +23,8 @@ auto SemanticsHandleCallExpression(SemanticsContext& context,
|
||||
return true;
|
||||
}
|
||||
|
||||
auto [_, callable_id] = name_node.GetAsFunctionDeclaration();
|
||||
auto callable = context.semantics_ir().GetCallable(callable_id);
|
||||
auto function_id = name_node.GetAsFunctionDeclaration();
|
||||
auto callable = context.semantics_ir().GetFunction(function_id);
|
||||
|
||||
CARBON_DIAGNOSTIC(NoMatchingCall, Error, "No matching callable was found.");
|
||||
auto diagnostic =
|
||||
@@ -42,7 +42,7 @@ auto SemanticsHandleCallExpression(SemanticsContext& context,
|
||||
|
||||
// TODO: Propagate return types from callable.
|
||||
auto call_node_id = context.AddNode(SemanticsNode::Call::Make(
|
||||
call_expr_parse_node, callable.return_type_id, refs_id, callable_id));
|
||||
call_expr_parse_node, callable.return_type_id, refs_id, function_id));
|
||||
|
||||
context.node_stack().Push(parse_node, call_node_id);
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user