(path: any, options: any, print: any)
| 227 | // configuration object originally passed into the Printer constructor). |
| 228 | // Its properties are documented in lib/options.js. |
| 229 | function genericPrintNoParens(path: any, options: any, print: any) { |
| 230 | const n = path.getValue(); |
| 231 | |
| 232 | if (!n) { |
| 233 | return fromString(""); |
| 234 | } |
| 235 | |
| 236 | if (typeof n === "string") { |
| 237 | return fromString(n, options); |
| 238 | } |
| 239 | |
| 240 | namedTypes.Printable.assert(n); |
| 241 | |
| 242 | const parts: (string | Lines)[] = []; |
| 243 | |
| 244 | switch (n.type) { |
| 245 | case "File": |
| 246 | return path.call(print, "program"); |
| 247 | |
| 248 | case "Program": |
| 249 | // Babel 6 |
| 250 | if (n.directives) { |
| 251 | path.each(function (childPath: any) { |
| 252 | parts.push(print(childPath), ";\n"); |
| 253 | }, "directives"); |
| 254 | } |
| 255 | |
| 256 | if (n.interpreter) { |
| 257 | parts.push(path.call(print, "interpreter")); |
| 258 | } |
| 259 | |
| 260 | parts.push( |
| 261 | path.call( |
| 262 | (bodyPath: any) => printStatementSequence(bodyPath, options, print), |
| 263 | "body", |
| 264 | ), |
| 265 | ); |
| 266 | |
| 267 | return concat(parts); |
| 268 | |
| 269 | case "Noop": // Babel extension. |
| 270 | case "EmptyStatement": |
| 271 | return fromString(""); |
| 272 | |
| 273 | case "ExpressionStatement": |
| 274 | return concat([path.call(print, "expression"), ";"]); |
| 275 | |
| 276 | case "ParenthesizedExpression": // Babel extension. |
| 277 | return concat(["(", path.call(print, "expression"), ")"]); |
| 278 | |
| 279 | case "BinaryExpression": |
| 280 | case "LogicalExpression": |
| 281 | case "AssignmentExpression": |
| 282 | return fromString(" ").join([ |
| 283 | path.call(print, "left"), |
| 284 | n.operator, |
| 285 | path.call(print, "right"), |
| 286 | ]); |
no test coverage detected
searching dependent graphs…