mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 07:24:42 +01:00
Unify initialization and conversion logic (#3255)
Combine the initialization, implicit conversion, and value category conversion functions into a single function. This substantially reduces the duplication between these steps, and ensures that we support the same set of conversions in all these contexts. This also fixes some issues where we would not use the proper value representation for tuples and structs after performing implicit conversions.
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
#include "toolchain/check/context.h"
|
||||
#include "toolchain/check/convert.h"
|
||||
|
||||
namespace Carbon::Check {
|
||||
|
||||
@@ -22,7 +23,7 @@ auto HandleStructFieldDesignator(Context& context, Parse::Node /*parse_node*/)
|
||||
|
||||
auto HandleStructFieldType(Context& context, Parse::Node parse_node) -> bool {
|
||||
auto [type_node, type_id] = context.node_stack().PopExpressionWithParseNode();
|
||||
SemIR::TypeId cast_type_id = context.ExpressionAsType(type_node, type_id);
|
||||
SemIR::TypeId cast_type_id = ExpressionAsType(context, type_node, type_id);
|
||||
|
||||
auto [name_node, name_id] =
|
||||
context.node_stack().PopWithParseNode<Parse::NodeKind::Name>();
|
||||
|
||||
Reference in New Issue
Block a user