| | |
| | | return 2 + this.value.length; |
| | | }; |
| | | |
| | | /** Count commas/semicolons necessary to show a list of expressions/statements */ |
| | | const list_overhead = (array) => array.length && array.length - 1; |
| | | |
| | | AST_Block.prototype._size = function () { |
| | |
| | | && this.argnames[0] instanceof AST_Symbol |
| | | ) |
| | | ) { |
| | | args_and_arrow += 2; |
| | | args_and_arrow += 2; // parens around the args |
| | | } |
| | | |
| | | const body_overhead = this.is_braceless() ? 0 : list_overhead(this.body) + 2; |
| | |
| | | return 7 + list_overhead(this.body); |
| | | }; |
| | | |
| | | /*#__INLINE__*/ |
| | | const def_size = (size, def) => size + list_overhead(def.definitions); |
| | | |
| | | AST_Var.prototype._size = function () { |
| | | return def_size(4, this); |
| | | return 4 + list_overhead(this.definitions); |
| | | }; |
| | | |
| | | AST_Let.prototype._size = function () { |
| | | return def_size(4, this); |
| | | return 4 + list_overhead(this.definitions); |
| | | }; |
| | | |
| | | AST_Const.prototype._size = function () { |
| | | return def_size(6, this); |
| | | return 6 + list_overhead(this.definitions); |
| | | }; |
| | | |
| | | AST_VarDef.prototype._size = function () { |
| | |
| | | |
| | | AST_Undefined.prototype._size = () => 6; // "void 0" |
| | | |
| | | AST_Hole.prototype._size = () => 0; // comma is taken into account |
| | | AST_Hole.prototype._size = () => 0; // comma is taken into account by list_overhead() |
| | | |
| | | AST_Infinity.prototype._size = () => 8; |
| | | |