Skip to content

Commit

Permalink
Replace get_pattern_node_id with get_node_id
Browse files Browse the repository at this point in the history
gcc/rust/ChangeLog:

	* ast/rust-ast.h
	(Pattern::get_pattern_node_id): Rename to...
	(Pattern::get_node_id): ...here.
	* ast/rust-macro.h
	(MacroInvocation::get_pattern_node_id): Rename to...
	(MacroInvocation::get_node_id): ...here.
	* ast/rust-path.h
	(PathInExpression::get_pattern_node_id): Remove.
	(QualifiedPathInExpression::get_pattern_node_id): Remove.
	* ast/rust-pattern.h
	(LiteralPattern::get_pattern_node_id): Remove.
	(IdentifierPattern::get_pattern_node_id): Remove.
	(WildcardPattern::get_pattern_node_id): Remove.
	(RestPattern::get_pattern_node_id): Rename to...
	(RestPattern::get_node_id): ...here.
	(RangePattern::get_pattern_node_id): Remove.
	(ReferencePattern::get_pattern_node_id): Remove.
	(StructPattern::get_pattern_node_id): Remove.
	(TupleStructPattern::get_pattern_node_id): Remove.
	(TuplePattern::get_pattern_node_id): Remove.
	(GroupedPattern::get_pattern_node_id): Remove.
	(SlicePattern::get_pattern_node_id): Remove.
	(AltPattern::get_pattern_node_id): Remove.
	* resolve/rust-early-name-resolver.cc
	(EarlyNameResolver::visit):
	Use get_node_id instead of get_pattern_node_id.

Signed-off-by: Owen Avery <[email protected]>
  • Loading branch information
powerboat9 authored and philberty committed Oct 16, 2023
1 parent 9ddb362 commit c82bbb0
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 30 deletions.
2 changes: 1 addition & 1 deletion gcc/rust/ast/rust-ast.h
Original file line number Diff line number Diff line change
Expand Up @@ -1194,7 +1194,7 @@ class Pattern : public Visitable
virtual bool is_marked_for_strip () const { return false; }

virtual location_t get_locus () const = 0;
virtual NodeId get_pattern_node_id () const = 0;
virtual NodeId get_node_id () const = 0;

protected:
// Clone pattern implementation as pure virtual method
Expand Down
2 changes: 1 addition & 1 deletion gcc/rust/ast/rust-macro.h
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ class MacroInvocation : public TypeNoBounds,
outer_attrs = std::move (new_attrs);
}

NodeId get_pattern_node_id () const override final
NodeId get_node_id () const override final
{
return ExprWithoutBlock::get_node_id ();
}
Expand Down
4 changes: 0 additions & 4 deletions gcc/rust/ast/rust-path.h
Original file line number Diff line number Diff line change
Expand Up @@ -644,8 +644,6 @@ class PathInExpression : public PathPattern, public PathExpr
outer_attrs = std::move (new_attrs);
}

NodeId get_pattern_node_id () const override final { return get_node_id (); }

protected:
/* Use covariance to implement clone function as returning this object
* rather than base */
Expand Down Expand Up @@ -1244,8 +1242,6 @@ class QualifiedPathInExpression : public PathPattern, public PathExpr

NodeId get_node_id () const override { return _node_id; }

NodeId get_pattern_node_id () const override final { return get_node_id (); }

protected:
/* Use covariance to implement clone function as returning this object
* rather than base */
Expand Down
24 changes: 1 addition & 23 deletions gcc/rust/ast/rust-pattern.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ class LiteralPattern : public Pattern

NodeId get_node_id () const { return node_id; }

NodeId get_pattern_node_id () const override final { return node_id; }

Literal &get_literal () { return lit; }

const Literal &get_literal () const { return lit; }
Expand Down Expand Up @@ -151,8 +149,6 @@ class IdentifierPattern : public Pattern

NodeId get_node_id () const { return node_id; }

NodeId get_pattern_node_id () const override final { return node_id; }

protected:
/* Use covariance to implement clone function as returning this object rather
* than base */
Expand Down Expand Up @@ -181,8 +177,6 @@ class WildcardPattern : public Pattern

NodeId get_node_id () const { return node_id; }

NodeId get_pattern_node_id () const override final { return node_id; }

protected:
/* Use covariance to implement clone function as returning this object rather
* than base */
Expand All @@ -208,7 +202,7 @@ class RestPattern : public Pattern

void accept_vis (ASTVisitor &vis) override;

NodeId get_pattern_node_id () const override final { return node_id; }
NodeId get_node_id () const override final { return node_id; }

protected:
RestPattern *clone_pattern_impl () const override
Expand Down Expand Up @@ -437,8 +431,6 @@ class RangePattern : public Pattern

NodeId get_node_id () const { return node_id; }

NodeId get_pattern_node_id () const override final { return node_id; }

protected:
/* Use covariance to implement clone function as returning this object rather
* than base */
Expand Down Expand Up @@ -507,8 +499,6 @@ class ReferencePattern : public Pattern

NodeId get_node_id () const { return node_id; }

NodeId get_pattern_node_id () const override final { return node_id; }

protected:
/* Use covariance to implement clone function as returning this object rather
* than base */
Expand Down Expand Up @@ -944,8 +934,6 @@ class StructPattern : public Pattern

NodeId get_node_id () const { return node_id; }

NodeId get_pattern_node_id () const override final { return node_id; }

protected:
/* Use covariance to implement clone function as returning this object rather
* than base */
Expand Down Expand Up @@ -1183,8 +1171,6 @@ class TupleStructPattern : public Pattern

NodeId get_node_id () const { return node_id; }

NodeId get_pattern_node_id () const override final { return node_id; }

protected:
/* Use covariance to implement clone function as returning this object rather
* than base */
Expand Down Expand Up @@ -1425,8 +1411,6 @@ class TuplePattern : public Pattern

NodeId get_node_id () const { return node_id; }

NodeId get_pattern_node_id () const override final { return node_id; }

protected:
/* Use covariance to implement clone function as returning this object rather
* than base */
Expand Down Expand Up @@ -1487,8 +1471,6 @@ class GroupedPattern : public Pattern

NodeId get_node_id () const { return node_id; }

NodeId get_pattern_node_id () const override final { return node_id; }

protected:
/* Use covariance to implement clone function as returning this object rather
* than base */
Expand Down Expand Up @@ -1553,8 +1535,6 @@ class SlicePattern : public Pattern

NodeId get_node_id () const { return node_id; }

NodeId get_pattern_node_id () const override final { return node_id; }

protected:
/* Use covariance to implement clone function as returning this object rather
* than base */
Expand Down Expand Up @@ -1620,8 +1600,6 @@ class AltPattern : public Pattern

NodeId get_node_id () const { return node_id; }

NodeId get_pattern_node_id () const override final { return node_id; }

protected:
/* Use covariance to implement clone function as returning this object rather
* than base */
Expand Down
2 changes: 1 addition & 1 deletion gcc/rust/resolve/rust-early-name-resolver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -953,7 +953,7 @@ EarlyNameResolver::visit (AST::MacroInvocation &invoc)
if (has_semicolon)
source_node = invoc.get_macro_node_id ();
else
source_node = invoc.get_pattern_node_id ();
source_node = invoc.get_node_id ();
auto seg
= CanonicalPath::new_seg (source_node, invoc_data.get_path ().as_string ());

Expand Down

0 comments on commit c82bbb0

Please sign in to comment.