Legend:
- Unmodified
- Added
- Removed
-
imaps-frontend/node_modules/@babel/generator/lib/generators/classes.js
rd565449 r0c6b92a 21 21 const inExport = isExportDefaultDeclaration(parent) || isExportNamedDeclaration(parent); 22 22 if (!inExport || !this._shouldPrintDecoratorsBeforeExport(parent)) { 23 this.printJoin(node.decorators , node);23 this.printJoin(node.decorators); 24 24 } 25 25 if (node.declare) { … … 34 34 if (node.id) { 35 35 this.space(); 36 this.print(node.id , node);37 } 38 this.print(node.typeParameters , node);36 this.print(node.id); 37 } 38 this.print(node.typeParameters); 39 39 if (node.superClass) { 40 40 this.space(); 41 41 this.word("extends"); 42 42 this.space(); 43 this.print(node.superClass , node);44 this.print(node.superTypeParameters , node);43 this.print(node.superClass); 44 this.print(node.superTypeParameters); 45 45 } 46 46 if (node.implements) { … … 48 48 this.word("implements"); 49 49 this.space(); 50 this.printList(node.implements , node);51 } 52 this.space(); 53 this.print(node.body , node);50 this.printList(node.implements); 51 } 52 this.space(); 53 this.print(node.body); 54 54 } 55 55 function ClassBody(node) { … … 59 59 } else { 60 60 this.newline(); 61 const exit = this.enterForStatementInit(false); 62 this.printSequence(node.body, node, { 63 indent: true 61 const separator = classBodyEmptySemicolonsPrinter(this, node); 62 separator == null || separator(-1); 63 const exit = this.enterDelimited(); 64 this.printJoin(node.body, { 65 statement: true, 66 indent: true, 67 separator, 68 printTrailingSeparator: true 64 69 }); 65 70 exit(); … … 68 73 } 69 74 } 75 function classBodyEmptySemicolonsPrinter(printer, node) { 76 if (!printer.tokenMap || node.start == null || node.end == null) { 77 return null; 78 } 79 const indexes = printer.tokenMap.getIndexes(node); 80 if (!indexes) return null; 81 let k = 1; 82 let occurrenceCount = 0; 83 let nextLocIndex = 0; 84 const advanceNextLocIndex = () => { 85 while (nextLocIndex < node.body.length && node.body[nextLocIndex].start == null) { 86 nextLocIndex++; 87 } 88 }; 89 advanceNextLocIndex(); 90 return i => { 91 if (nextLocIndex <= i) { 92 nextLocIndex = i + 1; 93 advanceNextLocIndex(); 94 } 95 const end = nextLocIndex === node.body.length ? node.end : node.body[nextLocIndex].start; 96 let tok; 97 while (k < indexes.length && printer.tokenMap.matchesOriginal(tok = printer._tokens[indexes[k]], ";") && tok.start < end) { 98 printer.token(";", undefined, occurrenceCount++); 99 k++; 100 } 101 }; 102 } 70 103 function ClassProperty(node) { 71 var _node$key$loc; 72 this.printJoin(node.decorators, node); 73 const endLine = (_node$key$loc = node.key.loc) == null || (_node$key$loc = _node$key$loc.end) == null ? void 0 : _node$key$loc.line; 74 if (endLine) this.catchUp(endLine); 104 this.printJoin(node.decorators); 105 if (!node.static && !this.format.preserveFormat) { 106 var _node$key$loc; 107 const endLine = (_node$key$loc = node.key.loc) == null || (_node$key$loc = _node$key$loc.end) == null ? void 0 : _node$key$loc.line; 108 if (endLine) this.catchUp(endLine); 109 } 75 110 this.tsPrintClassMemberModifiers(node); 76 111 if (node.computed) { 77 112 this.tokenChar(91); 78 this.print(node.key , node);113 this.print(node.key); 79 114 this.tokenChar(93); 80 115 } else { 81 116 this._variance(node); 82 this.print(node.key , node);117 this.print(node.key); 83 118 } 84 119 if (node.optional) { … … 88 123 this.tokenChar(33); 89 124 } 90 this.print(node.typeAnnotation , node);125 this.print(node.typeAnnotation); 91 126 if (node.value) { 92 127 this.space(); 93 128 this.tokenChar(61); 94 129 this.space(); 95 this.print(node.value , node);130 this.print(node.value); 96 131 } 97 132 this.semicolon(); … … 99 134 function ClassAccessorProperty(node) { 100 135 var _node$key$loc2; 101 this.printJoin(node.decorators , node);136 this.printJoin(node.decorators); 102 137 const endLine = (_node$key$loc2 = node.key.loc) == null || (_node$key$loc2 = _node$key$loc2.end) == null ? void 0 : _node$key$loc2.line; 103 138 if (endLine) this.catchUp(endLine); … … 107 142 if (node.computed) { 108 143 this.tokenChar(91); 109 this.print(node.key , node);144 this.print(node.key); 110 145 this.tokenChar(93); 111 146 } else { 112 147 this._variance(node); 113 this.print(node.key , node);148 this.print(node.key); 114 149 } 115 150 if (node.optional) { … … 119 154 this.tokenChar(33); 120 155 } 121 this.print(node.typeAnnotation , node);156 this.print(node.typeAnnotation); 122 157 if (node.value) { 123 158 this.space(); 124 159 this.tokenChar(61); 125 160 this.space(); 126 this.print(node.value , node);161 this.print(node.value); 127 162 } 128 163 this.semicolon(); 129 164 } 130 165 function ClassPrivateProperty(node) { 131 this.printJoin(node.decorators , node);166 this.printJoin(node.decorators); 132 167 if (node.static) { 133 168 this.word("static"); 134 169 this.space(); 135 170 } 136 this.print(node.key , node);137 this.print(node.typeAnnotation , node);171 this.print(node.key); 172 this.print(node.typeAnnotation); 138 173 if (node.value) { 139 174 this.space(); 140 175 this.tokenChar(61); 141 176 this.space(); 142 this.print(node.value , node);177 this.print(node.value); 143 178 } 144 179 this.semicolon(); … … 147 182 this._classMethodHead(node); 148 183 this.space(); 149 this.print(node.body , node);184 this.print(node.body); 150 185 } 151 186 function ClassPrivateMethod(node) { 152 187 this._classMethodHead(node); 153 188 this.space(); 154 this.print(node.body , node);189 this.print(node.body); 155 190 } 156 191 function _classMethodHead(node) { 157 var _node$key$loc3; 158 this.printJoin(node.decorators, node); 159 const endLine = (_node$key$loc3 = node.key.loc) == null || (_node$key$loc3 = _node$key$loc3.end) == null ? void 0 : _node$key$loc3.line; 160 if (endLine) this.catchUp(endLine); 192 this.printJoin(node.decorators); 193 if (!this.format.preserveFormat) { 194 var _node$key$loc3; 195 const endLine = (_node$key$loc3 = node.key.loc) == null || (_node$key$loc3 = _node$key$loc3.end) == null ? void 0 : _node$key$loc3.line; 196 if (endLine) this.catchUp(endLine); 197 } 161 198 this.tsPrintClassMemberModifiers(node); 162 199 this._methodHead(node); … … 170 207 } else { 171 208 this.newline(); 172 this.printSequence(node.body, node,{209 this.printSequence(node.body, { 173 210 indent: true 174 211 });
Note:
See TracChangeset
for help on using the changeset viewer.