mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 10:11:06 +01:00
Fix type errors in function calls (#308)
* Make `field_list` always a list. * Create separate `paren_expression` and `tuple` nonterminals * Rename expression_or_field_list.* to field_list.* Co-authored-by: Jeremy G. Siek <jsiek@indiana.edu>
This commit is contained in:
committed by
GitHub
co-authored by
Jeremy G. Siek
parent
bf6bb800c4
commit
8b3bb7c5e9
@@ -0,0 +1,29 @@
|
||||
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
#include "executable_semantics/ast/field_list.h"
|
||||
|
||||
namespace Carbon {
|
||||
|
||||
auto MakeFieldList(std::list<std::pair<std::string, Expression*>>* fields)
|
||||
-> FieldList* {
|
||||
auto e = new FieldList();
|
||||
e->fields = fields;
|
||||
return e;
|
||||
}
|
||||
|
||||
auto MakeConsField(FieldList* e1, FieldList* e2) -> FieldList* {
|
||||
auto fields = new std::list<std::pair<std::string, Expression*>>();
|
||||
for (auto& field : *e1->fields) {
|
||||
fields->push_back(field);
|
||||
}
|
||||
for (auto& field : *e2->fields) {
|
||||
fields->push_back(field);
|
||||
}
|
||||
auto result = MakeFieldList(fields);
|
||||
result->has_explicit_comma = true;
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace Carbon
|
||||
Reference in New Issue
Block a user