File tree Expand file tree Collapse file tree 2 files changed +25
-4
lines changed
Expand file tree Collapse file tree 2 files changed +25
-4
lines changed Original file line number Diff line number Diff line change @@ -613,17 +613,26 @@ ClassDef: ast::LocatedStatement = {
613613 },
614614};
615615
616+ Path: ast::Expression = {
617+ <n:Identifier> => ast::Expression::Identifier { name: n },
618+ <p:Path> "." <n:name> => {
619+ ast::Expression::Attribute {
620+ value: Box::new(p),
621+ name: n,
622+ }
623+ },
624+ };
625+
616626// Decorators:
617627Decorator: ast::Expression = {
618- "@" <n:DottedName> <a: ("(" ArgumentList ")")?> "\n" => {
619- let name = ast::Expression::Identifier { name: n };
628+ "@" <p:Path> <a: ("(" ArgumentList ")")?> "\n" => {
620629 match a {
621630 Some((_, args, _)) => ast::Expression::Call {
622- function: Box::new(name ),
631+ function: Box::new(p ),
623632 args: args.0,
624633 keywords: args.1,
625634 },
626- None => name ,
635+ None => p ,
627636 }
628637 },
629638};
Original file line number Diff line number Diff line change @@ -14,3 +14,15 @@ def add(a, b):
1414
1515assert c == 14
1616
17+
18+ def f (func ): return lambda : 42
19+ class A : pass
20+ a = A ()
21+ a .a = A ()
22+ a .a .x = f
23+
24+ @a .a .x
25+ def func ():
26+ pass
27+
28+ assert func () == 42
You can’t perform that action at this time.
0 commit comments