mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 22:02:52 +01:00
Implement static name resolution (#958)
This doesn't actually use the results of name resolution, but it does verify that they are present. Also ensures that name resolution and type checking are applied to deduced function parameters and the implicit call to `Main()`. Co-authored-by: Jon Meow <46229924+jonmeow@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
co-authored by
Jon Meow
parent
dc5e62fc7a
commit
17e0a1afb9
@@ -302,6 +302,9 @@ void Interpreter::StepLvalue() {
|
||||
case ExpressionKind::IdentifierExpression: {
|
||||
// { {x :: C, E, F} :: S, H}
|
||||
// -> { {E(x) :: C, E, F} :: S, H}
|
||||
CHECK(cast<IdentifierExpression>(exp).has_named_entity())
|
||||
<< "Identifier '" << exp << "' at " << exp.source_loc()
|
||||
<< " was not resolved";
|
||||
Address pointer =
|
||||
GetFromEnv(exp.source_loc(), cast<IdentifierExpression>(exp).name());
|
||||
Nonnull<const Value*> v = arena_->New<LValue>(pointer);
|
||||
@@ -512,6 +515,9 @@ void Interpreter::StepExp() {
|
||||
case ExpressionKind::IdentifierExpression: {
|
||||
CHECK(act.pos() == 0);
|
||||
const auto& ident = cast<IdentifierExpression>(exp);
|
||||
CHECK(ident.has_named_entity())
|
||||
<< "Identifier '" << exp << "' at " << exp.source_loc()
|
||||
<< " was not resolved";
|
||||
// { {x :: C, E, F} :: S, H} -> { {H(E(x)) :: C, E, F} :: S, H}
|
||||
Address pointer = GetFromEnv(exp.source_loc(), ident.name());
|
||||
return todo_.FinishAction(heap_.Read(pointer, exp.source_loc()));
|
||||
|
||||
Reference in New Issue
Block a user