Start populating named entities in relevant locations. (#919)

This starts detecting naming collisions as a consequence of being able to determine when the name is declared twice in a given scope.



Co-authored-by: Geoff Romer <gromer@google.com>
This commit is contained in:
Jon Meow
2021-11-03 08:04:13 -07:00
committed by GitHub
co-authored by Geoff Romer
parent 82a870cfcd
commit 27e084d37a
25 changed files with 586 additions and 30 deletions
+5 -4
View File
@@ -108,7 +108,7 @@
%type <Nonnull<Block*>> block
%type <std::vector<Nonnull<Statement*>>> statement_list
%type <Nonnull<Expression*>> expression
%type <GenericBinding> generic_binding
%type <BisonWrap<GenericBinding>> generic_binding
%type <std::vector<GenericBinding>> deduced_params
%type <std::vector<GenericBinding>> deduced_param_list
%type <Nonnull<Pattern*>> pattern
@@ -632,7 +632,7 @@ return_type:
;
generic_binding:
identifier COLON_BANG expression
{ $$ = GenericBinding({.name = std::move($1), .type = $3}); }
{ $$ = GenericBinding(context.source_loc(), std::move($1), $3); }
;
deduced_param_list:
// Empty
@@ -696,11 +696,12 @@ member_list:
;
alternative:
identifier tuple
{ $$ = ChoiceDeclaration::Alternative($1, $2); }
{ $$ = ChoiceDeclaration::Alternative(context.source_loc(), $1, $2); }
| identifier
{
$$ = ChoiceDeclaration::Alternative(
$1, arena->New<TupleLiteral>(context.source_loc()));
context.source_loc(), $1,
arena->New<TupleLiteral>(context.source_loc()));
}
;
alternative_list: