mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 21:21:19 +01:00
change all expression and statement pointers to be const (#449)
* change all expression and statement pointers to be const * const in paren tests
This commit is contained in:
@@ -96,24 +96,24 @@ void yy::parser::error(
|
||||
%type <Carbon::FunctionDefinition*> function_declaration
|
||||
%type <Carbon::FunctionDefinition*> function_definition
|
||||
%type <std::list<Carbon::Declaration>*> declaration_list
|
||||
%type <Carbon::Statement*> statement
|
||||
%type <Carbon::Statement*> optional_else
|
||||
%type <Carbon::Statement*> statement_list
|
||||
%type <Carbon::Expression*> expression
|
||||
%type <Carbon::Expression*> pattern
|
||||
%type <Carbon::Expression*> return_type
|
||||
%type <Carbon::Expression*> paren_expression
|
||||
%type <Carbon::Expression*> tuple
|
||||
%type <const Carbon::Statement*> statement
|
||||
%type <const Carbon::Statement*> optional_else
|
||||
%type <const Carbon::Statement*> statement_list
|
||||
%type <const Carbon::Expression*> expression
|
||||
%type <const Carbon::Expression*> pattern
|
||||
%type <const Carbon::Expression*> return_type
|
||||
%type <const Carbon::Expression*> paren_expression
|
||||
%type <const Carbon::Expression*> tuple
|
||||
%type <Carbon::Member*> variable_declaration
|
||||
%type <Carbon::Member*> member
|
||||
%type <std::list<Carbon::Member*>*> member_list
|
||||
%type <Carbon::FieldInitializer> field_initializer
|
||||
%type <Carbon::ParenContents> paren_contents
|
||||
%type <std::vector<Carbon::FieldInitializer>> paren_contents_without_trailing_comma
|
||||
%type <std::pair<std::string, Carbon::Expression*>*> alternative
|
||||
%type <std::list<std::pair<std::string, Carbon::Expression*>>*> alternative_list
|
||||
%type <std::pair<Carbon::Expression*, Carbon::Statement*>*> clause
|
||||
%type <std::list<std::pair<Carbon::Expression*, Carbon::Statement*>>*> clause_list
|
||||
%type <std::pair<std::string, const Carbon::Expression*>*> alternative
|
||||
%type <std::list<std::pair<std::string, const Carbon::Expression*>>*> alternative_list
|
||||
%type <std::pair<const Carbon::Expression*, const Carbon::Statement*>*> clause
|
||||
%type <std::list<std::pair<const Carbon::Expression*, const Carbon::Statement*>>*> clause_list
|
||||
%token END_OF_FILE 0
|
||||
%token AND
|
||||
%token OR
|
||||
@@ -266,18 +266,18 @@ paren_contents_without_trailing_comma:
|
||||
;
|
||||
clause:
|
||||
CASE pattern DBLARROW statement
|
||||
{ $$ = new std::pair<Carbon::Expression*, Carbon::Statement*>($2, $4); }
|
||||
{ $$ = new std::pair<const Carbon::Expression*, const Carbon::Statement*>($2, $4); }
|
||||
| DEFAULT DBLARROW statement
|
||||
{
|
||||
auto vp = Carbon::MakeVarPat(yylineno, "_",
|
||||
Carbon::MakeAutoType(yylineno));
|
||||
$$ = new std::pair<Carbon::Expression*, Carbon::Statement*>(vp, $3);
|
||||
$$ = new std::pair<const Carbon::Expression*, const Carbon::Statement*>(vp, $3);
|
||||
}
|
||||
;
|
||||
clause_list:
|
||||
// Empty
|
||||
{
|
||||
$$ = new std::list<std::pair<Carbon::Expression*, Carbon::Statement*>>();
|
||||
$$ = new std::list<std::pair<const Carbon::Expression*, const Carbon::Statement*>>();
|
||||
}
|
||||
| clause clause_list
|
||||
{ $$ = $2; $$->push_front(*$1); }
|
||||
@@ -326,7 +326,7 @@ return_type:
|
||||
{
|
||||
$$ = Carbon::MakeTuple(
|
||||
yylineno,
|
||||
new std::vector<std::pair<std::string, Carbon::Expression*>>());
|
||||
new std::vector<std::pair<std::string, const Carbon::Expression*>>());
|
||||
}
|
||||
| ARROW expression
|
||||
{ $$ = $2; }
|
||||
@@ -358,21 +358,21 @@ member_list:
|
||||
;
|
||||
alternative:
|
||||
identifier tuple
|
||||
{ $$ = new std::pair<std::string, Carbon::Expression*>($1, $2); }
|
||||
{ $$ = new std::pair<std::string, const Carbon::Expression*>($1, $2); }
|
||||
| identifier
|
||||
{
|
||||
$$ = new std::pair<std::string, Carbon::Expression*>(
|
||||
$$ = new std::pair<std::string, const Carbon::Expression*>(
|
||||
$1, Carbon::MakeTuple(
|
||||
yylineno,
|
||||
new std::vector<std::pair<std::string, Carbon::Expression*>>()));
|
||||
new std::vector<std::pair<std::string, const Carbon::Expression*>>()));
|
||||
}
|
||||
;
|
||||
alternative_list:
|
||||
// Empty
|
||||
{ $$ = new std::list<std::pair<std::string, Carbon::Expression*>>(); }
|
||||
{ $$ = new std::list<std::pair<std::string, const Carbon::Expression*>>(); }
|
||||
| alternative
|
||||
{
|
||||
$$ = new std::list<std::pair<std::string, Carbon::Expression*>>();
|
||||
$$ = new std::list<std::pair<std::string, const Carbon::Expression*>>();
|
||||
$$->push_front(*$1);
|
||||
}
|
||||
| alternative "," alternative_list
|
||||
|
||||
Reference in New Issue
Block a user