mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Implement 'alias' with transparent semantics. (#3701)
Adds `BindAlias` with a hybrid of `BindName` and `NameRef` semantics. I think it's slightly closer to `BindName` because it introduces a name, so I'm going more in that direction. This also matches the need for `bind_name_id` with imports on enclosing scopes. Note, only things that look like a name reference are being allowed on the RHS of `alias`. This includes builtins that look like name references, such as `bool`, but not ones that turn into values underneath, such as `false`.
This commit is contained in:
@@ -10,6 +10,11 @@ auto HandleStatement(Context& context) -> void {
|
||||
context.PopAndDiscardState();
|
||||
|
||||
switch (context.PositionKind()) {
|
||||
case Lex::TokenKind::Alias: {
|
||||
context.PushState(State::Alias);
|
||||
context.AddLeafNode(NodeKind::AliasIntroducer, context.Consume());
|
||||
break;
|
||||
}
|
||||
case Lex::TokenKind::Break: {
|
||||
context.PushState(State::StatementBreakFinish);
|
||||
context.AddLeafNode(NodeKind::BreakStatementStart, context.Consume());
|
||||
|
||||
Reference in New Issue
Block a user