mirror of
https://github.com/gcc-mirror/gcc.git
synced 2026-05-06 23:25:24 +02:00
gccrs: ast: builder: Allow building struct ident patterns
gcc/rust/ChangeLog: * ast/rust-ast-builder.cc (Builder::struct_pattern_ident_pattern): New. * ast/rust-ast-builder.h: New declaration.
This commit is contained in:
@@ -442,6 +442,14 @@ Builder::field_access (std::unique_ptr<Expr> &&instance,
|
||||
new FieldAccessExpr (std::move (instance), field, {}, loc));
|
||||
}
|
||||
|
||||
std::unique_ptr<StructPatternField>
|
||||
Builder::struct_pattern_ident_pattern (std::string field_name,
|
||||
std::unique_ptr<Pattern> &&pattern)
|
||||
{
|
||||
return std::make_unique<StructPatternFieldIdentPat> (
|
||||
field_name, std::move (pattern), std::vector<Attribute> (), loc);
|
||||
}
|
||||
|
||||
std::unique_ptr<Pattern>
|
||||
Builder::wildcard () const
|
||||
{
|
||||
|
||||
@@ -254,6 +254,10 @@ public:
|
||||
std::unique_ptr<Expr> field_access (std::unique_ptr<Expr> &&instance,
|
||||
std::string field) const;
|
||||
|
||||
std::unique_ptr<StructPatternField>
|
||||
struct_pattern_ident_pattern (std::string field_name,
|
||||
std::unique_ptr<Pattern> &&pattern);
|
||||
|
||||
/* Create a wildcard pattern (`_`) */
|
||||
std::unique_ptr<Pattern> wildcard () const;
|
||||
/* Create a reference pattern (`&pattern`) */
|
||||
|
||||
Reference in New Issue
Block a user