Switch Member to variant in anticipation of more kinds. (#656)

Note this overlaps a little with #644's Member changes, but not too badly.
This commit is contained in:
Jon Meow
2021-07-15 15:23:52 -07:00
committed by GitHub
parent 467b58abe9
commit ada2be2d16
6 changed files with 54 additions and 37 deletions
+3 -2
View File
@@ -384,7 +384,7 @@ function_declaration:
{ $$ = Carbon::FunctionDefinition(yylineno, $2, $3, $4, 0); }
;
variable_declaration: identifier ":" expression
{ $$ = MakeField(yylineno, $1, $3); }
{ $$ = Carbon::Member::MakeFieldMember(yylineno, $1, $3); }
;
member: VAR variable_declaration ";"
{ $$ = $2; }
@@ -433,7 +433,8 @@ declaration:
| VAR variable_declaration "=" expression ";"
{
$$ = Carbon::Declaration(
Carbon::VariableDeclaration(yylineno, *$2->u.field.name, $2->u.field.type, $4));
Carbon::VariableDeclaration(yylineno, $2->GetFieldMember().name,
$2->GetFieldMember().type, $4));
}
;
declaration_list: