Skip to content
This repository was archived by the owner on May 11, 2023. It is now read-only.

Commit a42e77a

Browse files
committed
Revert into_node and node() changes
1 parent 5ffa8a1 commit a42e77a

File tree

3 files changed

+3
-21
lines changed

3 files changed

+3
-21
lines changed

compiler/ast/asdl_rs.py

-18
Original file line numberDiff line numberDiff line change
@@ -711,24 +711,6 @@ def write_ast_def(mod, typeinfo, f):
711711
}
712712
}
713713
714-
impl<T, U> std::ops::Deref for Located<T, U> {
715-
type Target = T;
716-
717-
fn deref(&self) -> &Self::Target {
718-
&self.node
719-
}
720-
721-
pub const fn start(&self) -> Location {
722-
self.location
723-
}
724-
725-
/// Returns the node's [`end_location`](Located::end_location) or [`location`](Located::start) if
726-
/// [`end_location`](Located::end_location) is `None`.
727-
pub fn end(&self) -> Location {
728-
self.end_location.unwrap_or(self.location)
729-
}
730-
}
731-
732714
impl<T, U> std::ops::Deref for Located<T, U> {
733715
type Target = T;
734716

compiler/parser/python.lalrpop

+2-2
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ ClosedPattern: ast::Pattern = {
519519

520520
SequencePattern: ast::PatternKind = {
521521
// A single-item tuple is a special case: it's a group pattern, _not_ a sequence pattern.
522-
<location:@L> "(" <pattern:Pattern> ")" <end_location:@R> => pattern.into_node(),
522+
<location:@L> "(" <pattern:Pattern> ")" <end_location:@R> => pattern.node,
523523
<location:@L> "(" ")" <end_location:@R> => ast::PatternKind::MatchSequence {
524524
patterns: vec![],
525525
},
@@ -1554,7 +1554,7 @@ Atom<Goal>: ast::Expr = {
15541554
},
15551555
<location:@L> "(" <left:(<OneOrMore<Test<"all">>> ",")?> <mid:NamedOrStarExpr> <right:("," <TestOrStarNamedExpr>)*> <trailing_comma:","?> ")" <end_location:@R> =>? {
15561556
if left.is_none() && right.is_empty() && trailing_comma.is_none() {
1557-
if matches!(mid.node(), ast::ExprKind::Starred { .. }) {
1557+
if matches!(mid.node, ast::ExprKind::Starred { .. }) {
15581558
Err(LexicalError{
15591559
error: LexicalErrorType::OtherError("cannot use starred expression here".to_string()),
15601560
location: mid.start(),

compiler/parser/src/function.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ pub(crate) fn parse_args(func_args: Vec<FunctionArgument>) -> Result<ArgumentLis
144144

145145
// Check if an expression is a starred expression.
146146
fn is_starred(exp: &ast::Expr) -> bool {
147-
matches!(exp.node(), ast::ExprKind::Starred { .. })
147+
matches!(exp.node, ast::ExprKind::Starred { .. })
148148
}
149149

150150
#[cfg(test)]

0 commit comments

Comments
 (0)