Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store named constant values in the AST #1011

Merged
merged 2 commits into from
Jan 13, 2022
Merged

Store named constant values in the AST #1011

merged 2 commits into from
Jan 13, 2022

Conversation

geoffromer
Copy link
Contributor

This enables us to stop using Env in the typechecker. As a byproduct, this commit also restructures the interpreter to handle run-time global initialization as part of ordinary execution, using the Action stack.

This enables us to stop using `Env` in the typechecker. As a byproduct, this commit also restructures the interpreter to handle run-time global initialization as part of ordinary execution, using the Action stack.
@geoffromer geoffromer requested a review from jsiek January 6, 2022 21:04
@geoffromer geoffromer requested a review from a team as a code owner January 6, 2022 21:04
}
}

void ActionStack::FinishAction(Nonnull<const Value*> result) {
std::unique_ptr<Action> act = todo_.Pop();
switch (act->kind()) {
case Action::Kind::StatementAction:
FATAL() << "Statements cannot produce results.";
case Action::Kind::DeclarationAction:
FATAL() << "This kind of Action cannot produce results.";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"This" is too vague in the error message.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, updated this to log the action as well.

Copy link
Contributor

@jsiek jsiek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good!

@geoffromer geoffromer merged commit 6be1c7f into carbon-language:trunk Jan 13, 2022
@geoffromer geoffromer deleted the constants branch January 13, 2022 19:07
chandlerc pushed a commit that referenced this pull request Jun 28, 2022
This enables us to stop using `Env` in the typechecker. As a byproduct, this commit also restructures the interpreter to handle run-time global initialization as part of ordinary execution, using the Action stack.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants