@@ -19,6 +19,7 @@ import {
1919 LambdefContext ,
2020 Single_string_template_atomContext ,
2121 ArglistContext ,
22+ CallArgumentsContext ,
2223} from './Python3Parser' ;
2324import { UserError } from '../compiler/UserError' ;
2425import { Python3ParserVisitor } from './Python3ParserVisitor' ;
@@ -36,7 +37,7 @@ const nodeVisitor = <R>(visitor: { visitNode: (node: RuleNode, children: R[]) =>
3637 const result : R [ ] = [ ] ;
3738 for ( let i = 0 ; i < node . childCount ; i ++ ) {
3839 const child = node . getChild ( i ) ;
39- if ( child && child . childCount ) {
40+ if ( child ? .childCount ) {
4041 result . push ( child . accept ( this ) ) ;
4142 }
4243 }
@@ -175,13 +176,22 @@ export class PythonParser {
175176 } else {
176177 return singleNodeReturn ( ) ;
177178 }
178- } else if ( node instanceof TrailerContext ) {
179- const name = node . NAME ( ) ;
179+ } else if ( node instanceof CallArgumentsContext ) {
180180 const argsList = node . arglist ( ) ;
181181 if ( argsList ) {
182- // trailer with arglist have a single child: arguments _list_
182+ // arglist have a single child: arguments _list_
183183 const args = children [ 0 ] ;
184184 return { call : args } ;
185+ } else {
186+ return { call : [ ] } ;
187+ }
188+ } else if ( node instanceof TrailerContext ) {
189+ const name = node . NAME ( ) ;
190+ const argsList = node . callArguments ( ) ;
191+ if ( argsList ) {
192+ // trailer with callArguments have a single child: CallArgumentsContext
193+ // which was already processed (see other if branch)
194+ return children [ 0 ] ;
185195 } else if ( name ) {
186196 return { identifier : t . identifier ( name . text ) } ;
187197 } else {
0 commit comments