aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/ast/rust-pattern.h
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/rust/ast/rust-pattern.h')
-rw-r--r--gcc/rust/ast/rust-pattern.h62
1 files changed, 31 insertions, 31 deletions
diff --git a/gcc/rust/ast/rust-pattern.h b/gcc/rust/ast/rust-pattern.h
index 0fd3c06..d35fbce 100644
--- a/gcc/rust/ast/rust-pattern.h
+++ b/gcc/rust/ast/rust-pattern.h
@@ -27,19 +27,19 @@ namespace AST {
class LiteralPattern : public Pattern
{
Literal lit;
- Location locus;
+ location_t locus;
NodeId node_id;
public:
std::string as_string () const override;
// Constructor for a literal pattern
- LiteralPattern (Literal lit, Location locus)
+ LiteralPattern (Literal lit, location_t locus)
: lit (std::move (lit)), locus (locus),
node_id (Analysis::Mappings::get ()->get_next_node_id ())
{}
- LiteralPattern (std::string val, Literal::LitType type, Location locus,
+ LiteralPattern (std::string val, Literal::LitType type, location_t locus,
PrimitiveCoreType type_hint)
: lit (Literal (std::move (val), type, type_hint)), locus (locus),
node_id (Analysis::Mappings::get ()->get_next_node_id ())
@@ -75,7 +75,7 @@ class IdentifierPattern : public Pattern
// bool has_pattern;
std::unique_ptr<Pattern> to_bind;
- Location locus;
+ location_t locus;
NodeId node_id;
public:
@@ -85,7 +85,7 @@ public:
bool has_pattern_to_bind () const { return to_bind != nullptr; }
// Constructor
- IdentifierPattern (Identifier ident, Location locus, bool is_ref = false,
+ IdentifierPattern (Identifier ident, location_t locus, bool is_ref = false,
bool is_mut = false,
std::unique_ptr<Pattern> to_bind = nullptr)
: Pattern (), variable_ident (std::move (ident)), is_ref (is_ref),
@@ -93,7 +93,7 @@ public:
node_id (Analysis::Mappings::get ()->get_next_node_id ())
{}
- IdentifierPattern (NodeId node_id, Identifier ident, Location locus,
+ IdentifierPattern (NodeId node_id, Identifier ident, location_t locus,
bool is_ref = false, bool is_mut = false,
std::unique_ptr<Pattern> to_bind = nullptr)
: Pattern (), variable_ident (std::move (ident)), is_ref (is_ref),
@@ -165,13 +165,13 @@ protected:
// AST node for using the '_' wildcard "match any value" pattern
class WildcardPattern : public Pattern
{
- Location locus;
+ location_t locus;
NodeId node_id;
public:
std::string as_string () const override { return std::string (1, '_'); }
- WildcardPattern (Location locus)
+ WildcardPattern (location_t locus)
: locus (locus), node_id (Analysis::Mappings::get ()->get_next_node_id ())
{}
@@ -194,13 +194,13 @@ protected:
class RestPattern : public Pattern
{
- Location locus;
+ location_t locus;
NodeId node_id;
public:
std::string as_string () const override { return ".."; }
- RestPattern (Location locus)
+ RestPattern (location_t locus)
: locus (locus), node_id (Analysis::Mappings::get ()->get_next_node_id ())
{}
@@ -258,11 +258,11 @@ class RangePatternBoundLiteral : public RangePatternBound
// Minus prefixed to literal (if integer or floating-point)
bool has_minus;
- Location locus;
+ location_t locus;
public:
// Constructor
- RangePatternBoundLiteral (Literal literal, Location locus,
+ RangePatternBoundLiteral (Literal literal, location_t locus,
bool has_minus = false)
: literal (literal), has_minus (has_minus), locus (locus)
{}
@@ -373,7 +373,7 @@ class RangePattern : public Pattern
/* location only stored to avoid a dereference - lower pattern should give
* correct location so maybe change in future */
- Location locus;
+ location_t locus;
NodeId node_id;
public:
@@ -381,7 +381,7 @@ public:
// Constructor
RangePattern (std::unique_ptr<RangePatternBound> lower,
- std::unique_ptr<RangePatternBound> upper, Location locus,
+ std::unique_ptr<RangePatternBound> upper, location_t locus,
bool has_ellipsis_syntax = false)
: lower (std::move (lower)), upper (std::move (upper)),
has_ellipsis_syntax (has_ellipsis_syntax), locus (locus),
@@ -454,14 +454,14 @@ class ReferencePattern : public Pattern
bool has_two_amps;
bool is_mut;
std::unique_ptr<Pattern> pattern;
- Location locus;
+ location_t locus;
NodeId node_id;
public:
std::string as_string () const override;
ReferencePattern (std::unique_ptr<Pattern> pattern, bool is_mut_reference,
- bool ref_has_two_amps, Location locus)
+ bool ref_has_two_amps, location_t locus)
: has_two_amps (ref_has_two_amps), is_mut (is_mut_reference),
pattern (std::move (pattern)), locus (locus),
node_id (Analysis::Mappings::get ()->get_next_node_id ())
@@ -544,7 +544,7 @@ public:
class StructPatternField
{
std::vector<Attribute> outer_attrs;
- Location locus;
+ location_t locus;
protected:
NodeId node_id;
@@ -583,7 +583,7 @@ public:
const std::vector<Attribute> &get_outer_attrs () const { return outer_attrs; }
protected:
- StructPatternField (std::vector<Attribute> outer_attribs, Location locus,
+ StructPatternField (std::vector<Attribute> outer_attribs, location_t locus,
NodeId node_id)
: outer_attrs (std::move (outer_attribs)), locus (locus), node_id (node_id)
{}
@@ -602,7 +602,7 @@ public:
StructPatternFieldTuplePat (TupleIndex index,
std::unique_ptr<Pattern> tuple_pattern,
std::vector<Attribute> outer_attribs,
- Location locus)
+ location_t locus)
: StructPatternField (std::move (outer_attribs), locus,
Analysis::Mappings::get ()->get_next_node_id ()),
index (index), tuple_pattern (std::move (tuple_pattern))
@@ -682,7 +682,7 @@ public:
StructPatternFieldIdentPat (Identifier ident,
std::unique_ptr<Pattern> ident_pattern,
std::vector<Attribute> outer_attrs,
- Location locus)
+ location_t locus)
: StructPatternField (std::move (outer_attrs), locus,
Analysis::Mappings::get ()->get_next_node_id ()),
ident (std::move (ident)), ident_pattern (std::move (ident_pattern))
@@ -761,7 +761,7 @@ class StructPatternFieldIdent : public StructPatternField
public:
StructPatternFieldIdent (Identifier ident, bool is_ref, bool is_mut,
- std::vector<Attribute> outer_attrs, Location locus)
+ std::vector<Attribute> outer_attrs, location_t locus)
: StructPatternField (std::move (outer_attrs), locus,
Analysis::Mappings::get ()->get_next_node_id ()),
has_ref (is_ref), has_mut (is_mut), ident (std::move (ident))
@@ -908,13 +908,13 @@ class StructPattern : public Pattern
StructPatternElements elems;
NodeId node_id;
- Location locus;
+ location_t locus;
public:
std::string as_string () const override;
// Constructs a struct pattern from specified StructPatternElements
- StructPattern (PathInExpression struct_path, Location locus,
+ StructPattern (PathInExpression struct_path, location_t locus,
StructPatternElements elems
= StructPatternElements::create_empty ())
: path (std::move (struct_path)), elems (std::move (elems)),
@@ -1379,7 +1379,7 @@ class TuplePattern : public Pattern
{
// bool has_tuple_pattern_items;
std::unique_ptr<TuplePatternItems> items;
- Location locus;
+ location_t locus;
NodeId node_id;
public:
@@ -1388,7 +1388,7 @@ public:
// Returns true if the tuple pattern has items
bool has_tuple_pattern_items () const { return items != nullptr; }
- TuplePattern (std::unique_ptr<TuplePatternItems> items, Location locus)
+ TuplePattern (std::unique_ptr<TuplePatternItems> items, location_t locus)
: items (std::move (items)), locus (locus),
node_id (Analysis::Mappings::get ()->get_next_node_id ())
{}
@@ -1445,7 +1445,7 @@ protected:
class GroupedPattern : public Pattern
{
std::unique_ptr<Pattern> pattern_in_parens;
- Location locus;
+ location_t locus;
NodeId node_id;
public:
@@ -1454,7 +1454,7 @@ public:
return "(" + pattern_in_parens->as_string () + ")";
}
- GroupedPattern (std::unique_ptr<Pattern> pattern_in_parens, Location locus)
+ GroupedPattern (std::unique_ptr<Pattern> pattern_in_parens, location_t locus)
: pattern_in_parens (std::move (pattern_in_parens)), locus (locus),
node_id (Analysis::Mappings::get ()->get_next_node_id ())
{}
@@ -1507,13 +1507,13 @@ protected:
class SlicePattern : public Pattern
{
std::vector<std::unique_ptr<Pattern>> items;
- Location locus;
+ location_t locus;
NodeId node_id;
public:
std::string as_string () const override;
- SlicePattern (std::vector<std::unique_ptr<Pattern>> items, Location locus)
+ SlicePattern (std::vector<std::unique_ptr<Pattern>> items, location_t locus)
: items (std::move (items)), locus (locus),
node_id (Analysis::Mappings::get ()->get_next_node_id ())
{}
@@ -1574,13 +1574,13 @@ protected:
class AltPattern : public Pattern
{
std::vector<std::unique_ptr<Pattern>> alts;
- Location locus;
+ location_t locus;
NodeId node_id;
public:
std::string as_string () const override;
- AltPattern (std::vector<std::unique_ptr<Pattern>> alts, Location locus)
+ AltPattern (std::vector<std::unique_ptr<Pattern>> alts, location_t locus)
: alts (std::move (alts)), locus (locus),
node_id (Analysis::Mappings::get ()->get_next_node_id ())
{}