Sha256: 8ebdc8fd6cfbbd5abf9036ab79cc8fa5f65f5797255b54c40853be92f4bbf133
Contents?: true
Size: 896 Bytes
Versions: 13
Compression:
Stored size: 896 Bytes
Contents
const { align, concat, group, join, line } = require("../../prettier"); const { literal } = require("../../utils"); function printSuper(path, opts, print) { const args = path.getValue().body[0]; if (args.type === "arg_paren") { // In case there are explicitly no arguments but they are using parens, // we assume they are attempting to override the initializer and pass no // arguments up. if (args.body[0] === null) { return "super()"; } return concat(["super", path.call(print, "body", 0)]); } const keyword = "super "; const argsDocs = path.call(print, "body", 0); return group( concat([ keyword, align(keyword.length, group(join(concat([",", line]), argsDocs))) ]) ); } // Version of super without any parens or args. const printZSuper = literal("super"); module.exports = { super: printSuper, zsuper: printZSuper };
Version data entries
13 entries across 13 versions & 1 rubygems