@@ -116,8 +116,12 @@ function genericPrint(path, options, print) {
116116 return concat ( parts ) ;
117117}
118118
119- function printPropertyLookup ( path , options , print ) {
120- return concat ( [ "->" , path . call ( print , "offset" ) ] ) ;
119+ function printPropertyLookup ( path , options , print , nullsafe = false ) {
120+ return concat ( [ nullsafe ? "?" : "" , "->" , path . call ( print , "offset" ) ] ) ;
121+ }
122+
123+ function printNullsafePropertyLookup ( path , options , print ) {
124+ return printPropertyLookup ( path , options , print , true ) ;
121125}
122126
123127function printStaticLookup ( path , options , print ) {
@@ -243,6 +247,8 @@ function printMemberChain(path, options, print) {
243247
244248 if ( node . kind === "propertylookup" ) {
245249 printedMemberish = printPropertyLookup ( path , options , print ) ;
250+ } else if ( node . kind === "nullsafepropertylookup" ) {
251+ printedMemberish = printNullsafePropertyLookup ( path , options , print ) ;
246252 } else if ( node . kind === "staticlookup" ) {
247253 printedMemberish = printStaticLookup ( path , options , print ) ;
248254 } else {
@@ -842,6 +848,8 @@ function printLookupNodes(path, options, print) {
842848 switch ( node . kind ) {
843849 case "propertylookup" :
844850 return printPropertyLookup ( path , options , print ) ;
851+ case "nullsafepropertylookup" :
852+ return printNullsafePropertyLookup ( path , options , print ) ;
845853 case "staticlookup" :
846854 return printStaticLookup ( path , options , print ) ;
847855 case "offsetlookup" :
@@ -2175,6 +2183,7 @@ function printNode(path, options, print) {
21752183 : path . call ( print , "what" ) ,
21762184 ] ) ;
21772185 case "propertylookup" :
2186+ case "nullsafepropertylookup" :
21782187 case "staticlookup" :
21792188 case "offsetlookup" : {
21802189 const parent = path . getParentNode ( ) ;
@@ -2920,7 +2929,8 @@ function printNode(path, options, print) {
29202929 return node . comments
29212930 ? comments . printComments ( path . getValue ( ) . comments , options )
29222931 : "" ;
2923-
2932+ case "namedargument" :
2933+ return concat ( [ node . name , ": " , path . call ( print , "value" ) ] ) ;
29242934 case "error" :
29252935 default :
29262936 // istanbul ignore next
0 commit comments