@@ -273,7 +273,7 @@ func (o *StmtBase) stmtNode() {}
273273type FunctionDef struct {
274274 StmtBase
275275 Name Identifier
276- Args Arguments
276+ Args * Arguments
277277 Body []Stmt
278278 DecoratorList []Expr
279279 Returns Expr
@@ -283,7 +283,7 @@ type ClassDef struct {
283283 StmtBase
284284 Name Identifier
285285 Bases []Expr
286- Keywords []Keyword
286+ Keywords []* Keyword
287287 Starargs Expr
288288 Kwargs Expr
289289 Body []Stmt
@@ -498,7 +498,7 @@ type Call struct {
498498 ExprBase
499499 Function Expr
500500 Args []Expr
501- Keywords []Keyword
501+ Keywords []* Keyword
502502 Starargs Expr
503503 Kwargs Expr
504504}
@@ -534,37 +534,76 @@ type Attribute struct {
534534 Ctx ExprContext
535535}
536536
537+ // ExprNodes which have a settable context implement this
538+ type SetCtxer interface {
539+ SetCtx (ExprContext )
540+ }
541+
542+ func (o * Attribute ) SetCtx (Ctx ExprContext ) { o .Ctx = Ctx }
543+
544+ var _ = SetCtxer ((* Attribute )(nil ))
545+
537546type Subscript struct {
538547 ExprBase
539548 Value Expr
540549 Slice Slicer
541550 Ctx ExprContext
542551}
543552
553+ func (o * Subscript ) SetCtx (Ctx ExprContext ) { o .Ctx = Ctx }
554+
555+ var _ = SetCtxer ((* Subscript )(nil ))
556+
544557type Starred struct {
545558 ExprBase
546559 Value Expr
547560 Ctx ExprContext
548561}
549562
563+ func (o * Starred ) SetCtx (Ctx ExprContext ) { o .Ctx = Ctx }
564+
565+ var _ = SetCtxer ((* Starred )(nil ))
566+
550567type Name struct {
551568 ExprBase
552569 Id Identifier
553570 Ctx ExprContext
554571}
555572
573+ func (o * Name ) SetCtx (Ctx ExprContext ) { o .Ctx = Ctx }
574+
575+ var _ = SetCtxer ((* Name )(nil ))
576+
556577type List struct {
557578 ExprBase
558579 Elts []Expr
559580 Ctx ExprContext
560581}
561582
583+ func (o * List ) SetCtx (Ctx ExprContext ) {
584+ o .Ctx = Ctx
585+ for i := range o .Elts {
586+ o .Elts [i ].(SetCtxer ).SetCtx (Ctx )
587+ }
588+ }
589+
590+ var _ = SetCtxer ((* List )(nil ))
591+
562592type Tuple struct {
563593 ExprBase
564594 Elts []Expr
565595 Ctx ExprContext
566596}
567597
598+ func (o * Tuple ) SetCtx (Ctx ExprContext ) {
599+ o .Ctx = Ctx
600+ for i := range o .Elts {
601+ o .Elts [i ].(SetCtxer ).SetCtx (Ctx )
602+ }
603+ }
604+
605+ var _ = SetCtxer ((* Tuple )(nil ))
606+
568607// ------------------------------------------------------------
569608// Slicer nodes
570609// ------------------------------------------------------------
0 commit comments